📄 rip_m.cc
字号:
//// Generated file, do not edit! Created by opp_msgc 3.3 from rip.msg.//// Disable warnings about unused variables, empty switch stmts, etc:#ifdef _MSC_VER# pragma warning(disable:4101)# pragma warning(disable:4065)#endif#include <iostream>#include <sstream>#include "rip_m.h"// Template rule which fires if a struct or class doesn't have operator<<template<typename T>std::ostream& operator<<(std::ostream& out,const T&) {return out;}// Another default rule (prevents compiler from choosing base class' doPacking())template<typename T>void doPacking(cCommBuffer *, T& t) { throw new cException("Parsim error: no doPacking() function for type %s or its base class (check .msg and _m.cc/h files!)",opp_typename(typeid(t)));}template<typename T>void doUnpacking(cCommBuffer *, T& t) { throw new cException("Parsim error: no doUnpacking() function for type %s or its base class (check .msg and _m.cc/h files!)",opp_typename(typeid(t)));}// Automatically supply array (un)packing functionstemplate<typename T>void doPacking(cCommBuffer *b, T *t, int n) { for (int i=0; i<n; i++) doPacking(b,t[i]);}template<typename T>void doUnpacking(cCommBuffer *b, T *t, int n) { for (int i=0; i<n; i++) doUnpacking(b,t[i]);}inline void doPacking(cCommBuffer *, cPolymorphic&) {}inline void doUnpacking(cCommBuffer *, cPolymorphic&) {}#define DOPACKING(T,R) \ inline void doPacking(cCommBuffer *b, T R a) {b->pack(a);} \ inline void doPacking(cCommBuffer *b, T *a, int n) {b->pack(a,n);} \ inline void doUnpacking(cCommBuffer *b, T& a) {b->unpack(a);} \ inline void doUnpacking(cCommBuffer *b, T *a, int n) {b->unpack(a,n);}#define _DOPACKING(char,_)DOPACKING(unsigned char,_)DOPACKING(bool,_)DOPACKING(short,_)DOPACKING(unsigned short,_)DOPACKING(int,_)DOPACKING(unsigned int,_)DOPACKING(long,_)DOPACKING(unsigned long,_)DOPACKING(float,_)DOPACKING(double,_)DOPACKING(long double,_)DOPACKING(char *,_)DOPACKING(const char *,_)DOPACKING(opp_string,&)//DOPACKING(std::string,&)#undef _#undef DOPACKINGRegister_Class(update);update::update(const char *name, int kind) : cMessage(name,kind){ unsigned int i; this->count_var = 1; for (i=0; i<100; i++) this->thisAdd_var[i] = 0; for (i=0; i<100; i++) this->destAdd_var[i] = 0; for (i=0; i<100; i++) this->nextHop_var[i] = 0; for (i=0; i<100; i++) this->hopCount_var[i] = 0;}update::update(const update& other) : cMessage(){ unsigned int i; setName(other.name()); operator=(other);}update::~update(){ unsigned int i;}update& update::operator=(const update& other){ if (this==&other) return *this; unsigned int i; cMessage::operator=(other); this->count_var = other.count_var; for (i=0; i<100; i++) this->thisAdd_var[i] = other.thisAdd_var[i]; for (i=0; i<100; i++) this->destAdd_var[i] = other.destAdd_var[i]; for (i=0; i<100; i++) this->nextHop_var[i] = other.nextHop_var[i]; for (i=0; i<100; i++) this->hopCount_var[i] = other.hopCount_var[i]; return *this;}void update::netPack(cCommBuffer *b){ cMessage::netPack(b); doPacking(b,this->count_var); doPacking(b,this->thisAdd_var,100); doPacking(b,this->destAdd_var,100); doPacking(b,this->nextHop_var,100); doPacking(b,this->hopCount_var,100);}void update::netUnpack(cCommBuffer *b){ cMessage::netUnpack(b); doUnpacking(b,this->count_var); doUnpacking(b,this->thisAdd_var,100); doUnpacking(b,this->destAdd_var,100); doUnpacking(b,this->nextHop_var,100); doUnpacking(b,this->hopCount_var,100);}int update::getCount() const{ return count_var;}void update::setCount(int count_var){ this->count_var = count_var;}unsigned int update::getThisAddArraySize() const{ return 100;}int update::getThisAdd(unsigned int k) const{ if (k>=100) throw new cException("Array of size 100 indexed by %d", k); return thisAdd_var[k];}void update::setThisAdd(unsigned int k, int thisAdd_var){ if (k>=100) throw new cException("Array of size 100 indexed by %d", k); this->thisAdd_var[k] = thisAdd_var;}unsigned int update::getDestAddArraySize() const{ return 100;}int update::getDestAdd(unsigned int k) const{ if (k>=100) throw new cException("Array of size 100 indexed by %d", k); return destAdd_var[k];}void update::setDestAdd(unsigned int k, int destAdd_var){ if (k>=100) throw new cException("Array of size 100 indexed by %d", k); this->destAdd_var[k] = destAdd_var;}unsigned int update::getNextHopArraySize() const{ return 100;}int update::getNextHop(unsigned int k) const{ if (k>=100) throw new cException("Array of size 100 indexed by %d", k); return nextHop_var[k];}void update::setNextHop(unsigned int k, int nextHop_var){ if (k>=100) throw new cException("Array of size 100 indexed by %d", k); this->nextHop_var[k] = nextHop_var;}unsigned int update::getHopCountArraySize() const{ return 100;}int update::getHopCount(unsigned int k) const{ if (k>=100) throw new cException("Array of size 100 indexed by %d", k); return hopCount_var[k];}void update::setHopCount(unsigned int k, int hopCount_var){ if (k>=100) throw new cException("Array of size 100 indexed by %d", k); this->hopCount_var[k] = hopCount_var;}class updateDescriptor : public cStructDescriptor{ public: updateDescriptor(); virtual ~updateDescriptor(); updateDescriptor& operator=(const updateDescriptor& other); virtual cPolymorphic *dup() const {return new updateDescriptor(*this);} virtual int getFieldCount(); virtual const char *getFieldName(int field); virtual int getFieldType(int field); virtual const char *getFieldTypeString(int field); virtual const char *getFieldEnumName(int field); virtual int getArraySize(int field); virtual bool getFieldAsString(int field, int i, char *resultbuf, int bufsize); virtual bool setFieldAsString(int field, int i, const char *value); virtual const char *getFieldStructName(int field); virtual void *getFieldStructPointer(int field, int i); virtual sFieldWrapper *getFieldWrapper(int field, int i);};Register_Class(updateDescriptor);updateDescriptor::updateDescriptor() : cStructDescriptor("cMessage"){}updateDescriptor::~updateDescriptor(){}int updateDescriptor::getFieldCount(){ return baseclassdesc ? 5+baseclassdesc->getFieldCount() : 5;}int updateDescriptor::getFieldType(int field){ if (baseclassdesc) { if (field < baseclassdesc->getFieldCount()) return baseclassdesc->getFieldType(field); field -= baseclassdesc->getFieldCount(); } switch (field) { case 0: return FT_BASIC; case 1: return FT_BASIC_ARRAY; case 2: return FT_BASIC_ARRAY; case 3: return FT_BASIC_ARRAY; case 4: return FT_BASIC_ARRAY; default: return FT_INVALID; }}const char *updateDescriptor::getFieldName(int field){ if (baseclassdesc) { if (field < baseclassdesc->getFieldCount()) return baseclassdesc->getFieldName(field); field -= baseclassdesc->getFieldCount(); } switch (field) { case 0: return "count"; case 1: return "thisAdd"; case 2: return "destAdd"; case 3: return "nextHop"; case 4: return "hopCount"; default: return NULL; }}const char *updateDescriptor::getFieldTypeString(int field){ if (baseclassdesc) { if (field < baseclassdesc->getFieldCount()) return baseclassdesc->getFieldTypeString(field); field -= baseclassdesc->getFieldCount(); } switch (field) { case 0: return "int"; case 1: return "int"; case 2: return "int"; case 3: return "int"; case 4: return "int"; default: return NULL; }}const char *updateDescriptor::getFieldEnumName(int field){ if (baseclassdesc) { if (field < baseclassdesc->getFieldCount()) return baseclassdesc->getFieldEnumName(field); field -= baseclassdesc->getFieldCount(); } switch (field) { default: return NULL; }}int updateDescriptor::getArraySize(int field){ if (baseclassdesc) { if (field < baseclassdesc->getFieldCount()) return baseclassdesc->getArraySize(field); field -= baseclassdesc->getFieldCount(); } update *pp = (update *)p; switch (field) { case 1: return 100; case 2: return 100; case 3: return 100; case 4: return 100; default: return 0; }}bool updateDescriptor::getFieldAsString(int field, int i, char *resultbuf, int bufsize){ if (baseclassdesc) { if (field < baseclassdesc->getFieldCount()) return baseclassdesc->getFieldAsString(field,i,resultbuf,bufsize); field -= baseclassdesc->getFieldCount(); } update *pp = (update *)p; switch (field) { case 0: long2string(pp->getCount(),resultbuf,bufsize); return true; case 1: long2string(pp->getThisAdd(i),resultbuf,bufsize); return true; case 2: long2string(pp->getDestAdd(i),resultbuf,bufsize); return true; case 3: long2string(pp->getNextHop(i),resultbuf,bufsize); return true; case 4: long2string(pp->getHopCount(i),resultbuf,bufsize); return true; default: return false; }}bool updateDescriptor::setFieldAsString(int field, int i, const char *value){ if (baseclassdesc) { if (field < baseclassdesc->getFieldCount()) return baseclassdesc->setFieldAsString(field,i,value); field -= baseclassdesc->getFieldCount(); } update *pp = (update *)p; switch (field) { case 0: pp->setCount(string2long(value)); return true; case 1: pp->setThisAdd(i,string2long(value)); return true; case 2: pp->setDestAdd(i,string2long(value)); return true; case 3: pp->setNextHop(i,string2long(value)); return true; case 4: pp->setHopCount(i,string2long(value)); return true; default: return false; }}const char *updateDescriptor::getFieldStructName(int field){ if (baseclassdesc) { if (field < baseclassdesc->getFieldCount()) return baseclassdesc->getFieldStructName(field); field -= baseclassdesc->getFieldCount(); } switch (field) { default: return NULL; }}void *updateDescriptor::getFieldStructPointer(int field, int i){ if (baseclassdesc) { if (field < baseclassdesc->getFieldCount()) return baseclassdesc->getFieldStructPointer(field, i); field -= baseclassdesc->getFieldCount(); } update *pp = (update *)p; switch (field) { default: return NULL; }}sFieldWrapper *updateDescriptor::getFieldWrapper(int field, int i){ return NULL;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -