Txc1 Class Reference

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

List of all members.

Protected Member Functions

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

Detailed Description

Derive the Txc1 class from cSimpleModule. In the Tictoc1 network, both the `tic' and `toc' modules are Txc1 objects, created by OMNeT++ at the beginning of the simulation.


Member Function Documentation

void Txc1::handleMessage ( cMessage msg  )  [protected, virtual]

Reimplemented from cSimpleModule.

00048 {
00049     // The handleMessage() method is called whenever a message arrives
00050     // at the module. Here, we just send it to the other module, through
00051     // gate `out'. Because both `tic' and `toc' does the same, the message
00052     // will bounce between the two.
00053     send(msg, "out");
00054 }

void Txc1::initialize (  )  [protected, virtual]

Reimplemented from cComponent.

00032 {
00033     // Initialize is called at the beginning of the simulation.
00034     // To bootstrap the tic-toc-tic-toc process, one of the modules needs
00035     // to send the first message. Let this be `tic'.
00036 
00037     // Am I Tic or Toc?
00038     if (strcmp("tic", getName()) == 0)
00039     {
00040         // create and send first message on gate "out". "tictocMsg" is an
00041         // arbitrary string which will be the name of the message object.
00042         cMessage *msg = new cMessage("tictocMsg");
00043         send(msg, "out");
00044     }
00045 }


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