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