new_Connection_Id_m.cc 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  1. //
  2. // Generated file, do not edit! Created by nedtool 5.2 from Frames/new_Connection_Id.msg.
  3. //
  4. // Disable warnings about unused variables, empty switch stmts, etc:
  5. #ifdef _MSC_VER
  6. # pragma warning(disable:4101)
  7. # pragma warning(disable:4065)
  8. #endif
  9. #if defined(__clang__)
  10. # pragma clang diagnostic ignored "-Wshadow"
  11. # pragma clang diagnostic ignored "-Wconversion"
  12. # pragma clang diagnostic ignored "-Wunused-parameter"
  13. # pragma clang diagnostic ignored "-Wc++98-compat"
  14. # pragma clang diagnostic ignored "-Wunreachable-code-break"
  15. # pragma clang diagnostic ignored "-Wold-style-cast"
  16. #elif defined(__GNUC__)
  17. # pragma GCC diagnostic ignored "-Wshadow"
  18. # pragma GCC diagnostic ignored "-Wconversion"
  19. # pragma GCC diagnostic ignored "-Wunused-parameter"
  20. # pragma GCC diagnostic ignored "-Wold-style-cast"
  21. # pragma GCC diagnostic ignored "-Wsuggest-attribute=noreturn"
  22. # pragma GCC diagnostic ignored "-Wfloat-conversion"
  23. #endif
  24. #include <iostream>
  25. #include <sstream>
  26. #include "new_Connection_Id_m.h"
  27. namespace omnetpp {
  28. // Template pack/unpack rules. They are declared *after* a1l type-specific pack functions for multiple reasons.
  29. // They are in the omnetpp namespace, to allow them to be found by argument-dependent lookup via the cCommBuffer argument
  30. // Packing/unpacking an std::vector
  31. template<typename T, typename A>
  32. void doParsimPacking(omnetpp::cCommBuffer *buffer, const std::vector<T,A>& v)
  33. {
  34. int n = v.size();
  35. doParsimPacking(buffer, n);
  36. for (int i = 0; i < n; i++)
  37. doParsimPacking(buffer, v[i]);
  38. }
  39. template<typename T, typename A>
  40. void doParsimUnpacking(omnetpp::cCommBuffer *buffer, std::vector<T,A>& v)
  41. {
  42. int n;
  43. doParsimUnpacking(buffer, n);
  44. v.resize(n);
  45. for (int i = 0; i < n; i++)
  46. doParsimUnpacking(buffer, v[i]);
  47. }
  48. // Packing/unpacking an std::list
  49. template<typename T, typename A>
  50. void doParsimPacking(omnetpp::cCommBuffer *buffer, const std::list<T,A>& l)
  51. {
  52. doParsimPacking(buffer, (int)l.size());
  53. for (typename std::list<T,A>::const_iterator it = l.begin(); it != l.end(); ++it)
  54. doParsimPacking(buffer, (T&)*it);
  55. }
  56. template<typename T, typename A>
  57. void doParsimUnpacking(omnetpp::cCommBuffer *buffer, std::list<T,A>& l)
  58. {
  59. int n;
  60. doParsimUnpacking(buffer, n);
  61. for (int i=0; i<n; i++) {
  62. l.push_back(T());
  63. doParsimUnpacking(buffer, l.back());
  64. }
  65. }
  66. // Packing/unpacking an std::set
  67. template<typename T, typename Tr, typename A>
  68. void doParsimPacking(omnetpp::cCommBuffer *buffer, const std::set<T,Tr,A>& s)
  69. {
  70. doParsimPacking(buffer, (int)s.size());
  71. for (typename std::set<T,Tr,A>::const_iterator it = s.begin(); it != s.end(); ++it)
  72. doParsimPacking(buffer, *it);
  73. }
  74. template<typename T, typename Tr, typename A>
  75. void doParsimUnpacking(omnetpp::cCommBuffer *buffer, std::set<T,Tr,A>& s)
  76. {
  77. int n;
  78. doParsimUnpacking(buffer, n);
  79. for (int i=0; i<n; i++) {
  80. T x;
  81. doParsimUnpacking(buffer, x);
  82. s.insert(x);
  83. }
  84. }
  85. // Packing/unpacking an std::map
  86. template<typename K, typename V, typename Tr, typename A>
  87. void doParsimPacking(omnetpp::cCommBuffer *buffer, const std::map<K,V,Tr,A>& m)
  88. {
  89. doParsimPacking(buffer, (int)m.size());
  90. for (typename std::map<K,V,Tr,A>::const_iterator it = m.begin(); it != m.end(); ++it) {
  91. doParsimPacking(buffer, it->first);
  92. doParsimPacking(buffer, it->second);
  93. }
  94. }
  95. template<typename K, typename V, typename Tr, typename A>
  96. void doParsimUnpacking(omnetpp::cCommBuffer *buffer, std::map<K,V,Tr,A>& m)
  97. {
  98. int n;
  99. doParsimUnpacking(buffer, n);
  100. for (int i=0; i<n; i++) {
  101. K k; V v;
  102. doParsimUnpacking(buffer, k);
  103. doParsimUnpacking(buffer, v);
  104. m[k] = v;
  105. }
  106. }
  107. // Default pack/unpack function for arrays
  108. template<typename T>
  109. void doParsimArrayPacking(omnetpp::cCommBuffer *b, const T *t, int n)
  110. {
  111. for (int i = 0; i < n; i++)
  112. doParsimPacking(b, t[i]);
  113. }
  114. template<typename T>
  115. void doParsimArrayUnpacking(omnetpp::cCommBuffer *b, T *t, int n)
  116. {
  117. for (int i = 0; i < n; i++)
  118. doParsimUnpacking(b, t[i]);
  119. }
  120. // Default rule to prevent compiler from choosing base class' doParsimPacking() function
  121. template<typename T>
  122. void doParsimPacking(omnetpp::cCommBuffer *, const T& t)
  123. {
  124. throw omnetpp::cRuntimeError("Parsim error: No doParsimPacking() function for type %s", omnetpp::opp_typename(typeid(t)));
  125. }
  126. template<typename T>
  127. void doParsimUnpacking(omnetpp::cCommBuffer *, T& t)
  128. {
  129. throw omnetpp::cRuntimeError("Parsim error: No doParsimUnpacking() function for type %s", omnetpp::opp_typename(typeid(t)));
  130. }
  131. } // namespace omnetpp
  132. // forward
  133. template<typename T, typename A>
  134. std::ostream& operator<<(std::ostream& out, const std::vector<T,A>& vec);
  135. // Template rule which fires if a struct or class doesn't have operator<<
  136. template<typename T>
  137. inline std::ostream& operator<<(std::ostream& out,const T&) {return out;}
  138. // operator<< for std::vector<T>
  139. template<typename T, typename A>
  140. inline std::ostream& operator<<(std::ostream& out, const std::vector<T,A>& vec)
  141. {
  142. out.put('{');
  143. for(typename std::vector<T,A>::const_iterator it = vec.begin(); it != vec.end(); ++it)
  144. {
  145. if (it != vec.begin()) {
  146. out.put(','); out.put(' ');
  147. }
  148. out << *it;
  149. }
  150. out.put('}');
  151. char buf[32];
  152. sprintf(buf, " (size=%u)", (unsigned int)vec.size());
  153. out.write(buf, strlen(buf));
  154. return out;
  155. }
  156. Register_Class(New_Connection_Id)
  157. New_Connection_Id::New_Connection_Id() : ::omnetpp::cObject()
  158. {
  159. this->type = 11;
  160. this->sequence = 0;
  161. this->connection_Id = 0;
  162. }
  163. New_Connection_Id::New_Connection_Id(const New_Connection_Id& other) : ::omnetpp::cObject(other)
  164. {
  165. copy(other);
  166. }
  167. New_Connection_Id::~New_Connection_Id()
  168. {
  169. }
  170. New_Connection_Id& New_Connection_Id::operator=(const New_Connection_Id& other)
  171. {
  172. if (this==&other) return *this;
  173. ::omnetpp::cObject::operator=(other);
  174. copy(other);
  175. return *this;
  176. }
  177. void New_Connection_Id::copy(const New_Connection_Id& other)
  178. {
  179. this->type = other.type;
  180. this->sequence = other.sequence;
  181. this->connection_Id = other.connection_Id;
  182. this->stateless_Reset_Token = other.stateless_Reset_Token;
  183. }
  184. void New_Connection_Id::parsimPack(omnetpp::cCommBuffer *b) const
  185. {
  186. doParsimPacking(b,this->type);
  187. doParsimPacking(b,this->sequence);
  188. doParsimPacking(b,this->connection_Id);
  189. doParsimPacking(b,this->stateless_Reset_Token);
  190. }
  191. void New_Connection_Id::parsimUnpack(omnetpp::cCommBuffer *b)
  192. {
  193. doParsimUnpacking(b,this->type);
  194. doParsimUnpacking(b,this->sequence);
  195. doParsimUnpacking(b,this->connection_Id);
  196. doParsimUnpacking(b,this->stateless_Reset_Token);
  197. }
  198. uint8_t New_Connection_Id::getType() const
  199. {
  200. return this->type;
  201. }
  202. void New_Connection_Id::setType(uint8_t type)
  203. {
  204. this->type = type;
  205. }
  206. uint16_t New_Connection_Id::getSequence() const
  207. {
  208. return this->sequence;
  209. }
  210. void New_Connection_Id::setSequence(uint16_t sequence)
  211. {
  212. this->sequence = sequence;
  213. }
  214. uint64_t New_Connection_Id::getConnection_Id() const
  215. {
  216. return this->connection_Id;
  217. }
  218. void New_Connection_Id::setConnection_Id(uint64_t connection_Id)
  219. {
  220. this->connection_Id = connection_Id;
  221. }
  222. SRT& New_Connection_Id::getStateless_Reset_Token()
  223. {
  224. return this->stateless_Reset_Token;
  225. }
  226. void New_Connection_Id::setStateless_Reset_Token(const SRT& stateless_Reset_Token)
  227. {
  228. this->stateless_Reset_Token = stateless_Reset_Token;
  229. }
  230. class New_Connection_IdDescriptor : public omnetpp::cClassDescriptor
  231. {
  232. private:
  233. mutable const char **propertynames;
  234. public:
  235. New_Connection_IdDescriptor();
  236. virtual ~New_Connection_IdDescriptor();
  237. virtual bool doesSupport(omnetpp::cObject *obj) const override;
  238. virtual const char **getPropertyNames() const override;
  239. virtual const char *getProperty(const char *propertyname) const override;
  240. virtual int getFieldCount() const override;
  241. virtual const char *getFieldName(int field) const override;
  242. virtual int findField(const char *fieldName) const override;
  243. virtual unsigned int getFieldTypeFlags(int field) const override;
  244. virtual const char *getFieldTypeString(int field) const override;
  245. virtual const char **getFieldPropertyNames(int field) const override;
  246. virtual const char *getFieldProperty(int field, const char *propertyname) const override;
  247. virtual int getFieldArraySize(void *object, int field) const override;
  248. virtual const char *getFieldDynamicTypeString(void *object, int field, int i) const override;
  249. virtual std::string getFieldValueAsString(void *object, int field, int i) const override;
  250. virtual bool setFieldValueAsString(void *object, int field, int i, const char *value) const override;
  251. virtual const char *getFieldStructName(int field) const override;
  252. virtual void *getFieldStructValuePointer(void *object, int field, int i) const override;
  253. };
  254. Register_ClassDescriptor(New_Connection_IdDescriptor)
  255. New_Connection_IdDescriptor::New_Connection_IdDescriptor() : omnetpp::cClassDescriptor("New_Connection_Id", "omnetpp::cObject")
  256. {
  257. propertynames = nullptr;
  258. }
  259. New_Connection_IdDescriptor::~New_Connection_IdDescriptor()
  260. {
  261. delete[] propertynames;
  262. }
  263. bool New_Connection_IdDescriptor::doesSupport(omnetpp::cObject *obj) const
  264. {
  265. return dynamic_cast<New_Connection_Id *>(obj)!=nullptr;
  266. }
  267. const char **New_Connection_IdDescriptor::getPropertyNames() const
  268. {
  269. if (!propertynames) {
  270. static const char *names[] = { nullptr };
  271. omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor();
  272. const char **basenames = basedesc ? basedesc->getPropertyNames() : nullptr;
  273. propertynames = mergeLists(basenames, names);
  274. }
  275. return propertynames;
  276. }
  277. const char *New_Connection_IdDescriptor::getProperty(const char *propertyname) const
  278. {
  279. omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor();
  280. return basedesc ? basedesc->getProperty(propertyname) : nullptr;
  281. }
  282. int New_Connection_IdDescriptor::getFieldCount() const
  283. {
  284. omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor();
  285. return basedesc ? 4+basedesc->getFieldCount() : 4;
  286. }
  287. unsigned int New_Connection_IdDescriptor::getFieldTypeFlags(int field) const
  288. {
  289. omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor();
  290. if (basedesc) {
  291. if (field < basedesc->getFieldCount())
  292. return basedesc->getFieldTypeFlags(field);
  293. field -= basedesc->getFieldCount();
  294. }
  295. static unsigned int fieldTypeFlags[] = {
  296. FD_ISEDITABLE,
  297. FD_ISEDITABLE,
  298. FD_ISEDITABLE,
  299. FD_ISCOMPOUND,
  300. };
  301. return (field>=0 && field<4) ? fieldTypeFlags[field] : 0;
  302. }
  303. const char *New_Connection_IdDescriptor::getFieldName(int field) const
  304. {
  305. omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor();
  306. if (basedesc) {
  307. if (field < basedesc->getFieldCount())
  308. return basedesc->getFieldName(field);
  309. field -= basedesc->getFieldCount();
  310. }
  311. static const char *fieldNames[] = {
  312. "type",
  313. "sequence",
  314. "connection_Id",
  315. "stateless_Reset_Token",
  316. };
  317. return (field>=0 && field<4) ? fieldNames[field] : nullptr;
  318. }
  319. int New_Connection_IdDescriptor::findField(const char *fieldName) const
  320. {
  321. omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor();
  322. int base = basedesc ? basedesc->getFieldCount() : 0;
  323. if (fieldName[0]=='t' && strcmp(fieldName, "type")==0) return base+0;
  324. if (fieldName[0]=='s' && strcmp(fieldName, "sequence")==0) return base+1;
  325. if (fieldName[0]=='c' && strcmp(fieldName, "connection_Id")==0) return base+2;
  326. if (fieldName[0]=='s' && strcmp(fieldName, "stateless_Reset_Token")==0) return base+3;
  327. return basedesc ? basedesc->findField(fieldName) : -1;
  328. }
  329. const char *New_Connection_IdDescriptor::getFieldTypeString(int field) const
  330. {
  331. omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor();
  332. if (basedesc) {
  333. if (field < basedesc->getFieldCount())
  334. return basedesc->getFieldTypeString(field);
  335. field -= basedesc->getFieldCount();
  336. }
  337. static const char *fieldTypeStrings[] = {
  338. "uint8_t",
  339. "uint16_t",
  340. "uint64_t",
  341. "SRT",
  342. };
  343. return (field>=0 && field<4) ? fieldTypeStrings[field] : nullptr;
  344. }
  345. const char **New_Connection_IdDescriptor::getFieldPropertyNames(int field) const
  346. {
  347. omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor();
  348. if (basedesc) {
  349. if (field < basedesc->getFieldCount())
  350. return basedesc->getFieldPropertyNames(field);
  351. field -= basedesc->getFieldCount();
  352. }
  353. switch (field) {
  354. default: return nullptr;
  355. }
  356. }
  357. const char *New_Connection_IdDescriptor::getFieldProperty(int field, const char *propertyname) const
  358. {
  359. omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor();
  360. if (basedesc) {
  361. if (field < basedesc->getFieldCount())
  362. return basedesc->getFieldProperty(field, propertyname);
  363. field -= basedesc->getFieldCount();
  364. }
  365. switch (field) {
  366. default: return nullptr;
  367. }
  368. }
  369. int New_Connection_IdDescriptor::getFieldArraySize(void *object, int field) const
  370. {
  371. omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor();
  372. if (basedesc) {
  373. if (field < basedesc->getFieldCount())
  374. return basedesc->getFieldArraySize(object, field);
  375. field -= basedesc->getFieldCount();
  376. }
  377. New_Connection_Id *pp = (New_Connection_Id *)object; (void)pp;
  378. switch (field) {
  379. default: return 0;
  380. }
  381. }
  382. const char *New_Connection_IdDescriptor::getFieldDynamicTypeString(void *object, int field, int i) const
  383. {
  384. omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor();
  385. if (basedesc) {
  386. if (field < basedesc->getFieldCount())
  387. return basedesc->getFieldDynamicTypeString(object,field,i);
  388. field -= basedesc->getFieldCount();
  389. }
  390. New_Connection_Id *pp = (New_Connection_Id *)object; (void)pp;
  391. switch (field) {
  392. default: return nullptr;
  393. }
  394. }
  395. std::string New_Connection_IdDescriptor::getFieldValueAsString(void *object, int field, int i) const
  396. {
  397. omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor();
  398. if (basedesc) {
  399. if (field < basedesc->getFieldCount())
  400. return basedesc->getFieldValueAsString(object,field,i);
  401. field -= basedesc->getFieldCount();
  402. }
  403. New_Connection_Id *pp = (New_Connection_Id *)object; (void)pp;
  404. switch (field) {
  405. case 0: return ulong2string(pp->getType());
  406. case 1: return ulong2string(pp->getSequence());
  407. case 2: return uint642string(pp->getConnection_Id());
  408. case 3: {std::stringstream out; out << pp->getStateless_Reset_Token(); return out.str();}
  409. default: return "";
  410. }
  411. }
  412. bool New_Connection_IdDescriptor::setFieldValueAsString(void *object, int field, int i, const char *value) const
  413. {
  414. omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor();
  415. if (basedesc) {
  416. if (field < basedesc->getFieldCount())
  417. return basedesc->setFieldValueAsString(object,field,i,value);
  418. field -= basedesc->getFieldCount();
  419. }
  420. New_Connection_Id *pp = (New_Connection_Id *)object; (void)pp;
  421. switch (field) {
  422. case 0: pp->setType(string2ulong(value)); return true;
  423. case 1: pp->setSequence(string2ulong(value)); return true;
  424. case 2: pp->setConnection_Id(string2uint64(value)); return true;
  425. default: return false;
  426. }
  427. }
  428. const char *New_Connection_IdDescriptor::getFieldStructName(int field) const
  429. {
  430. omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor();
  431. if (basedesc) {
  432. if (field < basedesc->getFieldCount())
  433. return basedesc->getFieldStructName(field);
  434. field -= basedesc->getFieldCount();
  435. }
  436. switch (field) {
  437. case 3: return omnetpp::opp_typename(typeid(SRT));
  438. default: return nullptr;
  439. };
  440. }
  441. void *New_Connection_IdDescriptor::getFieldStructValuePointer(void *object, int field, int i) const
  442. {
  443. omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor();
  444. if (basedesc) {
  445. if (field < basedesc->getFieldCount())
  446. return basedesc->getFieldStructValuePointer(object, field, i);
  447. field -= basedesc->getFieldCount();
  448. }
  449. New_Connection_Id *pp = (New_Connection_Id *)object; (void)pp;
  450. switch (field) {
  451. case 3: return (void *)(&pp->getStateless_Reset_Token()); break;
  452. default: return nullptr;
  453. }
  454. }