 |
OMNeT++ API 6.2.0
Discrete Event Simulation Library
|
|
16 #ifndef __OMNETPP_CTOPOLOGY_H
17 #define __OMNETPP_CTOPOLOGY_H
22 #include "cownedobject.h"
23 #include "csimulation.h"
33 #define INFINITY HUGE_VAL
73 std::vector<Link*> inLinks;
74 std::vector<Link*> outLinks;
84 Node(
int moduleId=-1) {this->moduleId=moduleId; weight=0; enabled=
true; dist=INFINITY; outPath=
nullptr;}
198 Link(
double weight=1) {srcNode=destNode=
nullptr; srcGateId=destGateId=-1; this->weight=weight; enabled=
true;}
334 virtual bool matches(
cModule *module) = 0;
338 std::vector<Node*> nodes;
339 Node *target =
nullptr;
342 static bool lessByModuleId(
Node *a,
Node *b) {
return (
unsigned int)a->moduleId < (
unsigned int)b->moduleId; }
343 static bool isModuleIdLess(Node *a,
int moduleId) {
return (
unsigned int)a->moduleId < (
unsigned int)moduleId; }
345 void unlinkFromSourceNode(Link *link);
346 void unlinkFromDestNode(Link *link);
349 virtual void parsimPack(cCommBuffer *)
const override {
throw cRuntimeError(
this, E_CANTPACK);}
350 virtual void parsimUnpack(cCommBuffer *)
override {
throw cRuntimeError(
this, E_CANTPACK);}
359 explicit cTopology(
const char *name=
nullptr);
364 cTopology(
const cTopology& topo);
369 virtual ~cTopology();
374 cTopology& operator=(
const cTopology& topo);
390 virtual std::string str()
const override;
408 virtual void extractFromNetwork(
bool (*selfunc)(
cModule *,
void *),
void *userdata=
nullptr);
413 virtual void extractFromNetwork(Predicate *predicate);
418 virtual void extractFromNetwork(std::function<
bool(
cModule *)> predicate);
429 virtual void extractByModulePath(
const std::vector<std::string>& fullPathPatterns);
441 virtual void extractByNedTypeName(
const std::vector<std::string>& nedTypeNames);
461 virtual void extractByProperty(
const char *propertyName,
const char *value=
nullptr);
469 virtual void extractByParameter(
const char *paramName,
const char *paramValue=
nullptr);
474 virtual void clear();
484 virtual int addNode(Node *node);
490 virtual void deleteNode(Node *node);
497 virtual void addLink(Link *link, Node *srcNode, Node *destNode);
506 virtual void addLink(Link *link,
cGate *srcGate,
cGate *destGate);
512 virtual void deleteLink(Link *link);
532 virtual Node *getNode(
int i)
const;
541 virtual Node *getNodeFor(
cModule *mod)
const;
556 virtual void calculateUnweightedSingleShortestPathsTo(Node *target);
563 virtual void calculateWeightedSingleShortestPathsTo(Node *target);
This class represents modules in the simulation.
Definition: cmodule.h:48
virtual Link * createLink()
Definition: ctopology.h:581
int getNumOutLinks() const
Definition: ctopology.h:147
int getNumPaths() const
Definition: ctopology.h:167
Supporting class for cTopology.
Definition: ctopology.h:287
int getRemoteGateId() const
Definition: ctopology.h:306
Supporting class for cTopology.
Definition: ctopology.h:241
cGate * getRemoteGate() const
Definition: ctopology.h:316
bool isEnabled() const
Definition: ctopology.h:217
double getWeight() const
Definition: ctopology.h:104
int getNumInLinks() const
Definition: ctopology.h:137
cModule * getModule() const
Definition: ctopology.h:98
Supporting class for cTopology, represents a node in the graph.
Definition: ctopology.h:65
virtual int getNumNodes() const
Definition: ctopology.h:526
LinkOut * getPath(int) const
Definition: ctopology.h:174
void enable()
Definition: ctopology.h:223
virtual cTopology * dup() const override
Definition: ctopology.h:384
cModule * getModule(int id) const
Definition: csimulation.h:240
int getRemoteGateId() const
Definition: ctopology.h:260
cSimulation * getSimulation()
Returns the currently active simulation, or nullptr if there is none.
Definition: csimulation.h:608
Represents a module gate.
Definition: cgate.h:62
int getLocalGateId() const
Definition: ctopology.h:311
void setWeight(double d)
Definition: ctopology.h:211
void disable()
Definition: ctopology.h:128
Node(int moduleId=-1)
Definition: ctopology.h:84
Node * getRemoteNode() const
Definition: ctopology.h:296
void enable()
Definition: ctopology.h:122
virtual Node * createNode(cModule *module)
Definition: ctopology.h:576
int getId() const
Definition: ccomponent.h:433
cGate * getLocalGate() const
Definition: ctopology.h:321
void disable()
Definition: ctopology.h:229
virtual Node * getTargetNode() const
Definition: ctopology.h:569
Base class for selector objects used in extract...() methods of cTopology.
Definition: ctopology.h:330
double getDistanceToTarget() const
Definition: ctopology.h:161
double getWeight() const
Definition: ctopology.h:205
Link(double weight=1)
Definition: ctopology.h:198
Supporting class for cTopology, represents a link in the graph.
Definition: ctopology.h:182
Routing support. The cTopology class was designed primarily to support routing in telecommunication o...
Definition: ctopology.h:55
Node * getRemoteNode() const
Definition: ctopology.h:250
Node * getLocalNode() const
Definition: ctopology.h:255
int getLocalGateId() const
Definition: ctopology.h:265
cGate * getRemoteGate() const
Definition: ctopology.h:270
cGate * getLocalGate() const
Definition: ctopology.h:275
bool isEnabled() const
Definition: ctopology.h:116
int getModuleId() const
Definition: ctopology.h:93
Node * getLocalNode() const
Definition: ctopology.h:301
void setWeight(double d)
Definition: ctopology.h:110
A cObject that keeps track of its owner. It serves as base class for many classes in the OMNeT++ libr...
Definition: cownedobject.h:105