00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00026 #ifndef __SIMPLENODEENTRY_H
00027 #define __SIMPLENODEENTRY_H
00028
00029
00030 #include <omnetpp.h>
00031 #include <IPvXAddress.h>
00032
00033 #include "SimpleUDPPacket_m.h"
00034
00035
00036 class NodeRecord
00037 {
00038 public:
00039 NodeRecord(uint32_t dim);
00040 ~NodeRecord();
00041 NodeRecord(const NodeRecord& nodeRecord);
00042 NodeRecord& operator=(const NodeRecord& nodeRecord);
00043 void debugOutput(int dim);
00044
00045 double* coords;
00046 IPvXAddress ip;
00047 static uint32_t dim;
00048 };
00049
00055 class SimpleNodeEntry : public cPolymorphic
00056 {
00057 public:
00058
00059 ~SimpleNodeEntry()
00060 {
00061 if (index == -1) delete nodeRecord;
00062 }
00063
00072 SimpleNodeEntry(cModule* node, cChannelType* type,
00073 uint32_t fieldSize, uint32_t sendQueueLength);
00074
00084 SimpleNodeEntry(cModule* node, cChannelType* type, uint32_t sendQueueLength,
00085 NodeRecord* nodeRecord, int index);
00086
00092 inline cGate* getGate() const
00093 {
00094 return ingate;
00095 };
00096
00102
00103
00104
00105
00106
00112
00113
00114
00115
00116
00117 typedef std::pair<simtime_t, bool> SimpleDelay;
00118
00126 SimpleDelay calcDelay(SimpleUDPPacket* msg, const SimpleNodeEntry& dest);
00127
00133 std::string info() const;
00134
00142 friend std::ostream& operator<<(std::ostream& out, const SimpleNodeEntry& entry);
00143
00144 simtime_t getAccessDelay() { return accessDelay; };
00145
00146
00147 float getBandwidth() { return bandwidth; };
00148
00149 float getErrorRate() { return errorRate; };
00150
00151 inline float getX() { return nodeRecord->coords[0]; };
00152 inline float getY() { return nodeRecord->coords[1]; };
00153
00154 int getRecordIndex() { return index; };
00155 NodeRecord* getNodeRecord() { return nodeRecord; };
00156
00157 protected:
00158
00165 float operator-(const SimpleNodeEntry& entry) const;
00166
00167 cGate* ingate;
00168
00169 simtime_t txFinished;
00170 simtime_t txMaxQueueTime;
00171 simtime_t accessDelay;
00172 double bandwidth;
00173 double errorRate;
00174
00175 NodeRecord* nodeRecord;
00176 int index;
00177 };
00178
00179
00180 #endif // __SIMPLENODEENTRY_H