//
// Generated file, do not edit! Created by opp_msgc 4.1 from src/node/mobilityManager/MobilityManagerMessage.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 "MobilityManagerMessage_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 cRuntimeError("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 cRuntimeError("Parsim error: no doUnpacking() function for type %s or its base class (check .msg and _m.cc/h files!)",opp_typename(typeid(t)));
}




EXECUTE_ON_STARTUP(
    cEnum *e = cEnum::find("MobilityManagerMessageType");
    if (!e) enums.getInstance()->add(e = new cEnum("MobilityManagerMessageType"));
    e->insert(MOBILITY_PERIODIC, "MOBILITY_PERIODIC");
);

Register_Class(MobilityManagerMessage);

MobilityManagerMessage::MobilityManagerMessage(const char *name, int kind) : cMessage(name,kind)
{
    this->updateInterval_var = 0;
    this->xCoorDestination_var = 0;
    this->yCoorDestination_var = 0;
    this->zCoorDestination_var = 0;
    this->speed_var = 0;
}

MobilityManagerMessage::MobilityManagerMessage(const MobilityManagerMessage& other) : cMessage()
{
    setName(other.getName());
    operator=(other);
}

MobilityManagerMessage::~MobilityManagerMessage()
{
}

MobilityManagerMessage& MobilityManagerMessage::operator=(const MobilityManagerMessage& other)
{
    if (this==&other) return *this;
    cMessage::operator=(other);
    this->updateInterval_var = other.updateInterval_var;
    this->xCoorDestination_var = other.xCoorDestination_var;
    this->yCoorDestination_var = other.yCoorDestination_var;
    this->zCoorDestination_var = other.zCoorDestination_var;
    this->speed_var = other.speed_var;
    return *this;
}

void MobilityManagerMessage::parsimPack(cCommBuffer *b)
{
    cMessage::parsimPack(b);
    doPacking(b,this->updateInterval_var);
    doPacking(b,this->xCoorDestination_var);
    doPacking(b,this->yCoorDestination_var);
    doPacking(b,this->zCoorDestination_var);
    doPacking(b,this->speed_var);
}

void MobilityManagerMessage::parsimUnpack(cCommBuffer *b)
{
    cMessage::parsimUnpack(b);
    doUnpacking(b,this->updateInterval_var);
    doUnpacking(b,this->xCoorDestination_var);
    doUnpacking(b,this->yCoorDestination_var);
    doUnpacking(b,this->zCoorDestination_var);
    doUnpacking(b,this->speed_var);
}

double MobilityManagerMessage::getUpdateInterval() const
{
    return updateInterval_var;
}

void MobilityManagerMessage::setUpdateInterval(double updateInterval_var)
{
    this->updateInterval_var = updateInterval_var;
}

double MobilityManagerMessage::getXCoorDestination() const
{
    return xCoorDestination_var;
}

void MobilityManagerMessage::setXCoorDestination(double xCoorDestination_var)
{
    this->xCoorDestination_var = xCoorDestination_var;
}

double MobilityManagerMessage::getYCoorDestination() const
{
    return yCoorDestination_var;
}

void MobilityManagerMessage::setYCoorDestination(double yCoorDestination_var)
{
    this->yCoorDestination_var = yCoorDestination_var;
}

double MobilityManagerMessage::getZCoorDestination() const
{
    return zCoorDestination_var;
}

void MobilityManagerMessage::setZCoorDestination(double zCoorDestination_var)
{
    this->zCoorDestination_var = zCoorDestination_var;
}

double MobilityManagerMessage::getSpeed() const
{
    return speed_var;
}

void MobilityManagerMessage::setSpeed(double speed_var)
{
    this->speed_var = speed_var;
}

class MobilityManagerMessageDescriptor : public cClassDescriptor
{
  public:
    MobilityManagerMessageDescriptor();
    virtual ~MobilityManagerMessageDescriptor();

