Protected Member Functions | Private Attributes | List of all members
Txc15 Class Reference
Inheritance diagram for Txc15:
omnetpp::cSimpleModule omnetpp::cModule omnetpp::cComponent omnetpp::cDefaultList omnetpp::cNoncopyableOwnedObject omnetpp::cOwnedObject omnetpp::noncopyable omnetpp::cNamedObject omnetpp::cObject

Protected Member Functions

virtual TicTocMsg15 * generateMessage ()
 
virtual void forwardMessage (TicTocMsg15 *msg)
 
virtual void initialize () override
 
virtual void handleMessage (cMessage *msg) override
 
virtual void finish () override
 
- Protected Member Functions inherited from omnetpp::cSimpleModule
virtual void activity ()
 
virtual void activity ()
 
- Protected Member Functions inherited from omnetpp::cComponent
virtual void initialize (int stage)
 
virtual int numInitStages () const
 
virtual void handleParameterChange (const char *parname)
 
virtual void refreshDisplay () const
 
virtual void initialize (int stage)
 
virtual int numInitStages () const
 
virtual void handleParameterChange (const char *parname)
 
virtual void refreshDisplay () const
 
- Protected Member Functions inherited from omnetpp::cDefaultList
virtual void take (cOwnedObject *obj) override
 
virtual void drop (cOwnedObject *obj) override
 
virtual void take (cOwnedObject *obj) override
 
virtual void drop (cOwnedObject *obj) override
 
- Protected Member Functions inherited from omnetpp::cObject
void dropAndDelete (cOwnedObject *obj)
 
void dropAndDelete (cOwnedObject *obj)
 

Private Attributes

long numSent
 
long numReceived
 
cLongHistogram hopCountStats
 
cOutVector hopCountVector
 

Additional Inherited Members

- Public Member Functions inherited from omnetpp::cSimpleModule
 cSimpleModule (unsigned stacksize=0)
 
 cSimpleModule (const char *dummy1, cModule *dummy2, unsigned stacksize)
 
virtual ~cSimpleModule ()
 
virtual std::string info () const override
 
virtual void forEachChild (cVisitor *v) override
 
virtual void scheduleStart (simtime_t t) override
 
virtual void deleteModule () override
 
bool usesActivity () const
 
bool isTerminated () const
 
virtual bool snapshot (cObject *obj=nullptr, const char *label=nullptr)
 
virtual int send (cMessage *msg, int gateid)
 
virtual int send (cMessage *msg, const char *gatename, int gateindex=-1)
 
virtual int send (cMessage *msg, cGate *outputgate)
 
virtual int sendDelayed (cMessage *msg, simtime_t delay, int gateid)
 
virtual int sendDelayed (cMessage *msg, simtime_t delay, const char *gatename, int gateindex=-1)
 
virtual int sendDelayed (cMessage *msg, simtime_t delay, cGate *outputgate)
 
virtual int sendDirect (cMessage *msg, cModule *mod, const char *inputGateName, int gateIndex=-1)
 
virtual int sendDirect (cMessage *msg, cModule *mod, int inputGateId)
 
virtual int sendDirect (cMessage *msg, cGate *inputGate)
 
virtual int sendDirect (cMessage *msg, simtime_t propagationDelay, simtime_t duration, cModule *mod, const char *inputGateName, int gateIndex=-1)
 
virtual int sendDirect (cMessage *msg, simtime_t propagationDelay, simtime_t duration, cModule *mod, int inputGateId)
 
virtual int sendDirect (cMessage *msg, simtime_t propagationDelay, simtime_t duration, cGate *inputGate)
 
virtual void scheduleAt (simtime_t t, cMessage *msg)
 
virtual cMessagecancelEvent (cMessage *msg)
 
virtual void cancelAndDelete (cMessage *msg)
 
virtual cMessagereceive ()
 
virtual cMessagereceive (simtime_t timeout)
 
virtual void wait (simtime_t time)
 
virtual void waitAndEnqueue (simtime_t time, cQueue *queue)
 
virtual void endSimulation ()
 
virtual void halt ()
 
virtual void error (const char *format,...) const
 
virtual bool hasStackOverflow () const
 
virtual unsigned getStackSize () const
 
