Inheritance diagram for Txc3:

Public Member Functions | |
| Module_Class_Members (Txc3, cSimpleModule, 0) | |
| virtual void | initialize () |
| virtual void | handleMessage (cMessage *msg) |
Protected Attributes | |
| int | counter |
|
|
Reimplemented from cSimpleModule. 00053 {
00054 // Increment counter and check value.
00055 counter--;
00056 if (counter==0)
00057 {
00058 // If counter is zero, delete message. If you run the model, you'll
00059 // find that the simulation will stop at this point with the message
00060 // "no more events".
00061 ev << name() << "'s counter reached zero, deleting message\n";
00062 delete msg;
00063 }
00064 else
00065 {
00066 ev << name() << "'s counter is " << counter << ", sending back message\n";
00067 send(msg, "out");
00068 }
00069 }
|
|
|
Reimplemented from cModule. 00033 {
00034 // Initialize counter to ten. We'll decrement it every time and delete
00035 // the message when it reaches zero.
00036 counter = 10;
00037
00038 // The WATCH() statement below will let you examine the variable under
00039 // Tkenv. After doing a few steps in the simulation, double-click either
00040 // `tic' or `toc', select the Contents tab in the dialog that pops up,
00041 // and you'll find "counter" in the list.
00042 WATCH(counter);
00043
00044 if (strcmp("tic", name()) == 0)
00045 {
00046 ev << "Sending initial message\n";
00047 cMessage *msg = new cMessage("tictocMsg");
00048 send(msg, "out");
00049 }
00050 }
|
|
||||||||||||||||
|
|
|
|
|
1.3.9.1