Txc4 Class Reference

Inheritance diagram for Txc4:
cSimpleModule cModule cComponent cDefaultList cNoncopyableOwnedObject cOwnedObject noncopyable cNamedObject cObject

List of all members.

Protected Member Functions

virtual void initialize ()
virtual void handleMessage (cMessage *msg)

Private Attributes

int counter

Detailed Description

In this step you'll learn how to add input parameters to the simulation: we'll turn the "magic number" 10 into a parameter.


Member Function Documentation

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 }

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 }


Member Data Documentation

int Txc4::counter [private]

Referenced by handleMessage(), and initialize().


The documentation for this class was generated from the following file:
Generated on Tue Dec 2 11:16:33 2014 for Tictoc Tutorial by  doxygen 1.6.3