virtual unsigned getStackUsage () const
 
 cSimpleModule (unsigned stacksize=0)
 
 cSimpleModule (const char *dummy1, cModule *dummy2, unsigned stacksize)
 
virtual ~cSimpleModule ()
 
virtual std::string info () const override
 
virtual void forEachChild (cVisitor *v) override
 
virtual void scheduleStart (simtime_t t) override
 
virtual void deleteModule () override
 
bool usesActivity () const
 
bool isTerminated () const
 
virtual bool snapshot (cObject *obj=nullptr, const char *label=nullptr)
 
virtual int send (cMessage *msg, int gateid)
 
virtual int send (cMessage *msg, const char *gatename, int gateindex=-1)
 
virtual int send (cMessage *msg, cGate *outputgate)
 
virtual int sendDelayed (cMessage *msg, simtime_t delay, int gateid)
 
virtual int sendDelayed (cMessage *msg, simtime_t delay, const char *gatename, int gateindex=-1)
 
virtual int sendDelayed (cMessage *msg, simtime_t delay, cGate *outputgate)
 
virtual int sendDirect (cMessage *msg, cModule *mod, const char *inputGateName, int gateIndex=-1)
 
virtual int sendDirect (cMessage *msg, cModule *mod, int inputGateId)
 
virtual int sendDirect (cMessage *msg, cGate *inputGate)
 
virtual int sendDirect (cMessage *msg, simtime_t propagationDelay, simtime_t duration, cModule *mod, const char *inputGateName, int gateIndex=-1)
 
virtual int sendDirect (cMessage *msg, simtime_t propagationDelay, simtime_t duration, cModule *mod, int inputGateId)
 
virtual int sendDirect (cMessage *msg, simtime_t propagationDelay, simtime_t duration, cGate *inputGate)
 
virtual void scheduleAt (simtime_t t, cMessage *msg)
 
virtual cMessagecancelEvent (cMessage *msg)
 
virtual void cancelAndDelete (cMessage *msg)
 
virtual cMessagereceive ()
 
virtual cMessagereceive (simtime_t timeout)
 
virtual void wait (simtime_t time)
 
virtual void waitAndEnqueue (simtime_t time, cQueue *queue)
 
virtual void endSimulation ()
 
virtual void halt ()
 
virtual void error (const char *format,...) const
 
virtual bool hasStackOverflow () const
 
virtual unsigned getStackSize () const
 
virtual unsigned getStackUsage () const
 
- Public Member Functions inherited from omnetpp::cModule
 cModule ()
 
virtual ~cModule ()
 
virtual void setName (const char *s) override
 
virtual const char * getFullName () const override
 
virtual std::string getFullPath () const override
 
virtual cGateaddGate (const char *gatename, cGate::Type type, bool isvector=false)
 
virtual void setGateSize (const char *gatename, int size)
 
virtual cGategetOrCreateFirstUnconnectedGate (const char *gatename, char suffix, bool inside, bool expand)
 
virtual void getOrCreateFirstUnconnectedGatePair (const char *gatename, bool inside, bool expand, cGate *&gatein, cGate *&gateout)
 
virtual void finalizeParameters () override
 
virtual int buildInside ()
 
virtual bool isSimple () const
 
virtual ComponentKind getComponentKind () const override
 
virtual bool isPlaceholder () const
 
virtual cModulegetParentModule () const override
 
cModuleTypegetModuleType () const
 
virtual cPropertiesgetProperties () const override
 
bool isVector () const
 
int getIndex () const
 
int getVectorSize () const
 
_OPPDEPRECATED int size () const
 
virtual bool hasSubmodules () const
 
virtual int findSubmodule (const char *name, int index=-1) const
 
virtual cModulegetSubmodule (const char *name, int index=-1) const
 
virtual cModulegetModuleByPath (const char *path) const
 
virtual cGategate (const char *gatename, int index=-1)
 
const cGategate (const char *gatename, int index=-1) const
 
virtual cGategateHalf (const char *gatename, cGate::Type type, int index=-1)
 
const cGategateHalf (const char *gatename, cGate::Type type, int index=-1) const
 
virtual bool hasGate (const char *gatename, int index=-1) const
 
virtual int findGate (const char *gatename, int index=-1) const
 
virtual cGategate (int id)
 
const cGategate (int id) const
 
virtual void deleteGate (const char *gatename)
 
virtual std::vector< const char * > getGateNames () const
 
virtual cGate::Type gateType (const char *gatename) const
 
virtual bool isGateVector (const char *gatename) const
 
virtual int gateSize (const char *gatename) const
 
virtual int gateBaseId (const char *gatename) const
 
virtual bool checkInternalConnections () const
 
virtual cPargetAncestorPar (const char *parname)
 
virtual cCanvasgetCanvas () const
 
virtual cOsgCanvasgetOsgCanvas () const
 
virtual void callInitialize () override
 
virtual bool callInitialize (int stage) override
 
virtual void callFinish () override
 
virtual void changeParentTo (cModule *mod)
 
 cModule ()
 
virtual ~cModule ()
 
virtual void setName (const char *s) override
 
virtual const char * getFullName () const override
 
virtual std::string getFullPath () const override
 
virtual cGateaddGate (const char *gatename, cGate::Type type, bool isvector=false)
 
virtual void setGateSize (const char *gatename, int size)
 
virtual cGategetOrCreateFirstUnconnectedGate (const char *gatename, char suffix, bool inside, bool expand)
 
virtual void getOrCreateFirstUnconnectedGatePair (const char *gatename, bool inside, bool expand, cGate *&gatein, cGate *&gateout)
 
virtual void finalizeParameters () override
 
virtual int buildInside ()
 
virtual bool isSimple () const
 
virtual ComponentKind getComponentKind () const override
 
virtual bool isPlaceholder () const
 
virtual cModulegetParentModule () const override
 
cModuleTypegetModuleType () const
 
virtual cPropertiesgetProperties () const override
 
bool isVector () const
 
int getIndex () const
 
int getVectorSize () const
 
_OPPDEPRECATED int size () const
 
virtual bool hasSubmodules () const
 
virtual int findSubmodule (const char *name, int index=-1) const
 
virtual cModulegetSubmodule (const char *name, int index=-1) const
 
virtual cModulegetModuleByPath (const char *path) const
 
virtual cGategate (const char *gatename, int index=-1)
 
const cGategate (const char *gatename, int index=-1) const
 
virtual cGategateHalf (const char *gatename, cGate::Type type, int index=-1)
 
const cGategateHalf (const char *gatename, cGate::Type type, int index=-1) const
 
virtual bool hasGate (const char *gatename, int index=-1) const
 
virtual int findGate (const char *gatename, int index=-1) const
 
virtual cGategate (int id)
 
const cGategate (int id) const
 
virtual void deleteGate (const char *gatename)
 
virtual std::vector< const char * > getGateNames () const
 
virtual cGate::Type gateType (const char *gatename) const
 
virtual bool isGateVector (const char *gatename) const
 
virtual int gateSize (const char *gatename) const
 
virtual int gateBaseId (const char *gatename) const
 
virtual bool checkInternalConnections () const
 
virtual cPargetAncestorPar (const char *parname)
 
virtual cCanvasgetCanvas () const
 
virtual cOsgCanvasgetOsgCanvas () const
 
virtual void callInitialize () override
 
virtual bool callInitialize (int stage) override
 
virtual void callFinish () override
 
virtual void changeParentTo (cModule *mod)
 
- Public Member Functions inherited from omnetpp::cComponent
 cComponent (const char *name=nullptr)
 
virtual ~cComponent ()
 
const cComponentgetThisPtr () const
 
virtual cComponentTypegetComponentType () const
 
cSimulationgetSimulation () const
 
int getId () const
 
virtual const char * getNedTypeName () const
 
bool isModule () const
 
bool isChannel () const
 
virtual cModulegetSystemModule () const
 
virtual int getNumParams () const
 
virtual cParpar (int k)
 
const cParpar (int k) const
 
virtual cParpar (const char *parname)
 
const cParpar (const char *parname) const
 
virtual int findPar (const char *parname) const
 
bool hasPar (const char *s) const
 
virtual cRNGgetRNG (int k) const
 
virtual unsigned long intrand (long r, int rng=0) const
 
virtual double dblrand (int rng=0) const
 
virtual double uniform (double a, double b, int rng=0) const
 
