16 #ifndef __OMNETPP_CMODULE_H 17 #define __OMNETPP_CMODULE_H 20 #include "ccomponent.h" 23 #include "csimulation.h" 77 cGate *current()
const;
138 void advance() {p = p->nextSibling;}
139 void retreat() {p = p->prevSibling;}
166 bool end()
const {
return p==
nullptr;}
224 std::vector<cChannel *> channels;
236 void init(
const cModule *parentModule);
252 bool end()
const {
return k < 0 || k >= (int)channels.size();}
276 static std::string lastModuleFullPath;
277 static const cModule *lastModuleFullPathModule;
281 FL_BUILDINSIDE_CALLED = 1 << 10,
282 FL_RECORD_EVENTS = 1 << 11,
283 FL_BUILTIN_ANIMATIONS = 1 << 12,
287 mutable char *fullPath;
288 mutable char *fullName;
289 static bool cacheFullPath;
294 cModule *prevSibling, *nextSibling;
298 typedef std::set<cGate::Name> NamePool;
299 static NamePool namePool;
300 int gateDescArraySize;
301 cGate::Desc *gateDescArray;
305 #ifdef USE_OMNETPP4x_FINGERPRINTS 306 int version4ModuleId;
314 void setRecordEvents(
bool e) {setFlag(FL_RECORD_EVENTS,e);}
315 bool isRecordEvents()
const {
return flags&FL_RECORD_EVENTS;}
319 void releaseListeners();
322 bool buildInsideCalled()
const {
return flags&FL_BUILDINSIDE_CALLED;}
326 virtual bool initializeModules(
int stage);
330 virtual bool initializeChannels(
int stage);
334 virtual void setNameAndIndex(
const char *s,
int i,
int n);
337 void updateFullName();
340 void updateFullPathRec();
343 void reassignModuleIdRec();
346 void insertSubmodule(
cModule *mod);
349 void removeSubmodule(
cModule *mod);
356 void disposeGateDesc(cGate::Desc *desc,
bool checkConnected);
359 void disposeGateObject(
cGate *gate,
bool checkConnected);
362 cGate::Desc *addGateDesc(
const char *name,
cGate::Type type,
bool isVector);
366 int findGateDesc(
const char *gatename,
char& suffix)
const;
369 cGate::Desc *gateDesc(
const char *gatename,
char& suffix)
const;
372 void adjustGateDesc(
cGate *g, cGate::Desc *newvec);
378 virtual void doBuildInside();
381 virtual void doDeleteModule();
384 #ifdef USE_OMNETPP4x_FINGERPRINTS 386 int getVersion4ModuleId()
const {
return version4ModuleId; }
390 static void clearNamePools();
393 int gateCount()
const;
396 cGate *gateByOrdinal(
int k)
const;
399 virtual void callRefreshDisplay()
override;
402 cCanvas *getCanvasIfExists() {
return canvas;}
405 cOsgCanvas *getOsgCanvasIfExists() {
return osgCanvas;}
433 virtual void forEachChild(
cVisitor *v)
override;
438 virtual void setName(
const char *s)
override;
445 virtual const char *getFullName()
const override;
452 virtual std::string getFullPath()
const override;
457 virtual std::string str()
const override;
473 virtual cGate *addGate(
const char *gatename,
cGate::Type type,
bool isvector=
false);
481 virtual void setGateSize(
const char *gatename,
int size);
494 virtual cGate *getOrCreateFirstUnconnectedGate(
const char *gatename,
char suffix,
495 bool inside,
bool expand);
503 virtual void getOrCreateFirstUnconnectedGatePair(
const char *gatename,
504 bool inside,
bool expand,
524 virtual void finalizeParameters()
override;
549 virtual bool isSimple()
const;
566 virtual cModule *getParentModule()
const override;
577 virtual cProperties *getProperties()
const override;
598 _OPPDEPRECATED
int size()
const {
return getVectorSize();}
614 virtual int findSubmodule(
const char *name,
int index=-1)
const;
621 virtual cModule *getSubmodule(
const char *name,
int index=-1)
const;
647 virtual cModule *getModuleByPath(
const char *path)
const;
653 virtual bool containsModule(
cModule *module)
const;
665 virtual cGate *gate(
const char *gatename,
int index=-1);
673 const cGate *
gate(
const char *gatename,
int index=-1)
const {
674 return const_cast<cModule *
>(
this)->gate(gatename, index);
684 virtual cGate *gateHalf(
const char *gatename,
cGate::Type type,
int index=-1);
694 return const_cast<cModule *
>(
this)->gateHalf(gatename, type, index);
704 virtual bool hasGate(
const char *gatename,
int index=-1)
const;
713 virtual int findGate(
const char *gatename,
int index=-1)
const;
722 virtual cGate *gate(
int id);
738 virtual void deleteGate(
const char *gatename);
750 virtual std::vector<const char *> getGateNames()
const;
757 virtual cGate::Type gateType(
const char *gatename)
const;
764 virtual bool isGateVector(
const char *gatename)
const;
776 virtual int gateSize(
const char *gatename)
const;
787 virtual int gateBaseId(
const char *gatename)
const;
795 virtual bool checkInternalConnections()
const;
814 virtual cPar& getAncestorPar(
const char *parname);
820 virtual cCanvas *getCanvas()
const;
850 virtual void callInitialize()
override;
856 virtual bool callInitialize(
int stage)
override;
861 virtual void callFinish()
override;
890 virtual void deleteModule();
922 virtual void changeParentTo(
cModule *mod);
cModule * operator*() const
Definition: cmodule.h:156
bool end() const
Definition: cmodule.h:166
The message class in OMNeT++. cMessage objects may represent events, messages, jobs or other entities...
Definition: cmessage.h:95
Common base for module and channel classes.
Definition: ccomponent.h:48
ChannelIterator & operator++()
Definition: cmodule.h:262
Represents a module gate.
Definition: cgate.h:63
int64_t-based, base-10 fixed-point simulation time.
Definition: simtime.h:66
SubmoduleIterator(const cModule *m)
Definition: cmodule.h:145
SubmoduleIterator & operator--()
Definition: cmodule.h:187
SubmoduleIterator operator--(int)
Definition: cmodule.h:194
Simulation manager class.
Definition: csimulation.h:62
bool isVector() const
Definition: cmodule.h:582
Represents a module or channel parameter.
Definition: cpar.h:68
Wraps an OpenSceneGraph scene, allowing 3D visualization in graphical user interfaces that support it...
Definition: cosgcanvas.h:42
Iterates through the submodules of a compound module.
Definition: cmodule.h:132
GateIterator & operator++()
Definition: cmodule.h:111
virtual bool hasSubmodules() const
Definition: cmodule.h:607
int getVectorSize() const
Definition: cmodule.h:593
int getIndex() const
Definition: cmodule.h:587
const cGate * gateHalf(const char *gatename, cGate::Type type, int index=-1) const
Definition: cmodule.h:693
GateIterator(const cModule *m)
Definition: cmodule.h:83
const cGate * gate(const char *gatename, int index=-1) const
Definition: cmodule.h:673
cModuleType * getModuleType() const
Definition: cmodule.h:571
cChannel * operator*() const
Definition: cmodule.h:242
ChannelIterator & operator--()
Definition: cmodule.h:272
bool end() const
Definition: cmodule.h:252
This class represents modules in the simulation.
Definition: cmodule.h:47
Provides a scene graph based 2D drawing API for modules.
Definition: ccanvas.h:2969
GateIterator operator++(int)
Definition: cmodule.h:118
const cGate * gate(int id) const
Definition: cmodule.h:731
virtual bool getBuiltinAnimationsAllowed() const
Definition: cmodule.h:838
void init(const cModule *m)
Definition: cmodule.h:150
_OPPDEPRECATED cGate * operator()() const
Definition: cmodule.h:99
cGate * operator*() const
Definition: cmodule.h:94
_OPPDEPRECATED cChannel * operator()() const
Definition: cmodule.h:247
_OPPDEPRECATED int size() const
Definition: cmodule.h:598
Enables traversing the tree of (cObject-rooted) simulation objects.
Definition: cvisitor.h:56
Definition: cabstracthistogram.h:21
A collection of properties (cProperty).
Definition: cproperties.h:34
Iterates through the gates of a module.
Definition: cmodule.h:66
virtual ComponentKind getComponentKind() const override
Definition: cmodule.h:554
_OPPDEPRECATED cModule * operator()() const
Definition: cmodule.h:161
virtual bool isPlaceholder() const
Definition: cmodule.h:560
Walks along the channels inside a module, that is, the channels among the module and its submodules...
Definition: cmodule.h:221
SubmoduleIterator operator++(int)
Definition: cmodule.h:180
Abstract base class for creating a channel of a given type.
Definition: ccomponenttype.h:312
Abstract class for creating a module of a specific type.
Definition: ccomponenttype.h:192
SubmoduleIterator & operator++()
Definition: cmodule.h:173
virtual void setBuiltinAnimationsAllowed(bool enabled)
Definition: cmodule.h:832
Base class for channels.
Definition: cchannel.h:34
Type
Definition: cgate.h:73