    virtual bool doesSupport(cObject *obj) const;
    virtual const char *getProperty(const char *propertyname) const;
    virtual int getFieldCount(void *object) const;
    virtual const char *getFieldName(void *object, int field) const;
    virtual int findField(void *object, const char *fieldName) const;
    virtual unsigned int getFieldTypeFlags(void *object, int field) const;
    virtual const char *getFieldTypeString(void *object, int field) const;
    virtual const char *getFieldProperty(void *object, int field, const char *propertyname) const;
    virtual int getArraySize(void *object, int field) const;

    virtual std::string getFieldAsString(void *object, int field, int i) const;
    virtual bool setFieldAsString(void *object, int field, int i, const char *value) const;

    virtual const char *getFieldStructName(void *object, int field) const;
    virtual void *getFieldStructPointer(void *object, int field, int i) const;
};

Register_ClassDescriptor(MobilityManagerMessageDescriptor);

MobilityManagerMessageDescriptor::MobilityManagerMessageDescriptor() : cClassDescriptor("MobilityManagerMessage", "cMessage")
{
}

MobilityManagerMessageDescriptor::~MobilityManagerMessageDescriptor()
{
}

bool MobilityManagerMessageDescriptor::doesSupport(cObject *obj) const
{
    return dynamic_cast<MobilityManagerMessage *>(obj)!=NULL;
}

const char *MobilityManagerMessageDescriptor::getProperty(const char *propertyname) const
{
    cClassDescriptor *basedesc = getBaseClassDescriptor();
    return basedesc ? basedesc->getProperty(propertyname) : NULL;
}

int MobilityManagerMessageDescriptor::getFieldCount(void *object) const
{
    cClassDescriptor *basedesc = getBaseClassDescriptor();
    return basedesc ? 5+basedesc->getFieldCount(object) : 5;
}

unsigned int MobilityManagerMessageDescriptor::getFieldTypeFlags(void *object, int field) const
{
    cClassDescriptor *basedesc = getBaseClassDescriptor();
    if (basedesc) {
        if (field < basedesc->getFieldCount(object))
            return basedesc->getFieldTypeFlags(object, field);
        field -= basedesc->getFieldCount(object);
    }
    static unsigned int fieldTypeFlags[] = {
        FD_ISEDITABLE,
        FD_ISEDITABLE,
        FD_ISEDITABLE,
        FD_ISEDITABLE,
        FD_ISEDITABLE,
    };
    return (field>=0 && field<5) ? fieldTypeFlags[field] : 0;
}

const char *MobilityManagerMessageDescriptor::getFieldName(void *object, int field) const
{
    cClassDescriptor *basedesc = getBaseClassDescriptor();
    if (basedesc) {
        if (field < basedesc->getFieldCount(object))
            return basedesc->getFieldName(object, field);
        field -= basedesc->getFieldCount(object);
    }
    static const char *fieldNames[] = {
        "updateInterval",
        "xCoorDestination",
        "yCoorDestination",
        "zCoorDestination",
        "speed",
    };
    return (field>=0 && field<5) ? fieldNames[field] : NULL;
}

int MobilityManagerMessageDescriptor::findField(void *object, const char *fieldName) const
{
    cClassDescriptor *basedesc = getBaseClassDescriptor();
    int base = basedesc ? basedesc->getFieldCount(object) : 0;
    if (fieldName[0]=='u' && strcmp(fieldName, "updateInterval")==0) return base+0;
    if (fieldName[0]=='x' && strcmp(fieldName, "xCoorDestination")==0) return base+1;
    if (fieldName[0]=='y' && strcmp(fieldName, "yCoorDestination")==0) return base+2;
    if (fieldName[0]=='z' && strcmp(fieldName, "zCoorDestination")==0) return base+3;
    if (fieldName[0]=='s' && strcmp(fieldName, "speed")==0) return base+4;
    return basedesc ? basedesc->findField(object, fieldName) : -1;
}

