#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 |
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; 00083 }
| cGate * TraceChurn::getAppGateById | ( | int | nodeId | ) |
Definition at line 95 of file TraceChurn.cc.
00095 { 00096 UNORDERED_MAP<int, nodeMapEntry*>::iterator it = nodeMap.find(nodeId); 00097 00098 if (it == nodeMap.end()) { 00099 throw cRuntimeError("Trying to get appGate of nonexisting node"); 00100 } 00101 00102 return it->second->second; 00103 }
| TransportAddress * TraceChurn::getTransportAddressById | ( | int | nodeId | ) | [protected] |
Definition at line 85 of file TraceChurn.cc.
00085 { 00086 UNORDERED_MAP<int, nodeMapEntry*>::iterator it = nodeMap.find(nodeId); 00087 00088 if (it == nodeMap.end()) { 00089 throw cRuntimeError("Trying to get TransportAddress of nonexisting node"); 00090 } 00091 00092 return it->second->first; 00093 }
| void TraceChurn::handleMessage | ( | cMessage * | msg | ) | [virtual] |
| 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 105 of file TraceChurn.cc.
00106 { 00107 char buf[80]; 00108 sprintf(buf, "trace churn"); 00109 getDisplayString().setTagArg("t", 0, buf); 00110 }
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] |
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().
1.5.8