InetUnderlayConfigurator.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00022 #ifndef __IPV4UNDERLAYCONFIGURATOR_H__
00023 #define __IPV4UNDERLAYCONFIGURATOR_H__
00024
00025 #include <vector>
00026 #include <deque>
00027 #include <set>
00028
00029 #include <omnetpp.h>
00030
00031 #include <UnderlayConfigurator.h>
00032
00033 class IPvXAddress;
00034
00041 class InetUnderlayConfigurator : public UnderlayConfigurator
00042 {
00043 public:
00050 TransportAddress* createNode(NodeType type, bool initialize=false);
00051
00058 void preKillNode(NodeType type, TransportAddress* addr=NULL);
00059
00066 void migrateNode(NodeType type, TransportAddress* addr=NULL);
00067
00068 private:
00069
00070 int accessRouterNum;
00071 int overlayAccessRouterNum;
00072 int overlayTerminalNum;
00074 protected:
00075
00083 void initializeUnderlay(int stage);
00084
00090 void handleTimerEvent(cMessage* msg);
00091
00095 void finishUnderlay();
00096
00100 void setDisplayString();
00101 std::vector<cModule*> accessNode;
00102 std::deque<IPvXAddress> killList;
00103 std::set<int> scheduledID;
00104
00105
00106 int numCreated;
00107 int numKilled;
00108 };
00109
00110
00120 double uniform2(double start, double end, double index, double new_calc)
00121 {
00122 static std::vector<double> value;
00123 if ( (unsigned int)index >= value.size() )
00124 value.resize((int)index + 1);
00125 if ( new_calc == 1 )
00126 value[(int)index] = uniform(start, end);
00127 return value[(int)index];
00128 };
00129
00139 double intuniform2(double start, double end, double index, double new_calc)
00140 {
00141 static std::vector<double> value;
00142 if ( (unsigned int)index >= value.size() )
00143 value.resize((int)index + 1);
00144 if ( new_calc == 1 )
00145 value[(int)index] = (double)intuniform((int)start, (int)end);
00146 return value[(int)index];
00147 };
00148
00149 Define_Function(uniform2, 4);
00150 Define_Function(intuniform2, 4);
00151
00152 #endif