WSF
wsf::comm::graph::Graph Class Reference

#include <WsfCommGraph.hpp>

Inherits UtScriptAccessible.

Public Types

enum class  GraphAction { cADD_NODE , cADD_EDGE , cREMOVE_NODE , cREMOVE_EDGE }

Public Member Functions

 Graph ()=default
 Graph (const Graph &aSrc)=default
virtual ~Graph ()=default
Graphoperator= (const Graph &aRhs)=default
virtual NodeFindNode (const Address &aAddress) const
virtual const NodeCreateNode (const Address &aAddress)
virtual bool RemoveNode (const Node *aNodePtr)
virtual bool RemoveNode (const Address &aAddress)
virtual EdgeInsertEdge (const Node *aSourceNode, const Node *aDestinationNode, bool aIsEnabled, bool aIsStatic=false)
virtual EdgeInsertEdge (const Address &aSourceAddress, const Address &aDestinationAddress, bool aIsEnabled, bool aIsStatic=false)
virtual bool EraseEdge (const Node *aSourceNode, const Node *aDestinationNode)
virtual bool EraseEdge (const Address &aSourceAddress, const Address &aDestinationAddress)
virtual EdgeFindEdge (const Node *aSourceNode, const Node *aDestinationNode)
virtual EdgeFindEdge (const Address &aSourceAddress, const Address &aDestinationAddress)
std::vector< const Node * > GetNodes () const
virtual EdgeList GetIncomingNodeEdges (const Node *aNodePtr)
virtual EdgeList GetIncomingNodeEdges (const Address &aAddress)
virtual EdgeList GetOutgoingNodeEdges (const Node *aNodePtr) const
virtual EdgeList GetOutgoingNodeEdges (const Address &aAddress) const
virtual EdgeList GetAllNodeEdges (const Node *aNodePtr)
virtual EdgeList GetAllNodeEdges (const Address &aAddress)
virtual void RemoveNodeEdges (Node *aNode)
 Removes all incoming and outgoing edges to this node.
void SetUserModifiable (bool aCanModify)
bool IsUserModifiable () const

FindPath Method

This method finds the correct path from a source node to a destination node if possible (return false on failure). The path to the destination and the cost is provided. The user may provide a derived GraphCost class object that will provide correct node consideration and edge weighting based on the defined GraphCost method implementations. If GraphCost is not provided, the default algorithm considers all nodes and edges regardless of state, and finds the path using the least amount of hops to the destination.

bool FindPath (const Node *aSourceNode, const Node *aDestinationNode, GraphImpl::NodeList &aPath, double &aCost, const GraphImpl::cost_func *aCostClass=nullptr) const
bool FindPath (const Address &aSourceAddress, const Address &aDestinationAddress, AddressList &aAddressList, double &aCost, const GraphImpl::cost_func *aCostClass=nullptr) const
bool FindAnyPath (const Address &aSourceAddress, const Address &aDestinationAddress, AddressList *aAddressList, double &aCost, const GraphImpl::cost_func *aCostClass=nullptr) const
 Finds any path if one exists, with no guarantee that it will be the optimal shortest path.
void Clear ()
const char * GetScriptClassName () const override

Member Enumeration Documentation

◆ GraphAction

Enumerator
cADD_NODE 
cADD_EDGE 
cREMOVE_NODE 
cREMOVE_EDGE 

Constructor & Destructor Documentation

◆ Graph() [1/2]

wsf::comm::graph::Graph::Graph ( )
default

Referenced by Graph(), and operator=().

◆ Graph() [2/2]

wsf::comm::graph::Graph::Graph ( const Graph & aSrc)
default

References Graph().

◆ ~Graph()

virtual wsf::comm::graph::Graph::~Graph ( )
virtualdefault

Member Function Documentation

◆ Clear()

void wsf::comm::graph::Graph::Clear ( )

◆ CreateNode()

const Node * wsf::comm::graph::Graph::CreateNode ( const Address & aAddress)
virtual

◆ EraseEdge() [1/2]

bool wsf::comm::graph::Graph::EraseEdge ( const Address & aSourceAddress,
const Address & aDestinationAddress )
virtual

References EraseEdge(), and FindNode().

◆ EraseEdge() [2/2]

bool wsf::comm::graph::Graph::EraseEdge ( const Node * aSourceNode,
const Node * aDestinationNode )
virtual

◆ FindAnyPath()

bool wsf::comm::graph::Graph::FindAnyPath ( const Address & aSourceAddress,
const Address & aDestinationAddress,
AddressList * aAddressList,
double & aCost,
const GraphImpl::cost_func * aCostClass = nullptr ) const

Finds any path if one exists, with no guarantee that it will be the optimal shortest path.

Referenced by wsf::comm::router::ProtocolOSPF::InitializeLinkState().

◆ FindEdge() [1/2]

Edge * wsf::comm::graph::Graph::FindEdge ( const Address & aSourceAddress,
const Address & aDestinationAddress )
virtual

References FindEdge(), and FindNode().

◆ FindEdge() [2/2]

◆ FindNode()

◆ FindPath() [1/2]

bool wsf::comm::graph::Graph::FindPath ( const Address & aSourceAddress,
const Address & aDestinationAddress,
AddressList & aAddressList,
double & aCost,
const GraphImpl::cost_func * aCostClass = nullptr ) const

◆ FindPath() [2/2]

bool wsf::comm::graph::Graph::FindPath ( const Node * aSourceNode,
const Node * aDestinationNode,
GraphImpl::NodeList & aPath,
double & aCost,
const GraphImpl::cost_func * aCostClass = nullptr ) const

◆ GetAllNodeEdges() [1/2]

EdgeList wsf::comm::graph::Graph::GetAllNodeEdges ( const Address & aAddress)
virtual

References FindNode(), and GetAllNodeEdges().

◆ GetAllNodeEdges() [2/2]

EdgeList wsf::comm::graph::Graph::GetAllNodeEdges ( const Node * aNodePtr)
virtual

◆ GetIncomingNodeEdges() [1/2]

EdgeList wsf::comm::graph::Graph::GetIncomingNodeEdges ( const Address & aAddress)
virtual

◆ GetIncomingNodeEdges() [2/2]

EdgeList wsf::comm::graph::Graph::GetIncomingNodeEdges ( const Node * aNodePtr)
virtual

◆ GetNodes()

std::vector< const Node * > wsf::comm::graph::Graph::GetNodes ( ) const

Referenced by operator=().

◆ GetOutgoingNodeEdges() [1/2]

EdgeList wsf::comm::graph::Graph::GetOutgoingNodeEdges ( const Address & aAddress) const
virtual

◆ GetOutgoingNodeEdges() [2/2]

EdgeList wsf::comm::graph::Graph::GetOutgoingNodeEdges ( const Node * aNodePtr) const
virtual

◆ GetScriptClassName()

const char * wsf::comm::graph::Graph::GetScriptClassName ( ) const
inlineoverride

◆ InsertEdge() [1/2]

Edge * wsf::comm::graph::Graph::InsertEdge ( const Address & aSourceAddress,
const Address & aDestinationAddress,
bool aIsEnabled,
bool aIsStatic = false )
virtual

References FindNode(), and InsertEdge().

◆ InsertEdge() [2/2]

Edge * wsf::comm::graph::Graph::InsertEdge ( const Node * aSourceNode,
const Node * aDestinationNode,
bool aIsEnabled,
bool aIsStatic = false )
virtual

◆ IsUserModifiable()

bool wsf::comm::graph::Graph::IsUserModifiable ( ) const
inline

◆ operator=()

◆ RemoveNode() [1/2]

bool wsf::comm::graph::Graph::RemoveNode ( const Address & aAddress)
virtual

References FindNode(), and RemoveNode().

◆ RemoveNode() [2/2]

bool wsf::comm::graph::Graph::RemoveNode ( const Node * aNodePtr)
virtual

◆ RemoveNodeEdges()

void wsf::comm::graph::Graph::RemoveNodeEdges ( Node * aNode)
virtual

Removes all incoming and outgoing edges to this node.

References EraseEdge(), wsf::comm::graph::Node::GetAddress(), and GetAllNodeEdges().

Referenced by operator=().

◆ SetUserModifiable()

void wsf::comm::graph::Graph::SetUserModifiable ( bool aCanModify)
inline

The documentation for this class was generated from the following files:
Copyrights Multiple, All Rights Reserved