Inherits BaseModule.
Public Member Functions | |
virtual void | initialize (int stage) |
Basic initialization for all modules. | |
virtual void | handleMessage (cMessage *msg) |
virtual void | finish () |
Protected Attributes | |
int | dataOut |
int | dataIn |
int | ctrlOut |
int | ctrlIn |
cMessage * | delayTimer |
int | nbPackets |
int | remainingPackets |
int | headerLength |
int | nodeAddr |
int | dstAddr |
double | trafficParam |
bool | debug |
Debug switch for all other modules. | |
bool | stats |
bool | trace |
bool | flood |
bool | isTransmitting |
int | INITIAL_DELAY |
int | PAYLOAD_SIZE |
int | nbPacketsReceived |
vector< cStdDev > | latencies |
cOutVector | latenciesRaw |
cStdDev | testStat |
Definition at line 14 of file TestApplication.h.
void TestApplication::initialize | ( | int | stage | ) | [virtual] |
Basic initialization for all modules.
Subscription to Blackboard should be in stage==0, and firing notifications in stage==1 or later.
NOTE: You have to call this in the initialize() function of the inherited class!
Reimplemented from BaseModule.
Definition at line 6 of file TestApplication.cc.
References debug.
{ BaseModule::initialize(stage); if (stage == 0) { // begin by connecting the gates // to allow messages exchange dataOut = findGate("lowerGateOut"); dataIn = findGate("lowerGateIn"); ctrlOut = findGate("lowerControlOut"); ctrlIn = findGate("lowerControlIn"); // Retrieve parameters debug = par("debug").boolValue(); stats = par("stats").boolValue(); trace = par("trace").boolValue(); isTransmitting = false; nbPackets = par("nbPackets"); trafficParam = par("trafficParam").doubleValue(); nodeAddr = par("nodeAddr"); dstAddr = par("dstAddr"); flood = par("flood").boolValue(); PAYLOAD_SIZE = par("payloadSize"); // data field size PAYLOAD_SIZE = PAYLOAD_SIZE * 8; // convert to bits // Configure internal state variables and objects nbPacketsReceived = 0; remainingPackets = nbPackets; INITIAL_DELAY = 5; // initial delay before sending first packet // start timer if needed if (nodeAddr != 0 && remainingPackets > 0) { delayTimer = new cMessage("app-delay-timer"); scheduleAt(simTime() + INITIAL_DELAY +uniform(0,0.001), delayTimer); // we add a small shift to avoid systematic collisions } else { delayTimer = 0; } if (stats) { // we should collect statistics cModule *host = getParentModule(); int nbNodes = host->size(); for (int i = 0; i < nbNodes; i++) { std::ostringstream oss; oss << "latency"; oss << i; cStdDev aLatency(oss.str().c_str()); latencies.push_back(aLatency); } } if (trace) { // record all packet arrivals latenciesRaw.setName("rawLatencies"); } } }