|
xorp
|
The base class of a node for building a hierarchy. More...
#include <node_base.hh>
Classes | |
| struct | path |
Public Types | |
| typedef map< A, Edge< A > > | adjacency |
| typedef ref_ptr< Node< A > > | NodeRef |
Public Member Functions | |
| Node (A a, bool trace=false) | |
| A | nodename () |
| bool | set_nodename (A nodename) |
| Set nodename DONT' USE THIS METHOD. | |
| bool | add_edge (NodeRef dst, int weight) |
| Add a new edge. | |
| bool | update_edge_weight (NodeRef dst, int weight) |
| Update edge weight. | |
| bool | get_edge_weight (NodeRef dst, int &weight) |
| Get edge weight. | |
| bool | remove_edge (NodeRef dst) |
| Remove an edge. | |
| void | drop_adjacencies () |
| Drop all adjacencies. | |
| void | garbage_collect () |
| Remove all edges that point at invalid nodes. | |
| void | set_valid (bool p) |
| Set the valid state. | |
| bool | valid () |
| void | set_tentative (bool p) |
| Set the tentative state. | |
| bool | tentative () |
| Get the tentative state. | |
| void | invalidate_weights () |
| Invalidate the weights. | |
| bool | valid_weight () |
| Is the current entry valid. | |
| void | set_adjacent_weights (NodeRef me, int delta_weight, PriorityQueue< A > &tentative) |
| Set weights. | |
| bool | set_local_weight (int weight) |
| Set local weight. | |
| int | get_local_weight () |
| get local weight. | |
| void | set_first_hop (NodeRef n) |
| The first hop to this node. | |
| NodeRef | get_first_hop () |
| The first hop to this node. | |
| void | set_last_hop (NodeRef n) |
| The node before this. | |
| NodeRef | get_last_hop () |
| The node before this. | |
| bool | delta (RouteCmd< A > &rcmd) |
| Return the difference between this computation and the last. | |
| void | clear () |
| Clear all the references to other nodes as well as possible references to ourselves. | |
| string | pp () const |
| Pretty print this node with its adjacencies. | |
| string | str () const |
| Node (unsigned line) | |
| unsigned | line () const |
| virtual const Element * | accept (Visitor &v)=0 |
| Implementation of visitor. | |
| virtual bool | is_protocol_statement () const |
| Test whether this is a "protocol" statement. | |
| virtual bool | is_accept_or_reject () const |
| Test whether this is "accept" or "reject" statement. | |
| template<> | |
| string | str () const |
Private Attributes | |
| bool | _valid |
| A | _nodename |
| adjacency | _adjacencies |
| bool | _trace |
| bool | _tentative |
| path | _current |
| path | _previous |
| unsigned | _line |
The base class of a node for building a hierarchy.
Each node has a line number to associate it with a line in the configuration file. This is useful for reporting error location in semantic checks.
Nodes implement the visitor pattern [Inspired by Alexandrescu].
| line | the configuration line number where this node was created. |
Implementation of visitor.
| v | visit node with this pattern. |
Add a new edge.
| void Node< A >::drop_adjacencies | ( | ) |
Drop all adjacencies.
Used to revive invalid nodes.
Get edge weight.
| virtual bool Node< A >::is_accept_or_reject | ( | ) | const [inline, virtual] |
Test whether this is "accept" or "reject" statement.
Reimplemented in NodeAccept, and NodeReject.
| virtual bool Node< A >::is_protocol_statement | ( | ) | const [inline, virtual] |
Test whether this is a "protocol" statement.
Reimplemented in NodeProto.
| unsigned Node< A >::line | ( | ) | const [inline] |
| A Node< A >::nodename | ( | ) |
| void Node< A >::set_adjacent_weights | ( | NodeRef | me, |
| int | delta_weight, | ||
| PriorityQueue< A > & | tentative | ||
| ) |
Set weights.
Visit all neighbours that are tentative and add this weight.
| delta_weight | to add to this node. |
| tentative | add all updated adjacent nodes to the tentative set. |
| bool Node< A >::set_local_weight | ( | int | weight | ) |
| bool Node< A >::set_nodename | ( | A | nodename | ) |
| string Node< A >::str | ( | ) | const |
Update edge weight.
| bool Node< A >::valid | ( | ) | [inline] |