Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ChainPathNode Class Reference

#include <navpath.h>

Inheritance diagram for ChainPathNode:
PathNode

Public Types

enum  PartType { SOURCE, DESTINATION, ALL_POINTS }
 

Public Member Functions

bool isAbsolute () const
 
bool isSourceable () const
 
std::string getDescription () const
 
NavPathgetRequiredPath ()
 
std::deque< unsigned > initSearchQueue () const
 
bool isDestination (unsigned index) const
 
void setSupplierPath (NavPath *supplier)
 
NavPathgetSupplierPath ()
 
void setPartType (PartType part)
 
PartType getPartType ()
 
PathNodeclone () const
 
 ChainPathNode ()
 
 ChainPathNode (NavPath *supplier, PartType part)
 
 ~ChainPathNode ()
 
- Public Member Functions inherited from PathNode
virtual bool isCurrentDependant () const
 
virtual bool isTargetDependant () const
 
 PathNode ()
 
virtual ~PathNode ()
 

Detailed Description

Definition at line 367 of file navpath.h.

Member Enumeration Documentation

Enumerator
SOURCE 
DESTINATION 
ALL_POINTS 

Definition at line 395 of file navpath.h.

Constructor & Destructor Documentation

ChainPathNode::ChainPathNode ( )
inline

Definition at line 409 of file navpath.h.

Referenced by clone().

410  {
411  supplierPath = NULL;
412  }
ChainPathNode::ChainPathNode ( NavPath supplier,
PartType  part 
)
inline

Definition at line 413 of file navpath.h.

414  {
415  supplierPath = supplier;
416  type = part;
417  }
ChainPathNode::~ChainPathNode ( )
inline

Definition at line 418 of file navpath.h.

418 {}

Member Function Documentation

PathNode* ChainPathNode::clone ( ) const
inlinevirtual

Implements PathNode.

Definition at line 405 of file navpath.h.

References ChainPathNode().

406  {
407  return new ChainPathNode( supplierPath, type );
408  }
std::string ChainPathNode::getDescription ( ) const
virtual

Implements PathNode.

Definition at line 758 of file navpath.cpp.

References DESTINATION, NavPath::getName(), and SOURCE.

759 {
760  string temp = "Chain: ";
761  temp += supplierPath->getName();
762  if (type == SOURCE)
763  temp += " (Source)";
764  else if (type == DESTINATION)
765  temp += " (Destination)";
766  else
767  temp += " (All Points)";
768  return temp;
769 }
PartType ChainPathNode::getPartType ( )
inline

Definition at line 400 of file navpath.h.

401  {
402  return type;
403  }
NavPath* ChainPathNode::getRequiredPath ( )
inlinevirtual

Reimplemented from PathNode.

Definition at line 380 of file navpath.h.

381  {
382  return supplierPath;
383  }
NavPath* ChainPathNode::getSupplierPath ( )
inline

Definition at line 391 of file navpath.h.

392  {
393  return supplierPath;
394  }
std::deque< unsigned > ChainPathNode::initSearchQueue ( ) const
virtual

Implements PathNode.

Definition at line 771 of file navpath.cpp.

References DESTINATION, NavPath::getAbsoluteDestination(), NavPath::getAbsoluteSource(), NavPath::getAllPoints(), i, and SOURCE.

772 {
773  deque< unsigned >systemDeque;
774  if (type == SOURCE) {
775  systemDeque.push_back( supplierPath->getAbsoluteSource() );
776  } else if (type == DESTINATION) {
777  systemDeque.push_back( supplierPath->getAbsoluteDestination() );
778  } else {
779  const list< unsigned > *systems = supplierPath->getAllPoints();
780  for (list< unsigned >::const_iterator i = systems->begin(); i != systems->end(); ++i)
781  systemDeque.push_back( *i );
782  }
783  return systemDeque;
784 }
bool ChainPathNode::isAbsolute ( ) const
inlinevirtual

Implements PathNode.

Definition at line 370 of file navpath.h.

References ALL_POINTS.

371  {
372  return type == ALL_POINTS ? false : true;
373  }
bool ChainPathNode::isDestination ( unsigned  index) const
virtual

Implements PathNode.

Definition at line 786 of file navpath.cpp.

References DESTINATION, NavPath::getAbsoluteDestination(), NavPath::getAbsoluteSource(), NavPath::getAllPoints(), i, index, and SOURCE.

787 {
788  if (type == SOURCE) {
789  return supplierPath->getAbsoluteSource() == index;
790  } else if (type == DESTINATION) {
791  return supplierPath->getAbsoluteDestination() == index;
792  } else {
793  const list< unsigned > *systems = supplierPath->getAllPoints();
794  for (list< unsigned >::const_iterator i = systems->begin(); i != systems->end(); ++i)
795  if ( (*i) == index )
796  return true;
797  return false;
798  }
799 }
bool ChainPathNode::isSourceable ( ) const
inlinevirtual

Implements PathNode.

Definition at line 374 of file navpath.h.

375  {
376  return true;
377  }
void ChainPathNode::setPartType ( PartType  part)
inline

Definition at line 396 of file navpath.h.

397  {
398  type = part;
399  }
void ChainPathNode::setSupplierPath ( NavPath supplier)
inline

Definition at line 387 of file navpath.h.

388  {
389  supplierPath = supplier;
390  }

The documentation for this class was generated from the following files: