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 106 void *contextPointer;
118 static long nextMessageId;
121 static long totalMsgCount;
122 static long liveMsgCount;
126 void _createparlist();
131 void setId(
long id) {messageId = id;}
143 void setSrcProcId(
int procId) {srcProcId = (short)procId;}
146 virtual int getSrcProcId()
const override {
return srcProcId;}
149 cArray *getParListPtr() {
return parList;}
154 virtual bool isMessage()
const override {
return true;}
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);
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;
583 long getId()
const {
return messageId;}
599 virtual const char *getDisplayString()
const;
607 void setArrival(
int moduleId,
int gateId) {targetModuleId = moduleId; targetGateId = gateId;}
int getSenderGateId() const
Definition: cmessage.h:513
The message class in OMNeT++. cMessage objects may represent events, messages, jobs or other entities...
Definition: cmessage.h:95
Represents a module gate.
Definition: cgate.h:63
Root of the OMNeT++ class hierarchy. cObject is a lightweight class without any data members...
Definition: cobject.h:58
int64_t-based, base-10 fixed-point simulation time.
Definition: simtime.h:66
static long getTotalMessageCount()
Definition: cmessage.h:626
cModule * getModule(int id) const
Definition: csimulation.h:215
int getArrivalGateId() const
Definition: cmessage.h:530
void setArrival(int moduleId, int gateId)
Definition: cmessage.h:607
virtual cMsgPar & addPar(const char *name)
Definition: cmessage.h:339
virtual cObject * removeObject(cObject *par)
Definition: cmessage.h:459
Represents an event in the discrete event simulator.
Definition: cevent.h:43
static void resetMessageCounters()
Definition: cmessage.h:640
cObject * getControlInfo() const
Definition: cmessage.h:308
int getArrivalModuleId() const
Definition: cmessage.h:521
Vector-like container for objects derived from cObject.
Definition: carray.h:38
virtual cObject * getObject(const char *name)
Definition: cmessage.h:424
virtual bool hasPar(const char *name) const
Definition: cmessage.h:401
long getTreeId() const
Definition: cmessage.h:589
long getId() const
Definition: cmessage.h:583
Allows a value (string, bool, double, etc) to be attached to a cMessage object.
Definition: cmsgpar.h:52
simtime_t_cref getSendingTime() const
Definition: cmessage.h:543
This class represents modules in the simulation.
Definition: cmodule.h:47
simtime_t_cref getTimestamp() const
Definition: cmessage.h:298
short getKind() const
Definition: cmessage.h:293
void setTimestamp()
Definition: cmessage.h:249
Buffer for the communications layer of parallel simulation.
Definition: ccommbuffer.h:41
virtual cMessage * dup() const override
Definition: cmessage.h:208
simtime_t_cref getSimTime() const
Definition: csimulation.h:377
simtime_t_cref getCreationTime() const
Definition: cmessage.h:537
virtual cObject * removeObject(const char *name)
Definition: cmessage.h:447
virtual cObject * addObject(cObject *par)
Definition: cmessage.h:412
void setTimestamp(simtime_t t)
Definition: cmessage.h:254
static long getLiveMessageCount()
Definition: cmessage.h:635
virtual bool isPacket() const
Definition: cmessage.h:197
void setContextPointer(void *p)
Definition: cmessage.h:264
Enables traversing the tree of (cObject-rooted) simulation objects.
Definition: cvisitor.h:56
virtual bool hasObject(const char *name)
Definition: cmessage.h:435
virtual int find(cObject *obj) const
virtual cArray & getParList()
Definition: cmessage.h:327
Definition: cabstracthistogram.h:21
cModule * getArrivalModule() const
Definition: cmessage.h:489
void setKind(short k)
Definition: cmessage.h:244
cModule * getSenderModule() const
Definition: cmessage.h:475
void setArrival(int moduleId, int gateId, simtime_t_cref t)
Definition: cmessage.h:613
int getSenderModuleId() const
Definition: cmessage.h:504
virtual cMsgPar & addPar(cMsgPar *par)
Definition: cmessage.h:350
bool arrivedOn(int gateId) const
Definition: cmessage.h:565
cSimulation * getSimulation()
Returns the currently active simulation, or nullptr if there is none.
Definition: csimulation.h:575
bool isSelfMessage() const
Definition: cmessage.h:468
simtime_t_cref getArrivalTime() const
Definition: cmessage.h:560
void * getContextPointer() const
Definition: cmessage.h:303