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::L3NetworkConfiguratorBase::Node inet::NetworkConfiguratorBase::Node inet::Ipv4NetworkConfigurator::Node inet::StreamRedundancyConfigurator::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...
 
double getNetworkId () const
 Returns the ID of the network to which this node corresponds. More...
 
void setNetworkId (int g)
 Sets the ID of the network to which this node corresponds. More...
 
bool isVisited () const
 Returns true if the node has been visited before in a traversal,. More...
 
void setVisited (bool v)
 Marks this node as visited or not visited in a traversal. 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...
 
LinkgetLinkIn (int i) const
 Returns ith incoming link of graph node. More...
 
int getNumOutLinks () const
 Returns the number of outgoing links from this graph node. More...
 
LinkgetLinkOut (int i) const
 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...
 
LinkgetPath (int i) const
 Returns the next link in the ith shortest paths towards the target node. More...
 

Protected Attributes

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

Friends

class Topology
 

Detailed Description

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

Constructor & Destructor Documentation

◆ Node()

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

Constructor.

79  {
80  this->moduleId = moduleId;
81  weight = 0;
82  enabled = true;
83  visited = false;
84  networkId = 0;
85  dist = INFINITY;
86  }

◆ ~Node()

Member Function Documentation

◆ disable()

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

Disable this node.

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

153 { enabled = false; }

◆ enable()

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

Enable this node.

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

147 { enabled = true; }

◆ getDistanceToTarget()

double inet::Topology::Node::getDistanceToTarget ( ) const
inline

Returns the distance of this node to the target node.

186 { return dist; }

Referenced by inet::NextHopNetworkConfigurator::addStaticRoutes(), and inet::Ipv4NetworkConfigurator::addStaticRoutes().

◆ getLinkIn()

Topology::Link * inet::Topology::Node::getLinkIn ( int  i) const

Returns ith incoming link of graph node.

27 {
28  if (i < 0 || i >= (int)inLinks.size())
29  throw cRuntimeError("Topology::Node::getLinkIn: invalid link index %d", i);
30  return inLinks[i];
31 }

Referenced by inet::Ipv4NetworkConfigurator::addStaticRoutes(), inet::Topology::calculateWeightedSingleShortestPathsTo(), inet::L3NetworkConfiguratorBase::dumpTopology(), inet::MacForwardingTableConfigurator::extendConfiguration(), and inet::NetworkConfiguratorBase::findLinkIn().

◆ getLinkOut()

◆ getModule()

◆ getModuleId()

int inet::Topology::Node::getModuleId ( ) const
inline

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

96 { return moduleId; }

◆ getNetworkId()

double inet::Topology::Node::getNetworkId ( ) const
inline

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

All nodes that belong to a connected network have the same network id.

119 { return networkId; }

Referenced by inet::L3NetworkConfiguratorBase::extractTopology(), and inet::Topology::findNetworks().

◆ getNumInLinks()

◆ getNumOutLinks()

◆ getNumPaths()

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.)

192 { return outPaths.size(); }

Referenced by inet::NextHopNetworkConfigurator::addStaticRoutes(), inet::Ipv4NetworkConfigurator::addStaticRoutes(), inet::FailureProtectionConfigurator::collectAllPaths(), and inet::MacForwardingTableConfigurator::extendConfiguration().

◆ getPath()

Link* inet::Topology::Node::getPath ( int  i) const
inline

◆ getWeight()

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.

107 { return weight; }

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

◆ isEnabled()

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.

141 { return enabled; }

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

◆ isVisited()

bool inet::Topology::Node::isVisited ( ) const
inline

Returns true if the node has been visited before in a traversal,.

130 { return visited; }

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

◆ setNetworkId()

void inet::Topology::Node::setNetworkId ( int  g)
inline

Sets the ID of the network to which this node corresponds.

All nodes that belong to a connected network have the same network id.

125 { networkId = g; }

Referenced by inet::Topology::extractFromNetwork(), and inet::Topology::findNetworks().

◆ setVisited()

void inet::Topology::Node::setVisited ( bool  v)
inline

Marks this node as visited or not visited in a traversal.

135 { visited = v; }

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

◆ setWeight()

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.

113 { weight = d; }

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

Friends And Related Function Documentation

◆ Topology

friend class Topology
friend

Member Data Documentation

◆ dist

◆ enabled

bool inet::Topology::Node::enabled
protected

◆ inLinks

◆ moduleId

◆ networkId

int inet::Topology::Node::networkId
protected

◆ outLinks

◆ outPaths

std::vector<Link *> inet::Topology::Node::outPaths
protected

◆ visited

bool inet::Topology::Node::visited
protected

◆ weight

double inet::Topology::Node::weight
protected

The documentation for this class was generated from the following files:
inet::Topology::Node::enabled
bool enabled
Definition: Topology.h:65
inet::Topology::Node::networkId
int networkId
Definition: Topology.h:67
inet::Topology::Node::weight
double weight
Definition: Topology.h:64
inet::Topology::Node::outLinks
std::vector< Link * > outLinks
Definition: Topology.h:69
inet::Topology::Node::visited
bool visited
Definition: Topology.h:66
inet::Topology::Node::moduleId
int moduleId
Definition: Topology.h:63
inet::units::units::g
milli< kg >::type g
Definition: Units.h:1071
inet::Topology::Node::outPaths
std::vector< Link * > outPaths
Definition: Topology.h:73
inet::Topology::Node::dist
double dist
Definition: Topology.h:72
INFINITY
#define INFINITY
Definition: Topology.h:20
inet::Topology::Node::inLinks
std::vector< Link * > inLinks
Definition: Topology.h:68