SDESItem Class Reference

#include <sdes.h>

List of all members.


Detailed Description

The class SDESItem is used for storing a source description item (type of description, description string) for an rtp end system.

Public Types

enum  SDES_ITEM_TYPE {
  SDES_UNDEF = 0, SDES_CNAME = 1, SDES_NAME = 2, SDES_EMAIL = 3,
  SDES_PHONE = 4, SDES_LOC = 5, SDES_TOOL = 6, SDES_NOTE = 7,
  SDES_PRIV = 8
}

Public Member Functions

 SDESItem ()
 SDESItem (SDES_ITEM_TYPE type, const char *content)
 SDESItem (const SDESItem &sdesItem)
virtual ~SDESItem ()
SDESItemoperator= (const SDESItem &sdesItem)
virtual SDESItemdup () const
virtual std::string info ()
virtual void dump (std::ostream &os)
virtual SDES_ITEM_TYPE getType ()
virtual const char * getContent ()
virtual int getLength ()

Protected Attributes

SDES_ITEM_TYPE _type
int _length
const char * _content

Member Enumeration Documentation

This enumeration holds the types of source description items as defined in the rfc. In this implementation only SDES_UNDEF and SDES_CNAME are usable.

Enumerator:
SDES_UNDEF 
SDES_CNAME 
SDES_NAME 
SDES_EMAIL 
SDES_PHONE 
SDES_LOC 
SDES_TOOL 
SDES_NOTE 
SDES_PRIV 
00040                             {
00041             SDES_UNDEF = 0,
00042             SDES_CNAME = 1,
00043             SDES_NAME = 2,
00044             SDES_EMAIL = 3,
00045             SDES_PHONE = 4,
00046             SDES_LOC = 5,
00047             SDES_TOOL = 6,
00048             SDES_NOTE = 7,
00049             SDES_PRIV = 8
00050         };


Constructor & Destructor Documentation

SDESItem::SDESItem (  ) 

Default constructor.

Referenced by dup().

00029                    : cObject() {
00030     _type = SDES_UNDEF;
00031     _length = 2;
00032     _content = "";
00033 };

SDESItem::SDESItem ( SDES_ITEM_TYPE  type,
const char *  content 
)

Constructor which sets the entry.

00036                                                            : cObject() {
00037     _type = type;
00038     _content = content;
00039     // an sdes item requires one byte for the type field,
00040     // one byte for the length field and bytes for
00041     // the content string
00042     _length = 2 + strlen(_content);
00043 };

SDESItem::SDESItem ( const SDESItem sdesItem  ) 

Copy constructor.

00046                                            : cObject() {
00047     operator=(sdesItem);
00048 };

SDESItem::~SDESItem (  )  [virtual]

Destructor.

00051                     {
00052 };


Member Function Documentation

SDESItem & SDESItem::operator= ( const SDESItem sdesItem  ) 

Assignment operator.

Referenced by SDESItem().

00055                                                       {
00056     cObject::operator=(sdesItem);
00057     _type = sdesItem._type;
00058     _length = sdesItem._length;
00059     _content = opp_strdup(sdesItem._content);
00060     return *this;
00061 };

SDESItem * SDESItem::dup (  )  const [virtual]

Duplicates theis SDESItem by calling the copy constructor.

00064                               {
00065     return new SDESItem(*this);
00066 };

std::string SDESItem::info (  )  [virtual]

Writes a short info about this SDESItem into the given string.

00069                          {
00070     std::stringstream out;
00071     out << "SDESItem=" << _content;
00072     return out.str();
00073 };

void SDESItem::dump ( std::ostream &  os  )  [virtual]

Writes an info about this SDESItem into the give output stream.

00076                                   {
00077     os << "SDESItem:" << endl;
00078     os << "  type = " << _type << endl;
00079     os << "  content = " << _content << endl;
00080 };

SDESItem::SDES_ITEM_TYPE SDESItem::getType (  )  [virtual]

Returns the type of this sdes item.

Referenced by SDESChunk::addSDESItem().

00083                                          {
00084     return _type;
00085 };

const char * SDESItem::getContent (  )  [virtual]

Returns the stored sdes string.

00088                                  {
00089     return opp_strdup(_content);
00090 };

int SDESItem::getLength (  )  [virtual]

This method returns the size of this SDESItem in bytes as it would be in the real world.

Referenced by SDESChunk::addSDESItem().

00093                         {
00094     // bytes needed for this sdes item are
00095     // one byte for type, one for length
00096     // and the string
00097     return _length + 2;
00098 };


Member Data Documentation

The type of this SDESItem.

Referenced by dump(), getType(), operator=(), and SDESItem().

int SDESItem::_length [protected]

The length of this SDESItem.

Referenced by getLength(), operator=(), and SDESItem().

const char* SDESItem::_content [protected]

The sdes string.

Referenced by dump(), getContent(), info(), operator=(), and SDESItem().


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

Generated on Fri Mar 20 18:51:21 2009 for INET Framework for OMNeT++/OMNEST by  doxygen 1.5.5