#include <NoChurn.h>
Public Member Functions | |
void | handleMessage (cMessage *msg) |
void | initializeChurn () |
~NoChurn () | |
Protected Member Functions | |
void | updateDisplayString () |
Private Attributes | |
double | initialMean |
mean of update interval during initalization phase | |
double | initialDeviation |
deviation of update interval during initalization phase | |
bool | initAddMoreTerminals |
true, if we're still adding more terminals in the init phase | |
cMessage * | mobilityTimer |
message to schedule events |
NoChurn::~NoChurn | ( | ) |
void NoChurn::handleMessage | ( | cMessage * | msg | ) | [virtual] |
Implements ChurnGenerator.
00046 { 00047 if (!msg->isSelfMessage()) { 00048 throw new cRuntimeError("NoChurn::handleMessage(): " 00049 "Unknown message received!"); 00050 delete msg; 00051 return; 00052 } 00053 00054 if (msg == mobilityTimer) { 00055 if (terminalCount < targetOverlayTerminalNum) { 00056 TransportAddress* ta = underlayConfigurator->createNode(type); 00057 delete ta; // Address not needed in this churn model 00058 } 00059 00060 if (terminalCount >= targetOverlayTerminalNum) { 00061 initAddMoreTerminals = false; 00062 underlayConfigurator->initFinished(); 00063 } else { 00064 scheduleAt(simulation.simTime() 00065 + truncnormal(initialMean, initialDeviation), msg); 00066 } 00067 } 00068 }
void NoChurn::initializeChurn | ( | ) | [virtual] |
Implements ChurnGenerator.
00032 { 00033 Enter_Method_Silent(); 00034 00035 initialMean = par("initPhaseCreationInterval"); 00036 initialDeviation = initialMean / 3; 00037 targetOverlayTerminalNum = par("targetOverlayTerminalNum"); 00038 00039 initAddMoreTerminals = true; 00040 00041 mobilityTimer = new cMessage("mobilityTimer"); 00042 scheduleAt(simulation.simTime(), mobilityTimer); 00043 }
void NoChurn::updateDisplayString | ( | ) | [protected, virtual] |
Implements ChurnGenerator.
00071 { 00072 char buf[80]; 00073 sprintf(buf, "No churn"); 00074 displayString().setTagArg("t", 0, buf); 00075 }
double NoChurn::initialMean [private] |
mean of update interval during initalization phase
Referenced by handleMessage(), and initializeChurn().
double NoChurn::initialDeviation [private] |
deviation of update interval during initalization phase
Referenced by handleMessage(), and initializeChurn().
bool NoChurn::initAddMoreTerminals [private] |
true, if we're still adding more terminals in the init phase
Referenced by handleMessage(), and initializeChurn().
cMessage* NoChurn::mobilityTimer [private] |