virtual SimTime uniform (SimTime a, SimTime b, int rng=0) const
 
virtual double exponential (double mean, int rng=0) const
 
virtual SimTime exponential (SimTime mean, int rng=0) const
 
virtual double normal (double mean, double stddev, int rng=0) const
 
virtual SimTime normal (SimTime mean, SimTime stddev, int rng=0) const
 
virtual double truncnormal (double mean, double stddev, int rng=0) const
 
virtual SimTime truncnormal (SimTime mean, SimTime stddev, int rng=0) const
 
virtual double gamma_d (double alpha, double theta, int rng=0) const
 
virtual double beta (double alpha1, double alpha2, int rng=0) const
 
virtual double erlang_k (unsigned int k, double mean, int rng=0) const
 
virtual double chi_square (unsigned int k, int rng=0) const
 
virtual double student_t (unsigned int i, int rng=0) const
 
virtual double cauchy (double a, double b, int rng=0) const
 
virtual double triang (double a, double b, double c, int rng=0) const
 
virtual double lognormal (double m, double w, int rng=0) const
 
virtual double weibull (double a, double b, int rng=0) const
 
virtual double pareto_shifted (double a, double b, double c, int rng=0) const
 
virtual int intuniform (int a, int b, int rng=0) const
 
virtual int bernoulli (double p, int rng=0) const
 
virtual int binomial (int n, double p, int rng=0) const
 
virtual int geometric (double p, int rng=0) const
 
virtual int negbinomial (int n, double p, int rng=0) const
 
virtual int poisson (double lambda, int rng=0) const
 
virtual void subscribe (simsignal_t signalID, cIListener *listener)
 
virtual void subscribe (const char *signalName, cIListener *listener)
 
virtual void unsubscribe (simsignal_t signalID, cIListener *listener)
 
virtual void unsubscribe (const char *signalName, cIListener *listener)
 
virtual bool isSubscribed (simsignal_t signalID, cIListener *listener) const
 
virtual bool isSubscribed (const char *signalName, cIListener *listener) const
 
virtual std::vector< simsignal_tgetLocalListenedSignals () const
 
virtual std::vector< cIListener * > getLocalSignalListeners (simsignal_t signalID) const
 
virtual bool hasGUI () const
 
virtual cDisplayStringgetDisplayString () const
 
virtual void setDisplayString (const char *dispstr)
 
virtual void bubble (const char *text) const
 
virtual std::string resolveResourcePath (const char *fileName) const
 
virtual void recordScalar (const char *name, double value, const char *unit=nullptr)
 
virtual void recordScalar (const char *name, SimTime value, const char *unit=nullptr)
 
virtual void recordStatistic (cStatistic *stats, const char *unit=nullptr)
 
virtual void recordStatistic (const char *name, cStatistic *stats, const char *unit=nullptr)
 
 cComponent (const char *name=nullptr)
 
virtual ~cComponent ()
 
const cComponentgetThisPtr () const
 
virtual cComponentTypegetComponentType () const
 
cSimulationgetSimulation () const
 
int getId () const
 
virtual const char * getNedTypeName () const
 
bool isModule () const
 
bool isChannel () const
 
virtual cModulegetSystemModule () const
 
virtual int getNumParams () const
 
virtual cParpar (int k)
 
const cParpar (int k) const
 
virtual cParpar (const char *parname)
 
const cParpar (const char *parname) const
 
virtual int findPar (const char *parname) const
 
bool hasPar (const char *s) const
 
virtual cRNGgetRNG (int k) const
 
virtual unsigned long intrand (long r, int rng=0) const
 
virtual double dblrand (int rng=0) const
 
virtual double uniform (double a, double b, int rng=0) const
 
virtual SimTime uniform (SimTime a, SimTime b, int rng=0) const
 
virtual double exponential (double mean, int rng=0) const
 
virtual SimTime exponential (SimTime mean, int rng=0) const
 
virtual double normal (double mean, double stddev, int rng=0) const
 
virtual SimTime normal (SimTime mean, SimTime stddev, int rng=0) const
 
virtual double truncnormal (double mean, double stddev, int rng=0) const
 
virtual SimTime truncnormal (SimTime mean, SimTime stddev, int rng=0) const
 
