16#ifndef __OMNETPP_CTOPOLOGY_H
17#define __OMNETPP_CTOPOLOGY_H
22#include "cownedobject.h"
23#include "csimulation.h"
33#define INFINITY HUGE_VAL
67 friend class cTopology;
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;}
184 friend class cTopology;
198 Link(
double weight=1) {srcNode=destNode=
nullptr; srcGateId=destGateId=-1; this->weight=weight; enabled=
true;}
241 class SIM_API LinkIn :
public Link
244 LinkIn(
double weight=1) :
Link(weight) {}
287 class SIM_API LinkOut :
public Link
290 LinkOut(
double weight=1) :
Link(weight) {}
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);}
390 virtual std::string
str()
const override;
int getId() const
Definition ccomponent.h:435
Represents a module gate.
Definition cgate.h:63
This class represents modules in the simulation.
Definition cmodule.h:49
Represents a module or channel parameter.
Definition cpar.h:71
Supporting class for cTopology.
Definition ctopology.h:242
cGate * getLocalGate() const
Definition ctopology.h:275
int getRemoteGateId() const
Definition ctopology.h:260
int getLocalGateId() const
Definition ctopology.h:265
Node * getLocalNode() const
Definition ctopology.h:255
Node * getRemoteNode() const
Definition ctopology.h:250
cGate * getRemoteGate() const
Definition ctopology.h:270
Supporting class for cTopology.
Definition ctopology.h:288
cGate * getLocalGate() const
Definition ctopology.h:321
int getRemoteGateId() const
Definition ctopology.h:306
int getLocalGateId() const
Definition ctopology.h:311
Node * getLocalNode() const
Definition ctopology.h:301
Node * getRemoteNode() const
Definition ctopology.h:296
cGate * getRemoteGate() const
Definition ctopology.h:316
Supporting class for cTopology, represents a link in the graph.
Definition ctopology.h:183
double getWeight() const
Definition ctopology.h:205
void setWeight(double d)
Definition ctopology.h:211
void enable()
Definition ctopology.h:223
void disable()
Definition ctopology.h:229
bool isEnabled() const
Definition ctopology.h:217
Link(double weight=1)
Definition ctopology.h:198
Supporting class for cTopology, represents a node in the graph.
Definition ctopology.h:66
double getWeight() const
Definition ctopology.h:104
void setWeight(double d)
Definition ctopology.h:110
Node(int moduleId=-1)
Definition ctopology.h:84
void enable()
Definition ctopology.h:122
cModule * getModule() const
Definition ctopology.h:98
double getDistanceToTarget() const
Definition ctopology.h:161
int getNumOutLinks() const
Definition ctopology.h:147
LinkOut * getLinkOut(int i)
void disable()
Definition ctopology.h:128
LinkIn * getLinkIn(int i)
bool isEnabled() const
Definition ctopology.h:116
int getNumPaths() const
Definition ctopology.h:167
LinkOut * getPath(int) const
Definition ctopology.h:174
int getModuleId() const
Definition ctopology.h:93
int getNumInLinks() const
Definition ctopology.h:137
Base class for selector objects used in extract...() methods of cTopology.
Definition ctopology.h:331
virtual void deleteNode(Node *node)
virtual Node * getTargetNode() const
Definition ctopology.h:569
virtual void addLink(Link *link, Node *srcNode, Node *destNode)
virtual void extractFromNetwork(bool(*selfunc)(cModule *, void *), void *userdata=nullptr)
virtual int getNumNodes() const
Definition ctopology.h:526
virtual cTopology * dup() const override
Definition ctopology.h:384
virtual void extractByParameter(const char *paramName, const char *paramValue=nullptr)
virtual void extractByProperty(const char *propertyName, const char *value=nullptr)
virtual void extractFromNetwork(std::function< bool(cModule *)> predicate)
cTopology(const cTopology &topo)
virtual Node * getNode(int i) const
virtual Node * createNode(cModule *module)
Definition ctopology.h:576
virtual void calculateWeightedSingleShortestPathsTo(Node *target)
cTopology & operator=(const cTopology &topo)
virtual Link * createLink()
Definition ctopology.h:581
virtual void calculateUnweightedSingleShortestPathsTo(Node *target)
virtual void extractByNedTypeName(const std::vector< std::string > &nedTypeNames)
virtual void extractFromNetwork(Predicate *predicate)
virtual int addNode(Node *node)
virtual void extractByModulePath(const std::vector< std::string > &fullPathPatterns)
virtual std::string str() const override
cTopology(const char *name=nullptr)
virtual Node * getNodeFor(cModule *mod) const
virtual void deleteLink(Link *link)
virtual void addLink(Link *link, cGate *srcGate, cGate *destGate)
cSimulation * getSimulation()
Returns the currently active simulation, or nullptr if there is none.
Definition csimulation.h:623