|
OMNeT++ API 6.1
Discrete Event Simulation Library
|
|
16 #ifndef __OMNETPP_CMESSAGE_H
17 #define __OMNETPP_CMESSAGE_H
23 #include "csimulation.h"
46 MK_PARSIM_BEGIN = -1000
56 #define MAX_PARSIM_PARTITIONS 32768 // srcprocid in cMessage
103 short srcProcId = -1;
104 cArray *parList =
nullptr;
105 cObject *controlInfo =
nullptr;
106 void *contextPointer =
nullptr;
108 int senderModuleId = -1;
109 int senderGateId = -1;
110 int targetModuleId = -1;
111 int targetGateId = -1;
121 static uint64_t totalMsgCount;
122 static uint64_t liveMsgCount;
126 void _createparlist();
131 void setId(
msgid_t id) {messageId = id;}
143 void setSrcProcId(
int procId) {srcProcId = (short)procId;}
146 virtual int getSrcProcId()
const override {
return srcProcId;}
149 cArray *getParListPtr() {
return parList;}
157 virtual bool isStale()
override;
160 virtual cObject *getTargetObject()
const override;
163 virtual void execute()
override;
177 explicit cMessage(
const char *name=
nullptr,
short kind=0);
197 virtual bool isPacket()
const override {
return false;}
214 virtual std::string str()
const override;
220 virtual void forEachChild(
cVisitor *v)
override;
227 virtual void parsimPack(
cCommBuffer *buffer)
const override;
234 virtual void parsimUnpack(
cCommBuffer *buffer)
override;
281 virtual void setControlInfo(
cObject *p);
363 virtual cMsgPar& par(
int index);
377 virtual cMsgPar& par(
const char *name);
389 virtual int findPar(
const char *name)
const;
401 virtual bool hasPar(
const char *name)
const {
return findPar(name)>=0;}
435 virtual bool hasObject(
const char *name) {
return !parList ? false : parList->
find(name)>=0;}
482 cGate *getSenderGate()
const;
496 cGate *getArrivalGate()
const;
565 bool arrivedOn(
int gateId)
const {
return gateId==targetGateId;}
572 bool arrivedOn(
const char *gateName)
const;
578 bool arrivedOn(
const char *gateName,
int gateIndex)
const;
599 virtual const char *getDisplayString()
const;
607 void setArrival(
int moduleId,
int gateId) {targetModuleId = moduleId; targetGateId = gateId;}
virtual bool hasPar(const char *name) const
Definition: cmessage.h:401
virtual cMsgPar & addPar(cMsgPar *par)
Definition: cmessage.h:350
const typedef simtime_t & simtime_t_cref
Constant reference to a simtime_t.
Definition: simtime_t.h:48
This class represents modules in the simulation.
Definition: cmodule.h:48
simtime_t_cref getSimTime() const
Definition: csimulation.h:405
int64_t msgid_t
Message ID. See cMessage::getId().
Definition: simkerneldefs.h:85
bool arrivedOn(int gateId) const
Definition: cmessage.h:565
cObject is a lightweight class which serves as the root of the OMNeT++ class hierarchy....
Definition: cobject.h:92
int getSenderGateId() const
Definition: cmessage.h:513
virtual bool hasObject(const char *name)
Definition: cmessage.h:435
simtime_t_cref getSendingTime() const
Definition: cmessage.h:543
static uint64_t getTotalMessageCount()
Definition: cmessage.h:624
virtual cObject * getObject(const char *name)
Definition: cmessage.h:424
virtual bool isMessage() const override
Definition: cmessage.h:154
Represents an event in the discrete event simulator.
Definition: cevent.h:46
virtual cObject * removeObject(cObject *par)
Definition: cmessage.h:459
void * getContextPointer() const
Definition: cmessage.h:303
Enables traversing the tree of (cObject-rooted) simulation objects.
Definition: cvisitor.h:56
void setArrival(int moduleId, int gateId)
Definition: cmessage.h:607
void setArrival(int moduleId, int gateId, simtime_t_cref t)
Definition: cmessage.h:613
msgid_t getTreeId() const
Definition: cmessage.h:589
int getSenderModuleId() const
Definition: cmessage.h:504
int64_t-based, base-10 fixed-point simulation time.
Definition: simtime.h:66
void setContextPointer(void *p)
Definition: cmessage.h:264
simtime_t_cref getCreationTime() const
Definition: cmessage.h:537
virtual cObject * removeObject(const char *name)
Definition: cmessage.h:447
static uint64_t getLiveMessageCount()
Definition: cmessage.h:633
cModule * getModule(int id) const
Definition: csimulation.h:240
cObject * getControlInfo() const
Definition: cmessage.h:308
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
static void resetMessageCounters()
Definition: cmessage.h:638
bool isSelfMessage() const
Definition: cmessage.h:468
virtual bool isPacket() const override
Definition: cmessage.h:197
virtual cMsgPar & addPar(const char *name)
Definition: cmessage.h:339
Vector-like container for objects derived from cObject.
Definition: carray.h:38
msgid_t getId() const
Definition: cmessage.h:583
The message class in OMNeT++. cMessage objects may represent events, messages, jobs or other entities...
Definition: cmessage.h:95
virtual cObject * addObject(cObject *par)
Definition: cmessage.h:412
virtual cMessage * dup() const override
Definition: cmessage.h:208
virtual int find(cObject *obj) const
int getArrivalGateId() const
Definition: cmessage.h:530
cModule * getArrivalModule() const
Definition: cmessage.h:489
void setTimestamp()
Definition: cmessage.h:249
int getArrivalModuleId() const
Definition: cmessage.h:521
virtual cArray & getParList()
Definition: cmessage.h:327
void setTimestamp(simtime_t t)
Definition: cmessage.h:254
short getKind() const
Definition: cmessage.h:293
cModule * getSenderModule() const
Definition: cmessage.h:475
Buffer for the communications layer of parallel simulation.
Definition: ccommbuffer.h:41
simtime_t_cref getTimestamp() const
Definition: cmessage.h:298
Allows a value (string, bool, double, etc) to be attached to a cMessage object.
Definition: cmsgpar.h:52
simtime_t_cref getArrivalTime() const
Definition: cmessage.h:560
void setKind(short k)
Definition: cmessage.h:244