virtual double gamma_d (double alpha, double theta, int rng=0) const
 
virtual double beta (double alpha1, double alpha2, int rng=0) const
 
virtual double erlang_k (unsigned int k, double mean, int rng=0) const
 
virtual double chi_square (unsigned int k, int rng=0) const
 
virtual double student_t (unsigned int i, int rng=0) const
 
virtual double cauchy (double a, double b, int rng=0) const
 
virtual double triang (double a, double b, double c, int rng=0) const
 
virtual double lognormal (double m, double w, int rng=0) const
 
virtual double weibull (double a, double b, int rng=0) const
 
virtual double pareto_shifted (double a, double b, double c, int rng=0) const
 
virtual int intuniform (int a, int b, int rng=0) const
 
virtual int bernoulli (double p, int rng=0) const
 
virtual int binomial (int n, double p, int rng=0) const
 
virtual int geometric (double p, int rng=0) const
 
virtual int negbinomial (int n, double p, int rng=0) const
 
virtual int poisson (double lambda, int rng=0) const
 
virtual void emit (simsignal_t signalID, bool b, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, long l, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, unsigned long l, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, double d, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, const SimTime &t, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, const char *s, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, cObject *obj, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, const cObject *obj, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, char c, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, unsigned char c, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, short i, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, unsigned short i, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, int i, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, unsigned int i, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, float f, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, long double d, cObject *details=nullptr)
 
bool mayHaveListeners (simsignal_t signalID) const
 
bool hasListeners (simsignal_t signalID) const
 
virtual void subscribe (simsignal_t signalID, cIListener *listener)
 
virtual void subscribe (const char *signalName, cIListener *listener)
 
virtual void unsubscribe (simsignal_t signalID, cIListener *listener)
 
virtual void unsubscribe (const char *signalName, cIListener *listener)
 
virtual bool isSubscribed (simsignal_t signalID, cIListener *listener) const
 
virtual bool isSubscribed (const char *signalName, cIListener *listener) const
 
virtual std::vector< simsignal_tgetLocalListenedSignals () const
 
virtual std::vector< cIListener * > getLocalSignalListeners (simsignal_t signalID) const
 
virtual bool hasGUI () const
 
virtual cDisplayStringgetDisplayString () const
 
virtual void setDisplayString (const char *dispstr)
 
virtual void bubble (const char *text) const
 
virtual std::string resolveResourcePath (const char *fileName) const
 
virtual void recordScalar (const char *name, double value, const char *unit=nullptr)
 
virtual void recordScalar (const char *name, SimTime value, const char *unit=nullptr)
 
virtual void recordStatistic (cStatistic *stats, const char *unit=nullptr)
 
virtual void recordStatistic (const char *name, cStatistic *stats, const char *unit=nullptr)
 
- Public Member Functions inherited from omnetpp::cDefaultList
 cDefaultList (const char *name=nullptr)
 
virtual ~cDefaultList ()
 
virtual bool isSoftOwner () const override
 
virtual void parsimPack (cCommBuffer *buffer) const override
 
virtual void parsimUnpack (cCommBuffer *buffer) override
 
bool getPerformFinalGC () const
 
virtual void setPerformFinalGC (bool b)
 
int defaultListSize () const
 
cOwnedObjectdefaultListGet (int k)
 
bool defaultListContains (cOwnedObject *obj) const
 
 cDefaultList (const char *name=nullptr)
 
virtual ~cDefaultList ()
 
virtual bool isSoftOwner () const override
 
virtual void parsimPack (cCommBuffer *buffer) const override
 
virtual void parsimUnpack (cCommBuffer *buffer) override
 
bool getPerformFinalGC () const
 
virtual void setPerformFinalGC (bool b)
 
int defaultListSize () const
 
cOwnedObjectdefaultListGet (int k)
 
bool defaultListContains (cOwnedObject *obj) const
 
- Public Member Functions inherited from omnetpp::cNoncopyableOwnedObject
 cNoncopyableOwnedObject (const char *name=nullptr, bool namepooling=true)
 
virtual cNoncopyableOwnedObjectdup () const override
 
- Public Member Functions inherited from omnetpp::cOwnedObject
 cOwnedObject ()
 
 cOwnedObject (const char *name, bool namepooling=true)
 
 cOwnedObject (const cOwnedObject &obj)
 
