|
Click
|
Base class for router configuration visitors. More...
#include <routervisitor.hh>
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 | |
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.
|
inline |
Construct an RouterVisitor.
|
inlinevirtual |
Destroy an RouterVisitor.
|
virtual |
Visit an element.
| e | element being visited |
| isoutput | true for output ports, false for input ports |
| port | port number being visited |
| from_e | element by which e was reached |
| from_port | port by which e/port was reached |
| distance | connection distance in breadth-first search |
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.
return the distance between two neighbour elements
| e | the first element |
| from_e | the 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.