Click
Loading...
Searching...
No Matches
Public Member Functions | List of all members
RouterVisitor Class Reference

Base class for router configuration visitors. More...

#include <routervisitor.hh>

Inheritance diagram for RouterVisitor:
ElementTracker StackVisitor ElementCastTracker ElementNeighborhoodTracker

Public Member Functions

 RouterVisitor ()
 Construct an RouterVisitor.
 
virtual ~RouterVisitor ()
 Destroy an RouterVisitor.
 
virtual bool visit (Element *e, bool isoutput, int port, Element *from_e, int from_port, int distance)
 Visit an element.
 
virtual int distance (Element *e, Element *from_e)
 return the distance between two neighbour elements
 

Detailed Description

Base class for router configuration visitors.

RouterVisitor objects are used to traverse the router configuration graph. They are usually passed to the Router::visit_downstream() and Router::visit_upstream() functions.

Constructor & Destructor Documentation

◆ RouterVisitor()

RouterVisitor::RouterVisitor ( )
inline

Construct an RouterVisitor.

◆ ~RouterVisitor()

virtual RouterVisitor::~RouterVisitor ( )
inlinevirtual

Destroy an RouterVisitor.

Member Function Documentation

◆ visit()

bool RouterVisitor::visit ( Element *  e,
bool  isoutput,
int  port,
Element *  from_e,
int  from_port,
int  distance 
)
virtual

Visit an element.

Parameters
eelement being visited
isoutputtrue for output ports, false for input ports
portport number being visited
from_eelement by which e was reached
from_portport by which e/port was reached
distanceconnection distance in breadth-first search
Returns
true to continue traversing, false to stop

A Router configuration traversal calls this function once on each reached port. Configuration traversal is breadth-first; distance is the minimum connection distance from the traversal's start point to e/port. A traversal will call a port's visit() function at most once. from_e and from_port specify one port that is connected to e and port (there may be more than one). If isoutput is true, then e/port is an output port and from_e/from_port is an input port; if isoutput is false, the opposite holds.

The return value specifies whether traversal should continue through the e element. If it is true, then the traversal will continue based on e's packet flow specifier, via ports that connect to e/port (see Element::flow_code() for more).

The default implementation always returns true.

Reimplemented in ElementCastTracker, ElementNeighborhoodTracker, and StackVisitor.

◆ distance()

int RouterVisitor::distance ( Element *  e,
Element *  from_e 
)
virtual

return the distance between two neighbour elements

Parameters
ethe first element
from_ethe second element

A router traversal normally consider the distance of two neighbour elements to be 1. Hence, the distance specified to the visit() call above will be the number of elements since the beginning of the traversal in breadth-first. However, to take into consideration some path cost, one may override this function to consider the distance between elements to be more.

You normally do not need to override this.


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