Parse a trace file and schedule node joins/leaves according to trace data. More...
#include <TraceChurn.h>
Public Member Functions | |
void | handleMessage (cMessage *msg) |
void | initializeChurn () |
void | createNode (int nodeId) |
void | deleteNode (int nodeId) |
cGate * | getAppGateById (int nodeId) |
Protected Member Functions | |
void | updateDisplayString () |
TransportAddress * | getTransportAddressById (int nodeId) |
Private Types | |
typedef std::pair < TransportAddress *, cGate * > | nodeMapEntry |
Private Attributes | |
char * | maxTier |
bool | initAddMoreTerminals |
true, if we're still adding more terminals in the init phase | |
cMessage * | nextRead |
UNORDERED_MAP< int, nodeMapEntry * > | nodeMap |
Parse a trace file and schedule node joins/leaves according to trace data.
If trace includes user action, send actions to application
Definition at line 36 of file TraceChurn.h.
typedef std::pair<TransportAddress*, cGate*> TraceChurn::nodeMapEntry [private] |
Definition at line 55 of file TraceChurn.h.
void TraceChurn::createNode | ( | int | nodeId | ) |
Definition at line 53 of file TraceChurn.cc.
00054 { 00055 Enter_Method_Silent(); 00056 00057 TransportAddress* ta = underlayConfigurator->createNode(type); 00058 PeerInfo* peer = GlobalNodeListAccess().get()->getPeerInfo(*ta); 00059 cGate* inGate = simulation.getModule(peer->getModuleID())->getSubmodule(maxTier)->gate("trace_in"); 00060 if (!inGate) { 00061 throw cRuntimeError("Application has no trace_in gate. Most probably " 00062 "that means it is not able to handle trace data."); 00063 } 00064 nodeMapEntry* e = new nodeMapEntry(ta, inGate); 00065 nodeMap[nodeId] = e; 00066 }
void TraceChurn::deleteNode | ( | int | nodeId | ) |
Definition at line 68 of file TraceChurn.cc.
00069 { 00070 Enter_Method_Silent(); 00071 00072 nodeMapEntry* e; 00073 UNORDERED_MAP<int, nodeMapEntry*>::iterator it = nodeMap.find(nodeId); 00074 00075 if (it == nodeMap.end()) { 00076 throw cRuntimeError("Trying to delete non-existing node"); 00077 } 00078 00079 e = it->second; 00080 underlayConfigurator->preKillNode(NodeType(), e->first); 00081 nodeMap.erase(it); 00082 delete e->first; 00083 delete e; 00084 }
cGate * TraceChurn::getAppGateById | ( | int | nodeId | ) |
Definition at line 96 of file TraceChurn.cc.
TransportAddress * TraceChurn::getTransportAddressById | ( | int | nodeId | ) | [protected] |
Definition at line 86 of file TraceChurn.cc.
void TraceChurn::handleMessage | ( | cMessage * | msg | ) | [virtual] |
Implements ChurnGenerator.
Definition at line 47 of file TraceChurn.cc.
void TraceChurn::initializeChurn | ( | ) | [virtual] |
Implements ChurnGenerator.
Definition at line 33 of file TraceChurn.cc.
00034 { 00035 Enter_Method_Silent(); 00036 00037 // get uppermost tier 00038 // Quick hack. Works fine unless numTiers is > 9 (which should never happen) 00039 maxTier = new char[6]; 00040 strcpy(maxTier, "tier0"); 00041 maxTier[4] += par("numTiers").longValue(); 00042 00043 // FIXME: There should be a tracefile command to decide when init phase has finished 00044 underlayConfigurator->initFinished(); 00045 }
void TraceChurn::updateDisplayString | ( | ) | [protected, virtual] |
Implements ChurnGenerator.
Definition at line 106 of file TraceChurn.cc.
bool TraceChurn::initAddMoreTerminals [private] |
true, if we're still adding more terminals in the init phase
Definition at line 53 of file TraceChurn.h.
char* TraceChurn::maxTier [private] |
Definition at line 51 of file TraceChurn.h.
Referenced by createNode(), and initializeChurn().
cMessage* TraceChurn::nextRead [private] |
Definition at line 54 of file TraceChurn.h.
UNORDERED_MAP<int, nodeMapEntry*> TraceChurn::nodeMap [private] |
Definition at line 56 of file TraceChurn.h.
Referenced by createNode(), deleteNode(), getAppGateById(), and getTransportAddressById().