// // Generated file, do not edit! Created by nedtool 5.4 from tictoc14.msg. // // Disable warnings about unused variables, empty switch stmts, etc: #ifdef _MSC_VER # pragma warning(disable:4101) # pragma warning(disable:4065) #endif #if defined(__clang__) # pragma clang diagnostic ignored "-Wshadow" # pragma clang diagnostic ignored "-Wconversion" # pragma clang diagnostic ignored "-Wunused-parameter" # pragma clang diagnostic ignored "-Wc++98-compat" # pragma clang diagnostic ignored "-Wunreachable-code-break" # pragma clang diagnostic ignored "-Wold-style-cast" #elif defined(__GNUC__) # pragma GCC diagnostic ignored "-Wshadow" # pragma GCC diagnostic ignored "-Wconversion" # pragma GCC diagnostic ignored "-Wunused-parameter" # pragma GCC diagnostic ignored "-Wold-style-cast" # pragma GCC diagnostic ignored "-Wsuggest-attribute=noreturn" # pragma GCC diagnostic ignored "-Wfloat-conversion" #endif #include #include #include #include "tictoc14_m.h" namespace omnetpp { // Template pack/unpack rules. They are declared *after* a1l type-specific pack functions for multiple reasons. // They are in the omnetpp namespace, to allow them to be found by argument-dependent lookup via the cCommBuffer argument // Packing/unpacking an std::vector template void doParsimPacking(omnetpp::cCommBuffer *buffer, const std::vector& v) { int n = v.size(); doParsimPacking(buffer, n); for (int i = 0; i < n; i++) doParsimPacking(buffer, v[i]); } template void doParsimUnpacking(omnetpp::cCommBuffer *buffer, std::vector& v) { int n; doParsimUnpacking(buffer, n); v.resize(n); for (int i = 0; i < n; i++) doParsimUnpacking(buffer, v[i]); } // Packing/unpacking an std::list template void doParsimPacking(omnetpp::cCommBuffer *buffer, const std::list& l) { doParsimPacking(buffer, (int)l.size()); for (typename std::list::const_iterator it = l.begin(); it != l.end(); ++it) doParsimPacking(buffer, (T&)*it); } template void doParsimUnpacking(omnetpp::cCommBuffer *buffer, std::list& l) { int n; doParsimUnpacking(buffer, n); for (int i = 0; i < n; i++) { l.push_back(T()); doParsimUnpacking(buffer, l.back()); } } // Packing/unpacking an std::set template void doParsimPacking(omnetpp::cCommBuffer *buffer, const std::set& s) { doParsimPacking(buffer, (int)s.size()); for (typename std::set::const_iterator it = s.begin(); it != s.end(); ++it) doParsimPacking(buffer, *it); } template void doParsimUnpacking(omnetpp::cCommBuffer *buffer, std::set& s) { int n; doParsimUnpacking(buffer, n); for (int i = 0; i < n; i++) { T x; doParsimUnpacking(buffer, x); s.insert(x); } } // Packing/unpacking an std::map template void doParsimPacking(omnetpp::cCommBuffer *buffer, const std::map& m) { doParsimPacking(buffer, (int)m.size()); for (typename std::map::const_iterator it = m.begin(); it != m.end(); ++it) { doParsimPacking(buffer, it->first); doParsimPacking(buffer, it->second); } } template void doParsimUnpacking(omnetpp::cCommBuffer *buffer, std::map& m) { int n; doParsimUnpacking(buffer, n); for (int i = 0; i < n; i++) { K k; V v; doParsimUnpacking(buffer, k); doParsimUnpacking(buffer, v); m[k] = v; } } // Default pack/unpack function for arrays template void doParsimArrayPacking(omnetpp::cCommBuffer *b, const T *t, int n) { for (int i = 0; i < n; i++) doParsimPacking(b, t[i]); } template void doParsimArrayUnpacking(omnetpp::cCommBuffer *b, T *t, int n) { for (int i = 0; i < n; i++) doParsimUnpacking(b, t[i]); } // Default rule to prevent compiler from choosing base class' doParsimPacking() function template void doParsimPacking(omnetpp::cCommBuffer *, const T& t) { throw omnetpp::cRuntimeError("Parsim error: No doParsimPacking() function for type %s", omnetpp::opp_typename(typeid(t))); } template void doParsimUnpacking(omnetpp::cCommBuffer *, T& t) { throw omnetpp::cRuntimeError("Parsim error: No doParsimUnpacking() function for type %s", omnetpp::opp_typename(typeid(t))); } } // namespace omnetpp namespace { template inline typename std::enable_if::value && std::is_base_of::value, void *>::type toVoidPtr(T* t) { return (void *)(static_cast(t)); } template inline typename std::enable_if::value && !std::is_base_of::value, void *>::type toVoidPtr(T* t) { return (void *)dynamic_cast(t); } template inline typename std::enable_if::value, void *>::type toVoidPtr(T* t) { return (void *)static_cast(t); } } // forward template std::ostream& operator<<(std::ostream& out, const std::vector& vec); // Template rule to generate operator<< for shared_ptr template inline std::ostream& operator<<(std::ostream& out,const std::shared_ptr& t) { return out << t.get(); } // Template rule which fires if a struct or class doesn't have operator<< template inline std::ostream& operator<<(std::ostream& out,const T&) {return out;} // operator<< for std::vector template inline std::ostream& operator<<(std::ostream& out, const std::vector& vec) { out.put('{'); for(typename std::vector::const_iterator it = vec.begin(); it != vec.end(); ++it) { if (it != vec.begin()) { out.put(','); out.put(' '); } out << *it; } out.put('}'); char buf[32]; sprintf(buf, " (size=%u)", (unsigned int)vec.size()); out.write(buf, strlen(buf)); return out; } Register_Class(TicTocMsg14) TicTocMsg14::TicTocMsg14(const char *name, short kind) : ::omnetpp::cMessage(name, kind) { } TicTocMsg14::TicTocMsg14(const TicTocMsg14& other) : ::omnetpp::cMessage(other) { copy(other); } TicTocMsg14::~TicTocMsg14() { } TicTocMsg14& TicTocMsg14::operator=(const TicTocMsg14& other) { if (this == &other) return *this; ::omnetpp::cMessage::operator=(other); copy(other); return *this; } void TicTocMsg14::copy(const TicTocMsg14& other) { this->source = other.source; this->destination = other.destination; this->hopCount = other.hopCount; } void TicTocMsg14::parsimPack(omnetpp::cCommBuffer *b) const { ::omnetpp::cMessage::parsimPack(b); doParsimPacking(b,this->source); doParsimPacking(b,this->destination); doParsimPacking(b,this->hopCount); } void TicTocMsg14::parsimUnpack(omnetpp::cCommBuffer *b) { ::omnetpp::cMessage::parsimUnpack(b); doParsimUnpacking(b,this->source); doParsimUnpacking(b,this->destination); doParsimUnpacking(b,this->hopCount); } int TicTocMsg14::getSource() const { return this->source; } void TicTocMsg14::setSource(int source) { this->source = source; } int TicTocMsg14::getDestination() const { return this->destination; } void TicTocMsg14::setDestination(int destination) { this->destination = destination; } int TicTocMsg14::getHopCount() const { return this->hopCount; } void TicTocMsg14::setHopCount(int hopCount) { this->hopCount = hopCount; } class TicTocMsg14Descriptor : public omnetpp::cClassDescriptor { private: mutable const char **propertynames; enum FieldConstants { FIELD_source, FIELD_destination, FIELD_hopCount, }; public: TicTocMsg14Descriptor(); virtual ~TicTocMsg14Descriptor(); virtual bool doesSupport(omnetpp::cObject *obj) const override; virtual const char **getPropertyNames() const override; virtual const char *getProperty(const char *propertyname) const override; virtual int getFieldCount() const override; virtual const char *getFieldName(int field) const override; virtual int findField(const char *fieldName) const override; virtual unsigned int getFieldTypeFlags(int field) const override; virtual const char *getFieldTypeString(int field) const override; virtual const char **getFieldPropertyNames(int field) const override; virtual const char *getFieldProperty(int field, const char *propertyname) const override; virtual int getFieldArraySize(void *object, int field) const override; virtual const char *getFieldDynamicTypeString(void *object, int field, int i) const override; virtual std::string getFieldValueAsString(void *object, int field, int i) const override; virtual bool setFieldValueAsString(void *object, int field, int i, const char *value) const override; virtual const char *getFieldStructName(int field) const override; virtual void *getFieldStructValuePointer(void *object, int field, int i) const override; }; Register_ClassDescriptor(TicTocMsg14Descriptor) TicTocMsg14Descriptor::TicTocMsg14Descriptor() : omnetpp::cClassDescriptor(omnetpp::opp_typename(typeid(TicTocMsg14)), "omnetpp::cMessage") { propertynames = nullptr; } TicTocMsg14Descriptor::~TicTocMsg14Descriptor() { delete[] propertynames; } bool TicTocMsg14Descriptor::doesSupport(omnetpp::cObject *obj) const { return dynamic_cast(obj)!=nullptr; } const char **TicTocMsg14Descriptor::getPropertyNames() const { if (!propertynames) { static const char *names[] = { nullptr }; omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); const char **basenames = basedesc ? basedesc->getPropertyNames() : nullptr; propertynames = mergeLists(basenames, names); } return propertynames; } const char *TicTocMsg14Descriptor::getProperty(const char *propertyname) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); return basedesc ? basedesc->getProperty(propertyname) : nullptr; } int TicTocMsg14Descriptor::getFieldCount() const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); return basedesc ? 3+basedesc->getFieldCount() : 3; } unsigned int TicTocMsg14Descriptor::getFieldTypeFlags(int field) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldTypeFlags(field); field -= basedesc->getFieldCount(); } static unsigned int fieldTypeFlags[] = { FD_ISEDITABLE, // FIELD_source FD_ISEDITABLE, // FIELD_destination FD_ISEDITABLE, // FIELD_hopCount }; return (field >= 0 && field < 3) ? fieldTypeFlags[field] : 0; } const char *TicTocMsg14Descriptor::getFieldName(int field) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldName(field); field -= basedesc->getFieldCount(); } static const char *fieldNames[] = { "source", "destination", "hopCount", }; return (field >= 0 && field < 3) ? fieldNames[field] : nullptr; } int TicTocMsg14Descriptor::findField(const char *fieldName) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); int base = basedesc ? basedesc->getFieldCount() : 0; if (fieldName[0] == 's' && strcmp(fieldName, "source") == 0) return base+0; if (fieldName[0] == 'd' && strcmp(fieldName, "destination") == 0) return base+1; if (fieldName[0] == 'h' && strcmp(fieldName, "hopCount") == 0) return base+2; return basedesc ? basedesc->findField(fieldName) : -1; } const char *TicTocMsg14Descriptor::getFieldTypeString(int field) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldTypeString(field); field -= basedesc->getFieldCount(); } static const char *fieldTypeStrings[] = { "int", // FIELD_source "int", // FIELD_destination "int", // FIELD_hopCount }; return (field >= 0 && field < 3) ? fieldTypeStrings[field] : nullptr; } const char **TicTocMsg14Descriptor::getFieldPropertyNames(int field) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldPropertyNames(field); field -= basedesc->getFieldCount(); } switch (field) { default: return nullptr; } } const char *TicTocMsg14Descriptor::getFieldProperty(int field, const char *propertyname) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldProperty(field, propertyname); field -= basedesc->getFieldCount(); } switch (field) { default: return nullptr; } } int TicTocMsg14Descriptor::getFieldArraySize(void *object, int field) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldArraySize(object, field); field -= basedesc->getFieldCount(); } TicTocMsg14 *pp = (TicTocMsg14 *)object; (void)pp; switch (field) { default: return 0; } } const char *TicTocMsg14Descriptor::getFieldDynamicTypeString(void *object, int field, int i) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldDynamicTypeString(object,field,i); field -= basedesc->getFieldCount(); } TicTocMsg14 *pp = (TicTocMsg14 *)object; (void)pp; switch (field) { default: return nullptr; } } std::string TicTocMsg14Descriptor::getFieldValueAsString(void *object, int field, int i) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldValueAsString(object,field,i); field -= basedesc->getFieldCount(); } TicTocMsg14 *pp = (TicTocMsg14 *)object; (void)pp; switch (field) { case FIELD_source: return long2string(pp->getSource()); case FIELD_destination: return long2string(pp->getDestination()); case FIELD_hopCount: return long2string(pp->getHopCount()); default: return ""; } } bool TicTocMsg14Descriptor::setFieldValueAsString(void *object, int field, int i, const char *value) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->setFieldValueAsString(object,field,i,value); field -= basedesc->getFieldCount(); } TicTocMsg14 *pp = (TicTocMsg14 *)object; (void)pp; switch (field) { case FIELD_source: pp->setSource(string2long(value)); return true; case FIELD_destination: pp->setDestination(string2long(value)); return true; case FIELD_hopCount: pp->setHopCount(string2long(value)); return true; default: return false; } } const char *TicTocMsg14Descriptor::getFieldStructName(int field) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldStructName(field); field -= basedesc->getFieldCount(); } switch (field) { default: return nullptr; }; } void *TicTocMsg14Descriptor::getFieldStructValuePointer(void *object, int field, int i) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldStructValuePointer(object, field, i); field -= basedesc->getFieldCount(); } TicTocMsg14 *pp = (TicTocMsg14 *)object; (void)pp; switch (field) { default: return nullptr; } }