//
// Generated file, do not edit! Created by opp_msgc 4.2 from src/node/application/wiseCameraTrackerTest/WiseCameraTrackerTestMessage.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 "WiseCameraTrackerTestMessage_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)));
}




Register_Class(WiseCameraTrackerTestMessage);

WiseCameraTrackerTestMessage::WiseCameraTrackerTestMessage(const char *name, int kind) : WiseApplicationPacket(name,kind)
{
    this->trackingStep_var = 0;
    this->targetID_var = 0;
    this->positionX_var = 0;
    this->positionY_var = 0;
}

WiseCameraTrackerTestMessage::WiseCameraTrackerTestMessage(const WiseCameraTrackerTestMessage& other) : WiseApplicationPacket(other)
{
    copy(other);
}

WiseCameraTrackerTestMessage::~WiseCameraTrackerTestMessage()
{
}

WiseCameraTrackerTestMessage& WiseCameraTrackerTestMessage::operator=(const WiseCameraTrackerTestMessage& other)
{
    if (this==&other) return *this;
    WiseApplicationPacket::operator=(other);
    copy(other);
    return *this;
}

void WiseCameraTrackerTestMessage::copy(const WiseCameraTrackerTestMessage& other)
{
    this->trackingStep_var = other.trackingStep_var;
    this->targetID_var = other.targetID_var;
    this->positionX_var = other.positionX_var;
    this->positionY_var = other.positionY_var;
}

void WiseCameraTrackerTestMessage::parsimPack(cCommBuffer *b)
{
    WiseApplicationPacket::parsimPack(b);
    doPacking(b,this->trackingStep_var);
    doPacking(b,this->targetID_var);
    doPacking(b,this->positionX_var);
    doPacking(b,this->positionY_var);
}

void WiseCameraTrackerTestMessage::parsimUnpack(cCommBuffer *b)
{
    WiseApplicationPacket::parsimUnpack(b);
    doUnpacking(b,this->trackingStep_var);
    doUnpacking(b,this->targetID_var);
    doUnpacking(b,this->positionX_var);
    doUnpacking(b,this->positionY_var);
}

unsigned long WiseCameraTrackerTestMessage::getTrackingStep() const
{
    return trackingStep_var;
}

void WiseCameraTrackerTestMessage::setTrackingStep(unsigned long trackingStep)
{
    this->trackingStep_var = trackingStep;
}

unsigned int WiseCameraTrackerTestMessage::getTargetID() const
{
    return targetID_var;
}

void WiseCameraTrackerTestMessage::setTargetID(unsigned int targetID)
{
    this->targetID_var = targetID;
}

double WiseCameraTrackerTestMessage::getPositionX() const
{
    return positionX_var;
}

void WiseCameraTrackerTestMessage::setPositionX(double positionX)
{
    this->positionX_var = positionX;
}

double WiseCameraTrackerTestMessage::getPositionY() const
{
    return positionY_var;
}

void WiseCameraTrackerTestMessage::setPositionY(double positionY)
{
    this->positionY_var = positionY;
}

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

    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(WiseCameraTrackerTestMessageDescriptor);

WiseCameraTrackerTestMessageDescriptor::WiseCameraTrackerTestMessageDescriptor() : cClassDescriptor("WiseCameraTrackerTestMessage", "WiseApplicationPacket")
{
}

WiseCameraTrackerTestMessageDescriptor::~WiseCameraTrackerTestMessageDescriptor()
{
}

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

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

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

unsigned int WiseCameraTrackerTestMessageDescriptor::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,
    };
    return (field>=0 && field<4) ? fieldTypeFlags[field] : 0;
}

const char *WiseCameraTrackerTestMessageDescriptor::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[] = {
        "trackingStep",
        "targetID",
        "positionX",
        "positionY",
    };
    return (field>=0 && field<4) ? fieldNames[field] : NULL;
}

int WiseCameraTrackerTestMessageDescriptor::findField(void *object, const char *fieldName) const
{
    cClassDescriptor *basedesc = getBaseClassDescriptor();
    int base = basedesc ? basedesc->getFieldCount(object) : 0;
    if (fieldName[0]=='t' && strcmp(fieldName, "trackingStep")==0) return base+0;
    if (fieldName[0]=='t' && strcmp(fieldName, "targetID")==0) return base+1;
    if (fieldName[0]=='p' && strcmp(fieldName, "positionX")==0) return base+2;
    if (fieldName[0]=='p' && strcmp(fieldName, "positionY")==0) return base+3;
    return basedesc ? basedesc->findField(object, fieldName) : -1;
}

const char *WiseCameraTrackerTestMessageDescriptor::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[] = {
        "unsigned long",
        "unsigned int",
        "double",
        "double",
    };
    return (field>=0 && field<4) ? fieldTypeStrings[field] : NULL;
}

const char *WiseCameraTrackerTestMessageDescriptor::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 WiseCameraTrackerTestMessageDescriptor::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);
    }
    WiseCameraTrackerTestMessage *pp = (WiseCameraTrackerTestMessage *)object; (void)pp;
    switch (field) {
        default: return 0;
    }
}

std::string WiseCameraTrackerTestMessageDescriptor::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);
    }
    WiseCameraTrackerTestMessage *pp = (WiseCameraTrackerTestMessage *)object; (void)pp;
    switch (field) {
        case 0: return ulong2string(pp->getTrackingStep());
        case 1: return ulong2string(pp->getTargetID());
        case 2: return double2string(pp->getPositionX());
        case 3: return double2string(pp->getPositionY());
        default: return "";
    }
}

bool WiseCameraTrackerTestMessageDescriptor::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);
    }
    WiseCameraTrackerTestMessage *pp = (WiseCameraTrackerTestMessage *)object; (void)pp;
    switch (field) {
        case 0: pp->setTrackingStep(string2ulong(value)); return true;
        case 1: pp->setTargetID(string2ulong(value)); return true;
        case 2: pp->setPositionX(string2double(value)); return true;
        case 3: pp->setPositionY(string2double(value)); return true;
        default: return false;
    }
}

const char *WiseCameraTrackerTestMessageDescriptor::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,
    };
    return (field>=0 && field<4) ? fieldStructNames[field] : NULL;
}

void *WiseCameraTrackerTestMessageDescriptor::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);
    }
    WiseCameraTrackerTestMessage *pp = (WiseCameraTrackerTestMessage *)object; (void)pp;
    switch (field) {
        default: return NULL;
    }
}


