INET Framework for OMNeT++/OMNEST
inet::Topology::Node Class Reference

Supporting class for Topology, represents a node in the graph. More...

#include <Topology.h>

Inheritance diagram for inet::Topology::Node:
inet::L2NetworkConfigurator::Node inet::NetworkConfiguratorBase::Node inet::IPv4NetworkConfigurator::Node

Public Member Functions

 Node (int moduleId=-1)
 Constructor. More...
 
virtual ~Node ()
 
Node attributes: weight, enabled state, correspondence to modules.
int getModuleId () const
 Returns the ID of the network module to which this node corresponds. More...
 
cModule * getModule () const
 Returns the pointer to the network module to which this node corresponds. More...
 
double getWeight () const
 Returns the weight of this node. More...
 
void setWeight (double d)
 Sets the weight of this node. More...
 
bool isEnabled () const
 Returns true of this node is enabled. More...
 
void enable ()
 Enable this node. More...
 
void disable ()
 Disable this node. More...
 
Node connectivity.
int getNumInLinks () const
 Returns the number of incoming links to this graph node. More...
 
LinkIngetLinkIn (int i)
 Returns ith incoming link of graph node. More...
 
int getNumOutLinks () const
 Returns the number of outgoing links from this graph node. More...
 
LinkOutgetLinkOut (int i)
 Returns ith outgoing link of graph node. More...
 
Result of shortest path extraction.
double getDistanceToTarget () const
 Returns the distance of this node to the target node. More...
 
int getNumPaths () const
 Returns the number of shortest paths towards the target node. More...
 
LinkOutgetPath (int) const
 Returns the next link in the ith shortest paths towards the target node. More...
 

Protected Attributes

int moduleId
 
double weight
 
bool enabled
 
std::vector< Link * > inLinks
 
std::vector< Link * > outLinks
 
double dist
 
LinkoutPath
 

Friends

class Topology
 

Detailed Description

Supporting class for Topology, represents a node in the graph.

Constructor & Destructor Documentation

inet::Topology::Node::Node ( int  moduleId = -1)
inline

Constructor.

89 { this->moduleId = moduleId; weight = 0; enabled = true; dist = INFINITY; outPath = nullptr; }
#define INFINITY
Definition: Topology.h:29
bool enabled
Definition: Topology.h:77
double dist
Definition: Topology.h:82
Link * outPath
Definition: Topology.h:83
int moduleId
Definition: Topology.h:75
double weight
Definition: Topology.h:76
virtual inet::Topology::Node::~Node ( )
inlinevirtual

Member Function Documentation

void inet::Topology::Node::disable ( )
inline

Disable this node.

This has significance with the shortest path finder methods of Topology.

133 { enabled = false; }
bool enabled
Definition: Topology.h:77
void inet::Topology::Node::enable ( )
inline

Enable this node.

This has significance with the shortest path finder methods of Topology.

127 { enabled = true; }
bool enabled
Definition: Topology.h:77
double inet::Topology::Node::getDistanceToTarget ( ) const
inline

Returns the distance of this node to the target node.

166 { return dist; }
double dist
Definition: Topology.h:82
Topology::LinkIn * inet::Topology::Node::getLinkIn ( int  i)

Returns ith incoming link of graph node.

Referenced by inet::IPv4NetworkConfigurator::addStaticRoutes(), inet::Topology::calculateWeightedSingleShortestPathsTo(), and inet::NetworkConfiguratorBase::dumpTopology().

34 {
35  if (i < 0 || i >= (int)inLinks.size())
36  throw cRuntimeError("Topology::Node::getLinkIn: invalid link index %d", i);
37  return (Topology::LinkIn *)inLinks[i];
38 }
std::vector< Link * > inLinks
Definition: Topology.h:78
Topology::LinkOut * inet::Topology::Node::getLinkOut ( int  i)

Returns ith outgoing link of graph node.

Referenced by inet::STPTester::dfsVisit(), inet::NetworkConfiguratorBase::dumpTopology(), inet::NetworkConfiguratorBase::extractDeviceNeighbors(), inet::NetworkConfiguratorBase::extractTopology(), inet::L2NetworkConfigurator::findLinkOut(), and inet::NetworkConfiguratorBase::findLinkOut().

41 {
42  if (i < 0 || i >= (int)outLinks.size())
43  throw cRuntimeError("Topology::Node::getLinkOut: invalid index %d", i);
44  return (Topology::LinkOut *)outLinks[i];
45 }
std::vector< Link * > outLinks
Definition: Topology.h:79
cModule* inet::Topology::Node::getModule ( ) const
inline
int inet::Topology::Node::getModuleId ( ) const
inline

Returns the ID of the network module to which this node corresponds.

98 { return moduleId; }
int moduleId
Definition: Topology.h:75
int inet::Topology::Node::getNumInLinks ( ) const
inline

Returns the number of incoming links to this graph node.

Referenced by inet::IPv4NetworkConfigurator::addStaticRoutes(), inet::Topology::calculateWeightedSingleShortestPathsTo(), and inet::NetworkConfiguratorBase::dumpTopology().

142 { return inLinks.size(); }
std::vector< Link * > inLinks
Definition: Topology.h:78
int inet::Topology::Node::getNumOutLinks ( ) const
inline
int inet::Topology::Node::getNumPaths ( ) const
inline

Returns the number of shortest paths towards the target node.

(There may be several paths with the same length.)

Referenced by inet::GenericNetworkConfigurator::addStaticRoutes(), and inet::IPv4NetworkConfigurator::addStaticRoutes().

172 { return outPath ? 1 : 0; }
Link * outPath
Definition: Topology.h:83
LinkOut* inet::Topology::Node::getPath ( int  ) const
inline

Returns the next link in the ith shortest paths towards the target node.

(There may be several paths with the same length.)

Referenced by inet::GenericNetworkConfigurator::addStaticRoutes(), and inet::IPv4NetworkConfigurator::addStaticRoutes().

179 { return (LinkOut *)outPath; }
Link * outPath
Definition: Topology.h:83
double inet::Topology::Node::getWeight ( ) const
inline

Returns the weight of this node.

Weight is used with the weighted shortest path finder methods of Topology.

Referenced by inet::Topology::calculateWeightedSingleShortestPathsTo().

109 { return weight; }
double weight
Definition: Topology.h:76
bool inet::Topology::Node::isEnabled ( ) const
inline

Returns true of this node is enabled.

This has significance with the shortest path finder methods of Topology.

Referenced by inet::Topology::calculateWeightedSingleShortestPathsTo().

121 { return enabled; }
bool enabled
Definition: Topology.h:77
void inet::Topology::Node::setWeight ( double  d)
inline

Sets the weight of this node.

Weight is used with the weighted shortest path finder methods of Topology.

Referenced by inet::IPv4NetworkConfigurator::addStaticRoutes().

115 { weight = d; }
double weight
Definition: Topology.h:76

Friends And Related Function Documentation

friend class Topology
friend

Member Data Documentation

bool inet::Topology::Node::enabled
protected
double inet::Topology::Node::weight
protected

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