const char *MobilityManagerMessageDescriptor::getFieldTypeString(void *object, int field) const
{
    cClassDescriptor *basedesc = getBaseClassDescriptor();
    if (basedesc) {
        if (field < basedesc->getFieldCount(object))
            return basedesc->getFieldTypeString(object, field);
        field -= basedesc->getFieldCount(object);
    }
    static const char *fieldTypeStrings[] = {
        "double",
        "double",
        "double",
        "double",
        "double",
    };
    return (field>=0 && field<5) ? fieldTypeStrings[field] : NULL;
}

const char *MobilityManagerMessageDescriptor::getFieldProperty(void *object, int field, const char *propertyname) const
{
    cClassDescriptor *basedesc = getBaseClassDescriptor();
    if (basedesc) {
        if (field < basedesc->getFieldCount(object))
            return basedesc->getFieldProperty(object, field, propertyname);
        field -= basedesc->getFieldCount(object);
    }
    switch (field) {
        default: return NULL;
    }
}

int MobilityManagerMessageDescriptor::getArraySize(void *object, int field) const
{
    cClassDescriptor *basedesc = getBaseClassDescriptor();
    if (basedesc) {
        if (field < basedesc->getFieldCount(object))
            return basedesc->getArraySize(object, field);
        field -= basedesc->getFieldCount(object);
    }
    MobilityManagerMessage *pp = (MobilityManagerMessage *)object; (void)pp;
    switch (field) {
        default: return 0;
    }
}

std::string MobilityManagerMessageDescriptor::getFieldAsString(void *object, int field, int i) const
{
    cClassDescriptor *basedesc = getBaseClassDescriptor();
    if (basedesc) {
        if (field < basedesc->getFieldCount(object))
            return basedesc->getFieldAsString(object,field,i);
        field -= basedesc->getFieldCount(object);
    }
    MobilityManagerMessage *pp = (MobilityManagerMessage *)object; (void)pp;
    switch (field) {
        case 0: return double2string(pp->getUpdateInterval());
        case 1: return double2string(pp->getXCoorDestination());
        case 2: return double2string(pp->getYCoorDestination());
        case 3: return double2string(pp->getZCoorDestination());
        case 4: return double2string(pp->getSpeed());
        default: return "";
    }
}

bool MobilityManagerMessageDescriptor::setFieldAsString(void *object, int field, int i, const char *value) const
{
    cClassDescriptor *basedesc = getBaseClassDescriptor();
    if (basedesc) {
        if (field < basedesc->getFieldCount(object))
            return basedesc->setFieldAsString(object,field,i,value);
        field -= basedesc->getFieldCount(object);
    }
    MobilityManagerMessage *pp = (MobilityManagerMessage *)object; (void)pp;
    switch (field) {
        case 0: pp->setUpdateInterval(string2double(value)); return true;
        case 1: pp->setXCoorDestination(string2double(value)); return true;
        case 2: pp->setYCoorDestination(string2double(value)); return true;
        case 3: pp->setZCoorDestination(string2double(value)); return true;
        case 4: pp->setSpeed(string2double(value)); return true;
        default: return false;
    }
}

const char *MobilityManagerMessageDescriptor::getFieldStructName(void *object, int field) const
{
    cClassDescriptor *basedesc = getBaseClassDescriptor();
    if (basedesc) {
        if (field < basedesc->getFieldCount(object))
            return basedesc->getFieldStructName(object, field);
        field -= basedesc->getFieldCount(object);
    }
    static const char *fieldStructNames[] = {
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
    };
    return (field>=0 && field<5) ? fieldStructNames[field] : NULL;
}

void *MobilityManagerMessageDescriptor::getFieldStructPointer(void *object, int field, int i) const
{
    cClassDescriptor *basedesc = getBaseClassDescriptor();
    if (basedesc) {
        if (field < basedesc->getFieldCount(object))
            return basedesc->getFieldStructPointer(object, field, i);
        field -= basedesc->getFieldCount(object);
    }
    MobilityManagerMessage *pp = (MobilityManagerMessage *)object; (void)pp;
    switch (field) {
        default: return NULL;
    }
}