virtual ~cOwnedObject ()
 
cOwnedObjectoperator= (const cOwnedObject &o)
 
 cOwnedObject ()
 
 cOwnedObject (const char *name, bool namepooling=true)
 
 cOwnedObject (const cOwnedObject &obj)
 
virtual ~cOwnedObject ()
 
cOwnedObjectoperator= (const cOwnedObject &o)
 
virtual cObjectgetOwner () const override
 
virtual bool isOwnedObject () const override
 
- Public Member Functions inherited from omnetpp::cNamedObject
 cNamedObject ()
 
 cNamedObject (const char *name, bool namepooling=true)
 
 cNamedObject (const cNamedObject &obj)
 
virtual ~cNamedObject ()
 
cNamedObjectoperator= (const cNamedObject &o)
 
virtual const char * getName () const override
 
virtual void setNamePooling (bool b)
 
virtual bool getNamePooling ()
 
 cNamedObject ()
 
 cNamedObject (const char *name, bool namepooling=true)
 
 cNamedObject (const cNamedObject &obj)
 
virtual ~cNamedObject ()
 
cNamedObjectoperator= (const cNamedObject &o)
 
virtual const char * getName () const override
 
virtual void setNamePooling (bool b)
 
virtual bool getNamePooling ()
 
- Public Member Functions inherited from omnetpp::cObject
 cObject ()
 
 cObject (const cObject &other)
 
virtual ~cObject ()
 
virtual const char * getClassName () const
 
bool isName (const char *s) const
 
const cObjectgetThisPtr () const
 
virtual std::string detailedInfo () const
 
cObjectfindObject (const char *name, bool deep=true)
 
void copyNotSupported () const
 
bool isName (const char *s) const
 
const cObjectgetThisPtr () const
 
virtual std::string detailedInfo () const
 
cObjectfindObject (const char *name, bool deep=true)
 
void copyNotSupported () const
 
- Static Public Member Functions inherited from omnetpp::cComponent
static simsignal_t registerSignal (const char *name)
 
static const char * getSignalName (simsignal_t signalID)
 
- Static Public Member Functions inherited from omnetpp::cOwnedObject
static long getTotalObjectCount ()
 
static long getLiveObjectCount ()
 
static void resetObjectCounters ()
 
static cDefaultListgetDefaultOwner ()
 
static long getTotalObjectCount ()
 
static long getLiveObjectCount ()
 
static void resetObjectCounters ()
 

Detailed Description

This model is exciting enough so that we can collect some statistics. We'll record in output vectors the hop count of every message upon arrival. Output vectors are written into the omnetpp.vec file and can be visualized with the Plove program.

We also collect basic statistics (min, max, mean, std.dev.) and histogram about the hop count which we'll print out at the end of the simulation.

Member Function Documentation

void Txc15::finish ( )
overrideprotectedvirtual

Reimplemented from omnetpp::cComponent.

130 {
131  // This function is called by OMNeT++ at the end of the simulation.
132  EV << "Sent: " << numSent << endl;
133  EV << "Received: " << numReceived << endl;
134  EV << "Hop count, min: " << hopCountStats.getMin() << endl;
135  EV << "Hop count, max: " << hopCountStats.getMax() << endl;
136  EV << "Hop count, mean: " << hopCountStats.getMean() << endl;
137  EV << "Hop count, stddev: " << hopCountStats.getStddev() << endl;
138 
139  recordScalar("#sent", numSent);
140  recordScalar("#received", numReceived);
141 
142  hopCountStats.recordAs("hop count");
143 }
virtual double getStddev() const override
virtual double getMean() const override
virtual void recordScalar(const char *name, double value, const char *unit=nullptr)
virtual double getMin() const override
#define EV
virtual void recordAs(const char *name, const char *unit=nullptr)
long numReceived
Definition: txc15.cc:31
cLongHistogram hopCountStats
Definition: txc15.cc:32
virtual double getMax() const override
long numSent
Definition: txc15.cc:30
void Txc15::forwardMessage ( TicTocMsg15 *  msg)
protectedvirtual
117 {
118  // Increment hop count.
119  msg->setHopCount(msg->getHopCount()+1);
120 
121  // Same routing as before: random gate.
122  int n = gateSize("gate");
123  int k = intuniform(0, n-1);
124 
125  EV << "Forwarding message " << msg << " on gate[" << k << "]\n";
126  send(msg, "gate$o", k);
127 }
virtual int send(cMessage *msg, int gateid)
#define EV
virtual int gateSize(const char *gatename) const
virtual int intuniform(int a, int b, int rng=0) const
TicTocMsg15 * Txc15::generateMessage ( )
protectedvirtual
98 {
99  // Produce source and destination addresses.
100  int src = getIndex();
101  int n = getVectorSize();
102  int dest = intuniform(0, n-2);
103  if (dest >= src)
104  dest++;
105 
106  char msgname[20];
107  sprintf(msgname, "tic-%d-to-%d", src, dest);
108 
109  // Create message object and set source and destination field.
110  TicTocMsg15 *msg = new TicTocMsg15(msgname);
111  msg->setSource(src);
112  msg->setDestination(dest);
113  return msg;
114 }
int getVectorSize() const
int getIndex() const
virtual int intuniform(int a, int b, int rng=0) const
void Txc15::handleMessage ( cMessage msg)
overrideprotectedvirtual

Reimplemented from omnetpp::cSimpleModule.

68 {
69  TicTocMsg15 *ttmsg = check_and_cast<TicTocMsg15 *>(msg);
70 
71  if (ttmsg->getDestination() == getIndex()) {
72  // Message arrived
73  int hopcount = ttmsg->getHopCount();
74  EV << "Message " << ttmsg << " arrived after " << hopcount << " hops.\n";
75  bubble("ARRIVED, starting new one!");
76 
77  // update statistics.
78  numReceived++;
79  hopCountVector.record(hopcount);
80  hopCountStats.collect(hopcount);
81 
82  delete ttmsg;
83 
84  // Generate another one.
85  EV << "Generating another message: ";
86  TicTocMsg15 *newmsg = generateMessage();
87  EV << newmsg << endl;
88  forwardMessage(newmsg);
89  numSent++;
90  }
91  else {
92  // We need to forward the message.
93  forwardMessage(ttmsg);
94  }
95 }
virtual void collect(double value) override
int getIndex() const
#define EV
virtual void bubble(const char *text) const
virtual bool record(double value)
virtual TicTocMsg15 * generateMessage()
Definition: txc15.cc:97
cOutVector hopCountVector
Definition: txc15.cc:33
virtual void forwardMessage(TicTocMsg15 *msg)
Definition: txc15.cc:116
long numReceived
Definition: txc15.cc:31
cLongHistogram hopCountStats
Definition: txc15.cc:32
P check_and_cast(T *p)
long numSent
Definition: txc15.cc:30
void Txc15::initialize ( )
overrideprotectedvirtual

Reimplemented from omnetpp::cComponent.

48 {
49  // Initialize variables
50  numSent = 0;
51  numReceived = 0;
52  WATCH(numSent);
54 
55  hopCountStats.setName("hopCountStats");
56  hopCountStats.setRangeAutoUpper(0, 10, 1.5);
57  hopCountVector.setName("HopCount");
58 
59  // Module 0 sends the first message
60  if (getIndex() == 0) {
61  // Boot the process scheduling the initial message as a self-message.
62  TicTocMsg15 *msg = generateMessage();
63  scheduleAt(0.0, msg);
64  }
65 }
virtual void setName(const char *s)
#define WATCH(variable)
int getIndex() const
virtual void setRangeAutoUpper(double lower, int numPrecollect=100, double rangeExtensionFactor=2.0)
virtual TicTocMsg15 * generateMessage()
Definition: txc15.cc:97
cOutVector hopCountVector
Definition: txc15.cc:33
long numReceived
Definition: txc15.cc:31
cLongHistogram hopCountStats
Definition: txc15.cc:32
virtual void setName(const char *name) override
virtual void scheduleAt(simtime_t t, cMessage *msg)
long numSent
Definition: txc15.cc:30

Member Data Documentation

cLongHistogram Txc15::hopCountStats
private
cOutVector Txc15::hopCountVector
private
long Txc15::numReceived
private
long Txc15::numSent
private

The documentation for this class was generated from the following file: