|
OMNeT++ API 6.1
Discrete Event Simulation Library
|
|
16 #ifndef __OMNETPP_CMODULE_H
17 #define __OMNETPP_CMODULE_H
20 #include "ccomponent.h"
23 #include "csimulation.h"
78 cGate *current()
const;
158 int initialModuleChangeCount;
185 bool end()
const {
return current ==
nullptr;}
209 bool changesDetected()
const;
257 bool end()
const {
return current ==
nullptr;}
276 FL_BUILDINSIDE_CALLED = 1 << 10,
277 FL_RECORD_EVENTS = 1 << 11,
278 FL_BUILTIN_ANIMATIONS = 1 << 12,
282 mutable const char *fullPath =
nullptr;
283 mutable opp_pooledstring fullName =
nullptr;
285 cModule *parentModule =
nullptr;
286 struct SubmoduleVector {
288 std::vector<cModule*> array;
290 struct SubcomponentData {
291 std::vector<cModule*> scalarSubmodules;
292 std::vector<SubmoduleVector> submoduleVectors;
293 std::vector<cChannel*> channels;
294 int submoduleChangeCount = 0;
296 SubcomponentData *subcomponentData =
nullptr;
298 typedef std::set<cGate::Name> GateNamePool;
299 static GateNamePool gateNamePool;
300 cGate::Desc *gateDescArray =
nullptr;
301 int gateDescArraySize = 0;
303 int vectorIndex = -1;
305 mutable cCanvas *canvas =
nullptr;
306 mutable cOsgCanvas *osgCanvas =
nullptr;
310 void setRecordEvents(
bool e) {setFlag(FL_RECORD_EVENTS,e);}
311 bool isRecordEvents()
const {
return flags&FL_RECORD_EVENTS;}
315 void releaseListeners();
318 bool buildInsideCalled()
const {
return flags&FL_BUILDINSIDE_CALLED;}
322 virtual bool initializeModules(
int stage);
326 virtual bool initializeChannels(
int stage);
330 virtual void setInitialNameAndIndex(
const char *name,
int index);
333 void updateFullName();
336 void invalidateFullPathRec();
339 void reassignModuleIdRec();
342 void insertSubmodule(cModule *mod);
345 void removeSubmodule(cModule *mod);
348 void insertChannel(cChannel *channel);
351 void removeChannel(cChannel *channel);
354 std::vector<cModule*>& getSubmoduleArray(
const char *name)
const;
361 void disposeGateDesc(cGate::Desc *desc,
bool checkConnected);
364 void disposeGateObject(cGate *gate,
bool checkConnected);
367 cGate::Desc *addGateDesc(
const char *name,
cGate::Type type,
bool isVector);
371 int findGateDesc(
const char *gatename,
char& suffix)
const;
374 cGate::Desc *gateDesc(
const char *gatename,
char& suffix)
const;
377 void adjustGateDesc(cGate *g, cGate::Desc *newvec);
383 virtual void doBuildInside();
386 virtual void doDeleteModule();
389 virtual cModule *doFindModuleByPath(
const char *s)
const override;
393 static void clearNamePools();
396 int gateCount()
const;
399 cGate *gateByOrdinal(
int k)
const;
402 virtual void callRefreshDisplay()
override;
405 virtual void callPreDelete(cComponent *root)
override;
408 cCanvas *getCanvasIfExists() {
return canvas;}
411 cOsgCanvas *getOsgCanvasIfExists() {
return osgCanvas;}
438 virtual void forEachChild(cVisitor *v)
override;
448 virtual void setName(
const char *s)
override;
455 virtual const char *getFullName()
const override;
462 virtual std::string getFullPath()
const override;
467 virtual std::string str()
const override;
478 virtual void setIndex(
int index);
486 virtual void setNameAndIndex(
const char *name,
int index=-1);
496 virtual cGate *addGate(
const char *gatename,
cGate::Type type);
503 virtual void addGateVector(
const char *gatename,
cGate::Type type,
int size);
511 virtual void setGateSize(
const char *gatename,
int size);
524 virtual cGate *getOrCreateFirstUnconnectedGate(
const char *gatename,
char suffix,
525 bool inside,
bool expand);
533 virtual void getOrCreateFirstUnconnectedGatePair(
const char *gatename,
534 bool inside,
bool expand,
535 cGate *&gatein, cGate *&gateout);
554 virtual void finalizeParameters()
override;
579 virtual bool isSimple()
const;
607 virtual cProperties *getProperties()
const override;
618 int getIndex()
const;
624 int getVectorSize()
const;
633 virtual bool hasSubmodules()
const;
639 virtual bool hasSubmoduleVector(
const char *name)
const;
645 virtual std::vector<std::string> getSubmoduleVectorNames()
const;
651 virtual int getSubmoduleVectorSize(
const char *name)
const;
666 virtual void addSubmoduleVector(
const char *name,
int size);
673 virtual void deleteSubmoduleVector(
const char *name);
683 virtual void setSubmoduleVectorSize(
const char *name,
int size);
706 virtual bool hasSubmodule(
const char *name,
int index=-1)
const;
713 virtual int findSubmodule(
const char *name,
int index=-1)
const;
720 virtual cModule *getSubmodule(
const char *name,
int index=-1)
const;
726 virtual std::vector<std::string> getSubmoduleNames()
const;
732 virtual bool containsModule(
cModule *module)
const;
742 virtual bool hasGates()
const;
750 virtual cGate *gate(
const char *gatename,
int index=-1);
758 const cGate *
gate(
const char *gatename,
int index=-1)
const {
759 return const_cast<cModule *
>(
this)->gate(gatename, index);
769 virtual cGate *gateHalf(
const char *gatename,
cGate::Type type,
int index=-1);
779 return const_cast<cModule *
>(
this)->gateHalf(gatename, type, index);
789 virtual bool hasGate(
const char *gatename,
int index=-1)
const;
798 virtual int findGate(
const char *gatename,
int index=-1)
const;
807 virtual cGate *gate(
int id);
823 virtual void deleteGate(
const char *gatename);
832 virtual std::vector<std::string> getGateNames()
const;
839 virtual cGate::Type gateType(
const char *gatename)
const;
846 virtual bool hasGateVector(
const char *gatename)
const;
853 virtual bool isGateVector(
const char *gatename)
const;
862 virtual int gateSize(
const char *gatename)
const;
873 virtual int gateBaseId(
const char *gatename)
const;
881 virtual bool checkInternalConnections()
const;
902 [[deprecated]]
virtual cPar& getAncestorPar(
const char *parname);
908 virtual cCanvas *getCanvas()
const;
938 virtual void callInitialize()
override;
944 virtual bool callInitialize(
int stage)
override;
949 virtual void callFinish()
override;
978 virtual void deleteModule();
1009 virtual void changeParentTo(
cModule *mod);
Walks along the channels inside a module, that is, the channels among the module and its submodules.
Definition: cmodule.h:227
GateIterator(const cModule *module)
Definition: cmodule.h:84
This class represents modules in the simulation.
Definition: cmodule.h:48
virtual bool getBuiltinAnimationsAllowed() const
Definition: cmodule.h:926
SubmoduleIterator & operator++()
Definition: cmodule.h:192
const cGate * gate(const char *gatename, int index=-1) const
Definition: cmodule.h:758
ChannelIterator operator++(int)
Definition: cmodule.h:271
cModuleType * getModuleType() const
Definition: cmodule.h:601
Simulation manager class.
Definition: csimulation.h:64
bool isVector() const
Definition: cmodule.h:612
bool end() const
Definition: cmodule.h:257
virtual bool isPlaceholder() const
Definition: cmodule.h:590
Type
Definition: cgate.h:72
Base class for channels.
Definition: cchannel.h:46
cChannel * operator*() const
Definition: cmodule.h:252
Provides a scene graph based 2D drawing API for modules.
Definition: ccanvas.h:3023
Abstract class for creating a module of a specific type.
Definition: ccomponenttype.h:206
ChannelIterator(const cModule *module)
Definition: cmodule.h:241
bool end() const
Definition: cmodule.h:185
GateIterator operator++(int)
Definition: cmodule.h:114
const cGate * gateHalf(const char *gatename, cGate::Type type, int index=-1) const
Definition: cmodule.h:778
int64_t-based, base-10 fixed-point simulation time.
Definition: simtime.h:66
cGate * operator*() const
Definition: cmodule.h:95
Iterates through the gates of a module.
Definition: cmodule.h:67
GateIterator & operator++()
Definition: cmodule.h:107
virtual ComponentKind getComponentKind() const override
Definition: cmodule.h:584
Options for the cSimpleModule::send() and cSimpleModule::sendDirect() calls.
Definition: csimplemodule.h:82
Represents a module gate.
Definition: cgate.h:62
A collection of properties (cProperty).
Definition: cproperties.h:34
Represents a module or channel parameter.
Definition: cpar.h:70
virtual void setBuiltinAnimationsAllowed(bool enabled)
Definition: cmodule.h:920
ChannelIterator & operator++()
Definition: cmodule.h:264
Iterates through the submodules of a compound module. Iteration order corresponds to declaration orde...
Definition: cmodule.h:148
Abstract base class for creating a channel of a given type.
Definition: ccomponenttype.h:326
The message class in OMNeT++. cMessage objects may represent events, messages, jobs or other entities...
Definition: cmessage.h:95
SubmoduleIterator(const cModule *module)
Definition: cmodule.h:169
SubmoduleIterator operator++(int)
Definition: cmodule.h:199
Common base for module and channel classes.
Definition: ccomponent.h:49
cModule * operator*() const
Definition: cmodule.h:180
const cGate * gate(int id) const
Definition: cmodule.h:816
Wraps an OpenSceneGraph scene, allowing 3D visualization in graphical user interfaces that support it...
Definition: cosgcanvas.h:42
virtual cModule * getParentModule() const override
Definition: cmodule.h:596