INET Framework for OMNeT++/OMNEST
inet::ByteArray_Base Class Reference

Class generated from inet/common/ByteArray.msg:27 by nedtool. More...

#include <ByteArray_m.h>

Inheritance diagram for inet::ByteArray_Base:
inet::ByteArray

Public Member Functions

virtual ~ByteArray_Base ()
 
virtual ByteArray_Basedup () const override
 
virtual void parsimPack (omnetpp::cCommBuffer *b) const override
 
virtual void parsimUnpack (omnetpp::cCommBuffer *b) override
 
virtual void setDataArraySize (unsigned int size)
 
virtual unsigned int getDataArraySize () const
 
virtual char getData (unsigned int k) const
 
virtual void setData (unsigned int k, char data)
 

Protected Member Functions

bool operator== (const ByteArray_Base &)
 
 ByteArray_Base ()
 
 ByteArray_Base (const ByteArray_Base &other)
 
ByteArray_Baseoperator= (const ByteArray_Base &other)
 

Protected Attributes

char * data
 
unsigned int data_arraysize
 

Private Member Functions

void copy (const ByteArray_Base &other)
 

Detailed Description

Class generated from inet/common/ByteArray.msg:27 by nedtool.

//
// Class that carries raw bytes.
// For example, used by ~RawPacket and some TCP queues.
//
class ByteArray
{
    @customize(true);
    char data[];
}

ByteArray_Base is only useful if it gets subclassed, and ByteArray is derived from it. The minimum code to be written for ByteArray is the following:

class INET_API ByteArray : public ByteArray_Base
{
  private:
    void copy(const ByteArray& other) { ... }
  public:
    ByteArray() : ByteArray_Base() {}
    ByteArray(const ByteArray& other) : ByteArray_Base(other) {copy(other);}
    ByteArray& operator=(const ByteArray& other) {if (this==&other) return *this; ByteArray_Base::operator=(other); copy(other); return *this;}
    virtual ByteArray *dup() const override {return new ByteArray(*this);}
    // ADD CODE HERE to redefine and implement pure virtual functions from ByteArray_Base
};

The following should go into a .cc (.cpp) file:

Register_Class(ByteArray)

Constructor & Destructor Documentation

inet::ByteArray_Base::ByteArray_Base ( )
protected
inet::ByteArray_Base::ByteArray_Base ( const ByteArray_Base other)
protected
virtual inet::ByteArray_Base::~ByteArray_Base ( )
virtual

Member Function Documentation

void inet::ByteArray_Base::copy ( const ByteArray_Base other)
private
virtual ByteArray_Base* inet::ByteArray_Base::dup ( ) const
inlineoverridevirtual

Reimplemented in inet::ByteArray.

95 {throw omnetpp::cRuntimeError("You forgot to manually add a dup() function to class ByteArray");}
virtual char inet::ByteArray_Base::getData ( unsigned int  k) const
virtual
ByteArray_Base& inet::ByteArray_Base::operator= ( const ByteArray_Base other)
protected
bool inet::ByteArray_Base::operator== ( const ByteArray_Base )
protected
virtual void inet::ByteArray_Base::parsimPack ( omnetpp::cCommBuffer *  b) const
overridevirtual
virtual void inet::ByteArray_Base::parsimUnpack ( omnetpp::cCommBuffer *  b)
overridevirtual
virtual void inet::ByteArray_Base::setData ( unsigned int  k,
char  data 
)
virtual
virtual void inet::ByteArray_Base::setDataArraySize ( unsigned int  size)
virtual

Member Data Documentation


The documentation for this class was generated from the following file: