
Protected Member Functions | |
| virtual void | initialize () |
| virtual void | handleMessage (cMessage *msg) |
Private Attributes | |
| int | counter |
| void Txc5::initialize | ( | ) | [protected, virtual] |
Reimplemented from cComponent.
00031 { 00032 // Initialize the counter with the "limit" module parameter, declared 00033 // in the NED file (tictoc4.ned). 00034 counter = par("limit"); 00035 00036 // we no longer depend on the name of the module to decide 00037 // whether to send an initial message 00038 if (par("sendMsgOnInit").boolValue() == true) 00039 { 00040 EV << "Sending initial message\n"; 00041 cMessage *msg = new cMessage("tictocMsg"); 00042 send(msg, "out"); 00043 } 00044 }
| void Txc5::handleMessage | ( | cMessage * | msg | ) | [protected, virtual] |
Reimplemented from cSimpleModule.
00047 { 00048 counter--; 00049 if (counter==0) 00050 { 00051 EV << getName() << "'s counter reached zero, deleting message\n"; 00052 delete msg; 00053 } 00054 else 00055 { 00056 EV << getName() << "'s counter is " << counter << ", sending back message\n"; 00057 send(msg, "out"); 00058 } 00059 }
int Txc5::counter [private] |
Referenced by handleMessage(), and initialize().
1.5.5