Vast_m.h
Go to the documentation of this file.00001
00002
00003
00004
00005 #ifndef _VAST_M_H_
00006 #define _VAST_M_H_
00007
00008 #include <omnetpp.h>
00009
00010
00011 #define MSGC_VERSION 0x0400
00012 #if (MSGC_VERSION!=OMNETPP_VERSION)
00013 # error Version mismatch! Probably this file was generated by an earlier version of opp_msgc: 'make clean' should help.
00014 #endif
00015
00016
00017
00018 #include <NodeHandle.h>
00019 #include <OverlayKey.h>
00020 #include <Vector2D.h>
00021 #include <CommonMessages_m.h>
00022
00023
00024 static const int VASTCOMMAND_L = 8;
00025 static const int POSITION_L = 128;
00026 static const int ENTRYCOUNT_L = 32;
00027 static const int COUNT_L = 32;
00028 static const int FLAG_L = 8;
00029
00030 #define VAST_L(msg) (VASTCOMMAND_L + NODEHANDLE_L + KEY_L + POSITION_L + COUNT_L)
00031 #define VASTLIST_L(msg) (VAST_L(msg) + ENTRYCOUNT_L + FLAG_L + msg->getNeighborNodeArraySize() * (NODEHANDLE_L + POSITION_L))
00032 #define VASTMOVE_L(msg) (VAST_L(msg) + POSITION_L + 2 * FLAG_L)
00033 #define VASTDISCARD_L(msg) (VAST_L(msg) + NODEHANDLE_L)
00034
00035
00036
00037
00057 enum VASTCommand {
00058 JOIN_REQUEST = 0,
00059 JOIN_ACKNOWLEDGE = 1,
00060 NODE_MOVE = 2,
00061 NEW_NEIGHBORS = 3,
00062 NODE_LEAVE = 4,
00063 ENCLOSING_NEIGHBORS_REQUEST = 5,
00064 BACKUP_NEIGHBORS = 6,
00065 PING = 7,
00066 PONG = 8,
00067 DISCARD_NODE = 9,
00068 VAST_EVENT = 10
00069 };
00070
00084 class VastMessage : public BaseOverlayMessage
00085 {
00086 protected:
00087 int command_var;
00088 NodeHandle sourceNode_var;
00089 OverlayKey destKey_var;
00090 Vector2D pos_var;
00091 int neighborCount_var;
00092
00093
00094 bool operator==(const VastMessage&);
00095
00096 public:
00097 VastMessage(const char *name=NULL, int kind=0);
00098 VastMessage(const VastMessage& other);
00099 virtual ~VastMessage();
00100 VastMessage& operator=(const VastMessage& other);
00101 virtual VastMessage *dup() const {return new VastMessage(*this);}
00102 virtual void parsimPack(cCommBuffer *b);
00103 virtual void parsimUnpack(cCommBuffer *b);
00104
00105
00106 virtual int getCommand() const;
00107 virtual void setCommand(int command_var);
00108 virtual NodeHandle& getSourceNode();
00109 virtual const NodeHandle& getSourceNode() const {return const_cast<VastMessage*>(this)->getSourceNode();}
00110 virtual void setSourceNode(const NodeHandle& sourceNode_var);
00111 virtual OverlayKey& getDestKey();
00112 virtual const OverlayKey& getDestKey() const {return const_cast<VastMessage*>(this)->getDestKey();}
00113 virtual void setDestKey(const OverlayKey& destKey_var);
00114 virtual Vector2D& getPos();
00115 virtual const Vector2D& getPos() const {return const_cast<VastMessage*>(this)->getPos();}
00116 virtual void setPos(const Vector2D& pos_var);
00117 virtual int getNeighborCount() const;
00118 virtual void setNeighborCount(int neighborCount_var);
00119 };
00120
00121 inline void doPacking(cCommBuffer *b, VastMessage& obj) {obj.parsimPack(b);}
00122 inline void doUnpacking(cCommBuffer *b, VastMessage& obj) {obj.parsimUnpack(b);}
00123
00135 class VastListMessage : public VastMessage
00136 {
00137 protected:
00138 NodeHandle *neighborNode_var;
00139 unsigned int neighborNode_arraysize;
00140 Vector2D *neighborPos_var;
00141 unsigned int neighborPos_arraysize;
00142 bool requestEnclosingNeighbors_var;
00143
00144
00145 bool operator==(const VastListMessage&);
00146
00147 public:
00148 VastListMessage(const char *name=NULL, int kind=0);
00149 VastListMessage(const VastListMessage& other);
00150 virtual ~VastListMessage();
00151 VastListMessage& operator=(const VastListMessage& other);
00152 virtual VastListMessage *dup() const {return new VastListMessage(*this);}
00153 virtual void parsimPack(cCommBuffer *b);
00154 virtual void parsimUnpack(cCommBuffer *b);
00155
00156
00157 virtual void setNeighborNodeArraySize(unsigned int size);
00158 virtual unsigned int getNeighborNodeArraySize() const;
00159 virtual NodeHandle& getNeighborNode(unsigned int k);
00160 virtual const NodeHandle& getNeighborNode(unsigned int k) const {return const_cast<VastListMessage*>(this)->getNeighborNode(k);}
00161 virtual void setNeighborNode(unsigned int k, const NodeHandle& neighborNode_var);
00162 virtual void setNeighborPosArraySize(unsigned int size);
00163 virtual unsigned int getNeighborPosArraySize() const;
00164 virtual Vector2D& getNeighborPos(unsigned int k);
00165 virtual const Vector2D& getNeighborPos(unsigned int k) const {return const_cast<VastListMessage*>(this)->getNeighborPos(k);}
00166 virtual void setNeighborPos(unsigned int k, const Vector2D& neighborPos_var);
00167 virtual bool getRequestEnclosingNeighbors() const;
00168 virtual void setRequestEnclosingNeighbors(bool requestEnclosingNeighbors_var);
00169 };
00170
00171 inline void doPacking(cCommBuffer *b, VastListMessage& obj) {obj.parsimPack(b);}
00172 inline void doUnpacking(cCommBuffer *b, VastListMessage& obj) {obj.parsimUnpack(b);}
00173
00185 class VastMoveMessage : public VastMessage
00186 {
00187 protected:
00188 Vector2D newPos_var;
00189 bool is_boundary_var;
00190 bool request_list_var;
00191
00192
00193 bool operator==(const VastMoveMessage&);
00194
00195 public:
00196 VastMoveMessage(const char *name=NULL, int kind=0);
00197 VastMoveMessage(const VastMoveMessage& other);
00198 virtual ~VastMoveMessage();
00199 VastMoveMessage& operator=(const VastMoveMessage& other);
00200 virtual VastMoveMessage *dup() const {return new VastMoveMessage(*this);}
00201 virtual void parsimPack(cCommBuffer *b);
00202 virtual void parsimUnpack(cCommBuffer *b);
00203
00204
00205 virtual Vector2D& getNewPos();
00206 virtual const Vector2D& getNewPos() const {return const_cast<VastMoveMessage*>(this)->getNewPos();}
00207 virtual void setNewPos(const Vector2D& newPos_var);
00208 virtual bool getIs_boundary() const;
00209 virtual void setIs_boundary(bool is_boundary_var);
00210 virtual bool getRequest_list() const;
00211 virtual void setRequest_list(bool request_list_var);
00212 };
00213
00214 inline void doPacking(cCommBuffer *b, VastMoveMessage& obj) {obj.parsimPack(b);}
00215 inline void doUnpacking(cCommBuffer *b, VastMoveMessage& obj) {obj.parsimUnpack(b);}
00216
00226 class VastDiscardMessage : public VastMessage
00227 {
00228 protected:
00229 NodeHandle discardNode_var;
00230
00231
00232 bool operator==(const VastDiscardMessage&);
00233
00234 public:
00235 VastDiscardMessage(const char *name=NULL, int kind=0);
00236 VastDiscardMessage(const VastDiscardMessage& other);
00237 virtual ~VastDiscardMessage();
00238 VastDiscardMessage& operator=(const VastDiscardMessage& other);
00239 virtual VastDiscardMessage *dup() const {return new VastDiscardMessage(*this);}
00240 virtual void parsimPack(cCommBuffer *b);
00241 virtual void parsimUnpack(cCommBuffer *b);
00242
00243
00244 virtual NodeHandle& getDiscardNode();
00245 virtual const NodeHandle& getDiscardNode() const {return const_cast<VastDiscardMessage*>(this)->getDiscardNode();}
00246 virtual void setDiscardNode(const NodeHandle& discardNode_var);
00247 };
00248
00249 inline void doPacking(cCommBuffer *b, VastDiscardMessage& obj) {obj.parsimPack(b);}
00250 inline void doUnpacking(cCommBuffer *b, VastDiscardMessage& obj) {obj.parsimUnpack(b);}
00251
00260 class VastEventMessage : public VastMessage
00261 {
00262 protected:
00263
00264
00265 bool operator==(const VastEventMessage&);
00266
00267 public:
00268 VastEventMessage(const char *name=NULL, int kind=0);
00269 VastEventMessage(const VastEventMessage& other);
00270 virtual ~VastEventMessage();
00271 VastEventMessage& operator=(const VastEventMessage& other);
00272 virtual VastEventMessage *dup() const {return new VastEventMessage(*this);}
00273 virtual void parsimPack(cCommBuffer *b);
00274 virtual void parsimUnpack(cCommBuffer *b);
00275
00276
00277 };
00278
00279 inline void doPacking(cCommBuffer *b, VastEventMessage& obj) {obj.parsimPack(b);}
00280 inline void doUnpacking(cCommBuffer *b, VastEventMessage& obj) {obj.parsimUnpack(b);}
00281
00282
00283 #endif // _VAST_M_H_