xorp

Spt< A > Class Template Reference

Shortest Path Tree. More...

#include <spt.hh>

List of all members.

Public Types

typedef map< A, typename Node
< A >::NodeRef > 
Nodes

Public Member Functions

 Spt (bool trace=true)
void clear ()
 Clear all state from this Spt instance.
bool set_origin (const A &node)
 Set the origin node.
bool add_node (const A &node)
 Add node.
bool update_node (const A &node)
 Update node.
bool remove_node (const A &node)
 Remove node.
bool exists_node (const A &node)
 Does this node exist?
bool add_edge (const A &src, int weight, const A &dst)
 Add a new edge.
bool update_edge_weight (const A &src, int weight, const A &dst)
 Update existing edge weight.
bool get_edge_weight (const A &src, int &weight, const A &dst)
 Get edge weight.
bool remove_edge (const A &src, const A &dst)
 Remove an edge.
bool compute (list< RouteCmd< A > > &routes)
 Compute the tree.
string str () const
 Convert this graph to presentation format.
Node< A >::NodeRef find_node (const A &node)
 Find this node.

Private Member Functions

bool dijkstra ()
 Dijkstra.
bool incremental_spt ()
 Incremental SPT.
void garbage_collect ()
 Remove all the nodes that have been marked for deletion.

Private Attributes

bool _trace
Node< A >::NodeRef _origin
Nodes _nodes

Detailed Description

template<typename A>
class Spt< A >

Shortest Path Tree.

Compute shortest path tree's


Member Function Documentation

template<typename A>
bool Spt< A >::add_edge ( const A &  src,
int  weight,
const A &  dst 
)

Add a new edge.

Parameters:
srcsource node must exist.
weightedge weight.
dstdestination node, created if necessary.
Returns:
true on success.
template<typename A>
bool Spt< A >::add_node ( const A &  node)

Add node.

Returns:
false if the node already exists, otherwise true.
template<typename A>
bool Spt< A >::compute ( list< RouteCmd< A > > &  routes)

Compute the tree.

Parameters:
routesa list of route adds, deletes and replaces that must be performed.
Returns:
true on success
template<typename A >
bool Spt< A >::dijkstra ( ) [private]

Dijkstra.

Returns:
true on success.
template<typename A>
bool Spt< A >::exists_node ( const A &  node)

Does this node exist?

Returns:
true if the node exists.
template<typename A>
bool Spt< A >::get_edge_weight ( const A &  src,
int &  weight,
const A &  dst 
)

Get edge weight.

Parameters:
srcsource node must exist.
weightof this edge returned.
dstdestination node must exist
Returns:
true on success.
template<typename A >
bool Spt< A >::incremental_spt ( ) [private]

Incremental SPT.

Returns:
true on success.
template<typename A>
bool Spt< A >::remove_edge ( const A &  src,
const A &  dst 
)

Remove an edge.

Parameters:
srcsource node must exist.
dstdestination node must exist
Returns:
true on success.
template<typename A>
bool Spt< A >::remove_node ( const A &  node)

Remove node.

Returns:
false if the node doesn't exist or has already been removed, otherwise true.
template<typename A>
bool Spt< A >::set_origin ( const A &  node)

Set the origin node.

Returns:
false if the node doesn't exist, otherwise true.
template<typename A >
string Spt< A >::str ( ) const

Convert this graph to presentation format.

Returns:
C++ string with the human-readable ASCII representation of the graph.
template<typename A>
bool Spt< A >::update_edge_weight ( const A &  src,
int  weight,
const A &  dst 
)

Update existing edge weight.

Parameters:
srcsource node must exist.
weightnew edge weight.
dstdestination node must exist
Returns:
true on success.
template<typename A>
bool Spt< A >::update_node ( const A &  node)

Update node.

Returns:
false if the node doesn't exist, otherwise true.

The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations