⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cprobemsg_m.cpp

📁 simulation routing in wsn
💻 CPP
字号:
//
// Generated file, do not edit! Created by opp_msgc.
//

// Disable warnings about unused variables, empty switch stmts, etc:
#ifdef _MSC_VER
#  pragma warning(disable:4101)
#  pragma warning(disable:4065)
#endif

#include "cProbeMsg_m.h"

Register_Class(packet);

packet::packet(const char *name, int kind) : cMessage(name,kind)
{
    unsigned int i;
    this->pdelay = 0;
    this->snode = 0;
    this->dnode = 0;
    this->hops = 0;
    for (i=0; i<14; i++)
        this->nextnode[i] = 0;
}

packet::packet(const packet& other) : cMessage()
{
    unsigned int i;
    setName(other.name());
    operator=(other);
}

packet::~packet()
{
}

packet& packet::operator=(const packet& other)
{
    if (this==&other) return *this;
    unsigned int i;
    cMessage::operator=(other);
    this->pdelay = other.pdelay;
    this->snode = other.snode;
    this->dnode = other.dnode;
    this->hops = other.hops;
    for (i=0; i<14; i++)
        this->nextnode[i] = other.nextnode[i];
    return *this;
}

double packet::getPdelay() const
{
    return pdelay;
}

void packet::setPdelay(double pdelay)
{
    this->pdelay = pdelay;
}

int packet::getSnode() const
{
    return snode;
}

void packet::setSnode(int snode)
{
    this->snode = snode;
}

int packet::getDnode() const
{
    return dnode;
}

void packet::setDnode(int dnode)
{
    this->dnode = dnode;
}

int packet::getHops() const
{
    return hops;
}

void packet::setHops(int hops)
{
    this->hops = hops;
}

unsigned int packet::getNextnodeArraySize() const
{
    return 14;
}

int packet::getNextnode(unsigned int k) const
{
    if (k>=14) throw new cException("Array of size 14 indexed by %d", k);
    return nextnode[k];
}

void packet::setNextnode(unsigned int k, int nextnode)
{
    if (k>=14) throw new cException("Array of size 14 indexed by %d", k);
    this->nextnode[k] = nextnode;
}

class packetDescriptor : public cStructDescriptor
{
  public:
    packetDescriptor(void *p=NULL);
    virtual ~packetDescriptor();
    packetDescriptor& operator=(const packetDescriptor& other);
    virtual cObject *dup() const {return new packetDescriptor(*this);}

    virtual int getFieldCount();
    virtual const char *getFieldName(int field);
    virtual int getFieldType(int field);
    virtual const char *getFieldTypeString(int field);
    virtual const char *getFieldEnumName(int field);
    virtual int getArraySize(int field);

    virtual bool getFieldAsString(int field, int i, char *resultbuf, int bufsize);
    virtual bool setFieldAsString(int field, int i, const char *value);

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

Register_Class(packetDescriptor);

packetDescriptor::packetDescriptor(void *p) : cStructDescriptor(p)
{
}

packetDescriptor::~packetDescriptor()
{
}

int packetDescriptor::getFieldCount()
{
    return 5;
}

int packetDescriptor::getFieldType(int field)
{
    switch (field) {
        case 0: return FT_BASIC;
        case 1: return FT_BASIC;
        case 2: return FT_BASIC;
        case 3: return FT_BASIC;
        case 4: return FT_BASIC_ARRAY;
        default: return FT_INVALID;
    }
}

const char *packetDescriptor::getFieldName(int field)
{
    switch (field) {
        case 0: return "pdelay";
        case 1: return "snode";
        case 2: return "dnode";
        case 3: return "hops";
        case 4: return "nextnode";
        default: return NULL;
    }
}

const char *packetDescriptor::getFieldTypeString(int field)
{
    switch (field) {
        case 0: return "double";
        case 1: return "int";
        case 2: return "int";
        case 3: return "int";
        case 4: return "int";
        default: return NULL;
    }
}

const char *packetDescriptor::getFieldEnumName(int field)
{
    switch (field) {
        default: return NULL;
    }
}

int packetDescriptor::getArraySize(int field)
{
    packet *pp = (packet *)p;
    switch (field) {
        case 4: return 14;
        default: return 0;
    }
}

bool packetDescriptor::getFieldAsString(int field, int i, char *resultbuf, int bufsize)
{
    packet *pp = (packet *)p;
    switch (field) {
        case 0: double2string(pp->getPdelay(),resultbuf,bufsize); return true;
        case 1: long2string(pp->getSnode(),resultbuf,bufsize); return true;
        case 2: long2string(pp->getDnode(),resultbuf,bufsize); return true;
        case 3: long2string(pp->getHops(),resultbuf,bufsize); return true;
        case 4: long2string(pp->getNextnode(i),resultbuf,bufsize); return true;
        default: return false;
    }
}

bool packetDescriptor::setFieldAsString(int field, int i, const char *value)
{
    packet *pp = (packet *)p;
    switch (field) {
        case 0: pp->setPdelay(string2double(value)); return true;
        case 1: pp->setSnode(string2long(value)); return true;
        case 2: pp->setDnode(string2long(value)); return true;
        case 3: pp->setHops(string2long(value)); return true;
        case 4: pp->setNextnode(i,string2long(value)); return true;
        default: return false;
    }
}

const char *packetDescriptor::getFieldStructName(int field)
{
    switch (field) {
        default: return NULL;
    }
}

void *packetDescriptor::getFieldStructPointer(int field, int i)
{
    packet *pp = (packet *)p;
    switch (field) {
        default: return NULL;
    }
}

sFieldWrapper *packetDescriptor::getFieldWrapper(int field, int i)
{
    return NULL;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -