AGX Dynamics  2.37.2.0
agxPowerLine::AbstractPowerLineTraverser< UnitPtr, DimensionPtr, ConnectorPtr, SubGraphPtr > Class Template Referenceabstract

Base class for all power line traversers. More...

#include <PowerLineTraverser.h>

Public Types

enum  TraversalMode { CONNECTIONS_ONLY, CONNECTIONS_AND_COMPOUNDS }
 Enumeration that controls how the traversal should behave when encountering compound GraphNodes. More...
 

Public Member Functions

 AbstractPowerLineTraverser ()
 
bool traverse (GraphNodeTypes typesToVisit, UnitPtr source, TraversalMode mode)
 Start a traversal that visits the types specified by the given GraphNodeTypes. More...
 
bool traverse (GraphNodeTypes typesToVisit, PowerLine *source, TraversalMode mode)
 Start a traversal from all the units in the powerline that visits the types specified by the given GraphNodeTypes. More...
 
bool traverseConnectors (UnitPtr source, TraversalMode mode)
 Start a traversal that only visits Connectors. More...
 
bool traverseDimensions (UnitPtr source, TraversalMode mode)
 Start a traversal that only visits PhysicalDimensions. More...
 
bool traverseUnits (UnitPtr source, TraversalMode mode)
 Start a traversal that only visits Units. More...
 

Protected Member Functions

virtual ~AbstractPowerLineTraverser ()
 
virtual bool shouldQueueChildren (UnitPtr unit)
 
virtual bool shouldQueueChildren (DimensionPtr dimension)
 
virtual bool shouldQueueChildren (ConnectorPtr connector)
 
virtual bool visit (UnitPtr unit)=0
 Called when a Unit is encountered in the graph, if the GraphNodeTypes variable includes UNITS. More...
 
virtual bool visit (DimensionPtr dimension)=0
 Called when a PhysicalDimension is encountered in the graph, if the GraphNodeTypes variable includes DIMENSIONS. More...
 
virtual bool visit (ConnectorPtr connector)=0
 Called when a Connector is encountered in the graph, if the GraphNodeTypes variable includes CONNECTORS. More...
 

Detailed Description

template<typename UnitPtr, typename DimensionPtr, typename ConnectorPtr, typename SubGraphPtr>
class agxPowerLine::AbstractPowerLineTraverser< UnitPtr, DimensionPtr, ConnectorPtr, SubGraphPtr >

Base class for all power line traversers.

Templated on the node type pointers so that both const and non-const versions are possible.

For each node in the graph the traverser may call the pure virtual 'visit' method on itself, depending on the current value of the GraphNodeTypes variable.

Subclasses can control the extent of the traversal by overriding 'shouldQueueChildren'. By returning 'false' when passed a Unit the traversal will not descend into the PhysicalDimensions of that Unit, and by returning 'false' when passed a PhysicalDimension or a Connector the traversal will not follow any Connections from that PhysicalDimension or Connector. The default implementations always returns true.

There are two types of relationships in a power line graph: connections and compounds. Connections link PhysicalDimensions and Connectors, while compounds nest Connectors and Units inside each other. The traverser can work in two modes. It either only follows the PhysicalDimension/Connector connections or both the connections and the nesting.

Definition at line 69 of file PowerLineTraverser.h.

Member Enumeration Documentation

◆ TraversalMode

template<typename UnitPtr, typename DimensionPtr, typename ConnectorPtr, typename SubGraphPtr>
enum agxPowerLine::AbstractPowerLineTraverser::TraversalMode

Enumeration that controls how the traversal should behave when encountering compound GraphNodes.

Enumerator
CONNECTIONS_ONLY 
CONNECTIONS_AND_COMPOUNDS 

Definition at line 76 of file PowerLineTraverser.h.

Constructor & Destructor Documentation

◆ AbstractPowerLineTraverser()

template<typename UnitPtr , typename DimensionPtr , typename ConnectorPtr , typename SubGraphPtr >
agxPowerLine::AbstractPowerLineTraverser< UnitPtr, DimensionPtr, ConnectorPtr, SubGraphPtr >::AbstractPowerLineTraverser ( )

Definition at line 34 of file PowerLineTraverserImpl.h.

◆ ~AbstractPowerLineTraverser()

template<typename UnitPtr, typename DimensionPtr, typename ConnectorPtr, typename SubGraphPtr>
virtual agxPowerLine::AbstractPowerLineTraverser< UnitPtr, DimensionPtr, ConnectorPtr, SubGraphPtr >::~AbstractPowerLineTraverser ( )
inlineprotectedvirtual

Definition at line 111 of file PowerLineTraverser.h.

Member Function Documentation

◆ shouldQueueChildren() [1/3]

template<typename UnitPtr, typename DimensionPtr , typename ConnectorPtr , typename SubGraphPtr >
bool agxPowerLine::AbstractPowerLineTraverser< UnitPtr, DimensionPtr, ConnectorPtr, SubGraphPtr >::shouldQueueChildren ( UnitPtr  unit)
protectedvirtual

◆ shouldQueueChildren() [2/3]

