//
// Generated file, do not edit! Created by opp_msgc 4.1 from src/world/physicalProcess/wiseMovingTarget/WiseMovingTargetMessage.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 "WiseMovingTargetMessage_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)));
}




WiseTargetBoundingBox::WiseTargetBoundingBox()
{
    x_tl = 0;
    y_tl = 0;
    z_tl = 0;
    x_br = 0;
    y_br = 0;
    z_br = 0;
}

void doPacking(cCommBuffer *b, WiseTargetBoundingBox& a)
{
    doPacking(b,a.x_tl);
    doPacking(b,a.y_tl);
    doPacking(b,a.z_tl);
    doPacking(b,a.x_br);
    doPacking(b,a.y_br);
    doPacking(b,a.z_br);
}

void doUnpacking(cCommBuffer *b, WiseTargetBoundingBox& a)
{
    doUnpacking(b,a.x_tl);
    doUnpacking(b,a.y_tl);
    doUnpacking(b,a.z_tl);
    doUnpacking(b,a.x_br);
    doUnpacking(b,a.y_br);
    doUnpacking(b,a.z_br);
}

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

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

WiseTargetBoundingBoxDescriptor::WiseTargetBoundingBoxDescriptor() : cClassDescriptor("WiseTargetBoundingBox", "")
{
}

WiseTargetBoundingBoxDescriptor::~WiseTargetBoundingBoxDescriptor()
{
}

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

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

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

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

const char *WiseTargetBoundingBoxDescriptor::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[] = {
        "x_tl",
        "y_tl",
        "z_tl",
        "x_br",
        "y_br",
        "z_br",
    };
    return (field>=0 && field<6) ? fieldNames[field] : NULL;
}

int WiseTargetBoundingBoxDescriptor::findField(void *object, const char *fieldName) const
{
    cClassDescriptor *basedesc = getBaseClassDescriptor();
    int base = basedesc ? basedesc->getFieldCount(object) : 0;
    if (fieldName[0]=='x' && strcmp(fieldName, "x_tl")==0) return base+0;
    if (fieldName[0]=='y' && strcmp(fieldName, "y_tl")==0) return base+1;
    if (fieldName[0]=='z' && strcmp(fieldName, "z_tl")==0) return base+2;
    if (fieldName[0]=='x' && strcmp(fieldName, "x_br")==0) return base+3;
    if (fieldName[0]=='y' && strcmp(fieldName, "y_br")==0) return base+4;
    if (fieldName[0]=='z' && strcmp(fieldName, "z_br")==0) return base+5;
    return basedesc ? basedesc->findField(object, fieldName) : -1;
}

const char *WiseTargetBoundingBoxDescriptor::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",
        "double",
    };
    return (field>=0 && field<6) ? fieldTypeStrings[field] : NULL;
}

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

std::string WiseTargetBoundingBoxDescriptor::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);
    }
    WiseTargetBoundingBox *pp = (WiseTargetBoundingBox *)object; (void)pp;
    switch (field) {
        case 0: return double2string(pp->x_tl);
        case 1: return double2string(pp->y_tl);
        case 2: return double2string(pp->z_tl);
        case 3: return double2string(pp->x_br);
        case 4: return double2string(pp->y_br);
        case 5: return double2string(pp->z_br);
        default: return "";
    }
}

bool WiseTargetBoundingBoxDescriptor::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);
    }
    WiseTargetBoundingBox *pp = (WiseTargetBoundingBox *)object; (void)pp;
    switch (field) {
        case 0: pp->x_tl = string2double(value); return true;
        case 1: pp->y_tl = string2double(value); return true;
        case 2: pp->z_tl = string2double(value); return true;
        case 3: pp->x_br = string2double(value); return true;
        case 4: pp->y_br = string2double(value); return true;
        case 5: pp->z_br = string2double(value); return true;
        default: return false;
    }
}

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

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

Register_Class(WiseMovingTargetMessage);

WiseMovingTargetMessage::WiseMovingTargetMessage(const char *name, int kind) : WisePhysicalProcessMessage(name,kind)
{
    this->targetID_var = 0;
    this->visible_var = true;
}

WiseMovingTargetMessage::WiseMovingTargetMessage(const WiseMovingTargetMessage& other) : WisePhysicalProcessMessage()
{
    setName(other.getName());
    operator=(other);
}

WiseMovingTargetMessage::~WiseMovingTargetMessage()
{
}

WiseMovingTargetMessage& WiseMovingTargetMessage::operator=(const WiseMovingTargetMessage& other)
{
    if (this==&other) return *this;
    WisePhysicalProcessMessage::operator=(other);
    this->boundingBox_var = other.boundingBox_var;
    this->targetID_var = other.targetID_var;
    this->visible_var = other.visible_var;
    return *this;
}

void WiseMovingTargetMessage::parsimPack(cCommBuffer *b)
{
    WisePhysicalProcessMessage::parsimPack(b);
    doPacking(b,this->boundingBox_var);
    doPacking(b,this->targetID_var);
    doPacking(b,this->visible_var);
}

void WiseMovingTargetMessage::parsimUnpack(cCommBuffer *b)
{
    WisePhysicalProcessMessage::parsimUnpack(b);
    doUnpacking(b,this->boundingBox_var);
    doUnpacking(b,this->targetID_var);
    doUnpacking(b,this->visible_var);
}

WiseTargetBoundingBox& WiseMovingTargetMessage::getBoundingBox()
{
    return boundingBox_var;
}

void WiseMovingTargetMessage::setBoundingBox(const WiseTargetBoundingBox& boundingBox_var)
{
    this->boundingBox_var = boundingBox_var;
}

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

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

bool WiseMovingTargetMessage::getVisible() const
{
    return visible_var;
}

void WiseMovingTargetMessage::setVisible(bool visible_var)
{
    this->visible_var = visible_var;
}

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

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

WiseMovingTargetMessageDescriptor::WiseMovingTargetMessageDescriptor() : cClassDescriptor("WiseMovingTargetMessage", "WisePhysicalProcessMessage")
{
}

WiseMovingTargetMessageDescriptor::~WiseMovingTargetMessageDescriptor()
{
}

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

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

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

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

const char *WiseMovingTargetMessageDescriptor::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[] = {
        "boundingBox",
        "targetID",
        "visible",
    };
    return (field>=0 && field<3) ? fieldNames[field] : NULL;
}

int WiseMovingTargetMessageDescriptor::findField(void *object, const char *fieldName) const
{
    cClassDescriptor *basedesc = getBaseClassDescriptor();
    int base = basedesc ? basedesc->getFieldCount(object) : 0;
    if (fieldName[0]=='b' && strcmp(fieldName, "boundingBox")==0) return base+0;
    if (fieldName[0]=='t' && strcmp(fieldName, "targetID")==0) return base+1;
    if (fieldName[0]=='v' && strcmp(fieldName, "visible")==0) return base+2;
    return basedesc ? basedesc->findField(object, fieldName) : -1;
}

const char *WiseMovingTargetMessageDescriptor::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[] = {
        "WiseTargetBoundingBox",
        "unsigned int",
        "bool",
    };
    return (field>=0 && field<3) ? fieldTypeStrings[field] : NULL;
}

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

std::string WiseMovingTargetMessageDescriptor::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);
    }
    WiseMovingTargetMessage *pp = (WiseMovingTargetMessage *)object; (void)pp;
    switch (field) {
        case 0: {std::stringstream out; out << pp->getBoundingBox(); return out.str();}
        case 1: return ulong2string(pp->getTargetID());
        case 2: return bool2string(pp->getVisible());
        default: return "";
    }
}

bool WiseMovingTargetMessageDescriptor::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);
    }
    WiseMovingTargetMessage *pp = (WiseMovingTargetMessage *)object; (void)pp;
    switch (field) {
        case 1: pp->setTargetID(string2ulong(value)); return true;
        case 2: pp->setVisible(string2bool(value)); return true;
        default: return false;
    }
}

const char *WiseMovingTargetMessageDescriptor::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[] = {
        "WiseTargetBoundingBox",
        NULL,
        NULL,
    };
    return (field>=0 && field<3) ? fieldStructNames[field] : NULL;
}

void *WiseMovingTargetMessageDescriptor::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);
    }
    WiseMovingTargetMessage *pp = (WiseMovingTargetMessage *)object; (void)pp;
    switch (field) {
        case 0: return (void *)(&pp->getBoundingBox()); break;
        default: return NULL;
    }
}


