#include <TraceChurn.h>
If trace includes user action, send actions to application
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 pair < TransportAddress *, cGate * > | nodeMapEntry |
Private Attributes | |
char * | maxTier |
bool | initAddMoreTerminals |
true, if we're still adding more terminals in the init phase | |
cMessage * | nextRead |
__gnu_cxx::hash_map < int, nodeMapEntry * > | nodeMap |
typedef pair<TransportAddress*, cGate*> TraceChurn::nodeMapEntry [private] |
void TraceChurn::handleMessage | ( | cMessage * | msg | ) | [virtual] |
void TraceChurn::initializeChurn | ( | ) | [virtual] |
Implements ChurnGenerator.
00029 { 00030 Enter_Method_Silent(); 00031 00032 // get uppermost tier 00033 // Quick hack. Works fine unless numTiers is > 9 (which should never happen) 00034 maxTier = new char[6]; 00035 strcpy(maxTier, "tier0"); 00036 maxTier[4] += par("numTiers").longValue(); 00037 00038 // FIXME: There should be a tracefile command to decide when init phase has finished 00039 underlayConfigurator->initFinished(); 00040 }
void TraceChurn::createNode | ( | int | nodeId | ) |
00049 { 00050 Enter_Method_Silent(); 00051 00052 TransportAddress* ta = underlayConfigurator->createNode(type); 00053 PeerInfo* peer = BootstrapOracleAccess().get()->getPeerInfo(*ta); 00054 cGate* inGate = simulation.module(peer->getModuleID())->submodule(maxTier)->gate("trace_in"); 00055 if (!inGate) { 00056 throw new cException("Application has no trace_in gate. Most probably " 00057 "that means it is not able to handle trace data."); 00058 } 00059 nodeMapEntry* e = new nodeMapEntry(ta, inGate); 00060 nodeMap[nodeId] = e; 00061 }
void TraceChurn::deleteNode | ( | int | nodeId | ) |
00064 { 00065 Enter_Method_Silent(); 00066 00067 nodeMapEntry* e; 00068 __gnu_cxx::hash_map<int, nodeMapEntry*>::iterator it = nodeMap.find(nodeId); 00069 00070 if (it == nodeMap.end()) { 00071 throw new cException("Trying to delete non-existing node"); 00072 } 00073 00074 e = it->second; 00075 underlayConfigurator->preKillNode(NodeType(), e->first); 00076 nodeMap.erase(it); 00077 delete e; 00078 }
cGate * TraceChurn::getAppGateById | ( | int | nodeId | ) |
void TraceChurn::updateDisplayString | ( | ) | [protected, virtual] |
Implements ChurnGenerator.
00101 { 00102 char buf[80]; 00103 sprintf(buf, "trace churn"); 00104 displayString().setTagArg("t", 0, buf); 00105 }
TransportAddress * TraceChurn::getTransportAddressById | ( | int | nodeId | ) | [protected] |
char* TraceChurn::maxTier [private] |
bool TraceChurn::initAddMoreTerminals [private] |
true, if we're still adding more terminals in the init phase
cMessage* TraceChurn::nextRead [private] |
__gnu_cxx::hash_map<int, nodeMapEntry*> TraceChurn::nodeMap [private] |