template<typename UnitPtr, typename DimensionPtr, typename ConnectorPtr , typename SubGraphPtr >
bool agxPowerLine::AbstractPowerLineTraverser< UnitPtr, DimensionPtr, ConnectorPtr, SubGraphPtr >::shouldQueueChildren ( DimensionPtr  dimension)
protectedvirtual

Reimplemented in agxPowerLine::PowerLineCallbackTraverser.

Definition at line 385 of file PowerLineTraverserImpl.h.

◆ shouldQueueChildren() [3/3]

template<typename UnitPtr, typename DimensionPtr, typename ConnectorPtr, typename SubGraphPtr >
bool agxPowerLine::AbstractPowerLineTraverser< UnitPtr, DimensionPtr, ConnectorPtr, SubGraphPtr >::shouldQueueChildren ( ConnectorPtr  connector)
protectedvirtual

Reimplemented in agxPowerLine::PowerLineCallbackTraverser.

Definition at line 391 of file PowerLineTraverserImpl.h.

◆ traverse() [1/2]

template<typename UnitPtr, typename DimensionPtr , typename ConnectorPtr , typename SubGraphPtr >
bool agxPowerLine::AbstractPowerLineTraverser< UnitPtr, DimensionPtr, ConnectorPtr, SubGraphPtr >::traverse ( GraphNodeTypes  typesToVisit,
UnitPtr  source,
TraversalMode  mode 
)

Start a traversal that visits the types specified by the given GraphNodeTypes.

Definition at line 291 of file PowerLineTraverserImpl.h.

◆ traverse() [2/2]

template<typename UnitPtr, typename DimensionPtr , typename ConnectorPtr , typename SubGraphPtr >
bool agxPowerLine::AbstractPowerLineTraverser< UnitPtr, DimensionPtr, ConnectorPtr, SubGraphPtr >::traverse ( GraphNodeTypes  typesToVisit,
PowerLine *  source,
TraversalMode  mode 
)

Start a traversal from all the units in the powerline that visits the types specified by the given GraphNodeTypes.

Definition at line 334 of file PowerLineTraverserImpl.h.

◆ traverseConnectors()

template<typename UnitPtr, typename DimensionPtr , typename ConnectorPtr , typename SubGraphPtr >
bool agxPowerLine::AbstractPowerLineTraverser< UnitPtr, DimensionPtr, ConnectorPtr, SubGraphPtr >::traverseConnectors ( UnitPtr  source,
TraversalMode  mode 
)

Start a traversal that only visits Connectors.

Definition at line 63 of file PowerLineTraverserImpl.h.

◆ traverseDimensions()

template<typename UnitPtr, typename DimensionPtr , typename ConnectorPtr , typename SubGraphPtr >
bool agxPowerLine::AbstractPowerLineTraverser< UnitPtr, DimensionPtr, ConnectorPtr, SubGraphPtr >::traverseDimensions ( UnitPtr  source,
TraversalMode  mode 
)

Start a traversal that only visits PhysicalDimensions.

Definition at line 53 of file PowerLineTraverserImpl.h.

◆ traverseUnits()

template<typename UnitPtr, typename DimensionPtr , typename ConnectorPtr , typename SubGraphPtr >
bool agxPowerLine::AbstractPowerLineTraverser< UnitPtr, DimensionPtr, ConnectorPtr, SubGraphPtr >::traverseUnits ( UnitPtr  source,
TraversalMode  mode 
)

Start a traversal that only visits Units.

Definition at line 43 of file PowerLineTraverserImpl.h.

◆ visit() [1/3]

template<typename UnitPtr, typename DimensionPtr, typename ConnectorPtr, typename SubGraphPtr>
virtual bool agxPowerLine::AbstractPowerLineTraverser< UnitPtr, DimensionPtr, ConnectorPtr, SubGraphPtr >::visit ( UnitPtr  unit)
protectedpure virtual

◆ visit() [2/3]

template<typename UnitPtr, typename DimensionPtr, typename ConnectorPtr, typename SubGraphPtr>
virtual bool agxPowerLine::AbstractPowerLineTraverser< UnitPtr, DimensionPtr, ConnectorPtr, SubGraphPtr >::visit ( DimensionPtr  dimension)
protectedpure virtual

Called when a PhysicalDimension is encountered in the graph, if the GraphNodeTypes variable includes DIMENSIONS.

Implemented in agxPowerLine::PowerLineCallbackTraverser, and agxPowerLine::PowerLineCollector.

◆ visit() [3/3]

template<typename UnitPtr, typename DimensionPtr, typename ConnectorPtr, typename SubGraphPtr>
virtual bool agxPowerLine::AbstractPowerLineTraverser< UnitPtr, DimensionPtr, ConnectorPtr, SubGraphPtr >::visit ( ConnectorPtr  connector)
protectedpure virtual

Called when a Connector is encountered in the graph, if the GraphNodeTypes variable includes CONNECTORS.

Implemented in agxPowerLine::PowerLineCallbackTraverser, and agxPowerLine::PowerLineCollector.


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