16 #ifndef __OMNETPP_CTOPOLOGY_H 17 #define __OMNETPP_CTOPOLOGY_H 21 #include "cownedobject.h" 22 #include "csimulation.h" 32 #define INFINITY HUGE_VAL 72 std::vector<Link*> inLinks;
73 std::vector<Link*> outLinks;
83 Node(
int moduleId=-1) {this->moduleId=moduleId; weight=0; enabled=
true; dist=INFINITY; outPath=
nullptr;}
197 Link(
double weight=1) {srcNode=destNode=
nullptr; srcGateId=destGateId=-1; this->weight=weight; enabled=
true;}
333 virtual bool matches(
cModule *module) = 0;
337 std::vector<Node*> nodes;
341 static bool lessByModuleId(
Node *a,
Node *b) {
return (
unsigned int)a->moduleId < (
unsigned int)b->moduleId; }
342 static bool isModuleIdLess(
Node *a,
int moduleId) {
return (
unsigned int)a->moduleId < (
unsigned int)moduleId; }
344 void unlinkFromSourceNode(
Link *link);
345 void unlinkFromDestNode(
Link *link);
354 explicit cTopology(
const char *name=
nullptr);
385 virtual std::string str()
const override;
392 virtual void parsimPack(
cCommBuffer *buffer)
const override;
399 virtual void parsimUnpack(
cCommBuffer *buffer)
override;
417 virtual void extractFromNetwork(
bool (*selfunc)(
cModule *,
void *),
void *userdata=
nullptr);
422 virtual void extractFromNetwork(
Predicate *predicate);
433 virtual void extractByModulePath(
const std::vector<std::string>& fullPathPatterns);
445 virtual void extractByNedTypeName(
const std::vector<std::string>& nedTypeNames);
465 virtual void extractByProperty(
const char *propertyName,
const char *value=
nullptr);
473 virtual void extractByParameter(
const char *paramName,
const char *paramValue=
nullptr);
478 virtual void clear();
488 virtual int addNode(
Node *node);
494 virtual void deleteNode(
Node *node);
501 virtual void addLink(
Link *link,
Node *srcNode,
Node *destNode);
510 virtual void addLink(
Link *link,
cGate *srcGate,
cGate *destGate);
516 virtual void deleteLink(
Link *link);
536 virtual Node *getNode(
int i);
560 virtual void calculateUnweightedSingleShortestPathsTo(
Node *target);
567 virtual void calculateWeightedSingleShortestPathsTo(
Node *target);
Supporting class for cTopology, represents a node in the graph.
Definition: ctopology.h:64
Node * getLocalNode() const
Definition: ctopology.h:300
bool isEnabled() const
Definition: ctopology.h:115
Represents a module gate.
Definition: cgate.h:63
cModule * getModule() const
Definition: ctopology.h:97
int getNumInLinks() const
Definition: ctopology.h:136
cModule * getModule(int id) const
Definition: csimulation.h:215
int getRemoteGateId() const
Definition: ctopology.h:259
void setWeight(double d)
Definition: ctopology.h:109
virtual cTopology * dup() const override
Definition: ctopology.h:379
bool isEnabled() const
Definition: ctopology.h:216
virtual Link * createLink()
Definition: ctopology.h:585
virtual Node * getTargetNode() const
Definition: ctopology.h:573
int getId() const
Definition: ccomponent.h:363
void enable()
Definition: ctopology.h:222
LinkOut * getPath(int) const
Definition: ctopology.h:173
double getDistanceToTarget() const
Definition: ctopology.h:160
int getLocalGateId() const
Definition: ctopology.h:310
void disable()
Definition: ctopology.h:228
This class represents modules in the simulation.
Definition: cmodule.h:47
cGate * getRemoteGate() const
Definition: ctopology.h:269
Buffer for the communications layer of parallel simulation.
Definition: ccommbuffer.h:41
Link(double weight=1)
Definition: ctopology.h:197
A cObject that keeps track of its owner. It serves as base class for many classes in the OMNeT++ libr...
Definition: cownedobject.h:104
Supporting class for cTopology, represents a link in the graph.
Definition: ctopology.h:181
void setWeight(double d)
Definition: ctopology.h:210
virtual Node * createNode(cModule *module)
Definition: ctopology.h:580
Routing support. The cTopology class was designed primarily to support routing in telecommunication o...
Definition: ctopology.h:54
Base class for selector objects used in extract...() methods of cTopology.
Definition: ctopology.h:329
double getWeight() const
Definition: ctopology.h:204
virtual int getNumNodes() const
Definition: ctopology.h:530
cGate * getLocalGate() const
Definition: ctopology.h:320
Definition: cabstracthistogram.h:21
Node * getRemoteNode() const
Definition: ctopology.h:249
int getModuleId() const
Definition: ctopology.h:92
Node(int moduleId=-1)
Definition: ctopology.h:83
Supporting class for cTopology.
Definition: ctopology.h:286
Supporting class for cTopology.
Definition: ctopology.h:240
Node * getRemoteNode() const
Definition: ctopology.h:295
cGate * getLocalGate() const
Definition: ctopology.h:274
void enable()
Definition: ctopology.h:121
int getRemoteGateId() const
Definition: ctopology.h:305
int getNumOutLinks() const
Definition: ctopology.h:146
Node * getLocalNode() const
Definition: ctopology.h:254
cGate * getRemoteGate() const
Definition: ctopology.h:315
cSimulation * getSimulation()
Returns the currently active simulation, or nullptr if there is none.
Definition: csimulation.h:575
int getNumPaths() const
Definition: ctopology.h:166
void disable()
Definition: ctopology.h:127
int getLocalGateId() const
Definition: ctopology.h:264
double getWeight() const
Definition: ctopology.h:103