BinaryValue Class Reference

#include <BinaryValue.h>

Inheritance diagram for BinaryValue:

vector

List of all members.

Public Member Functions

 BinaryValue (const char *s="")
 BinaryValue (const std::string &str)
 BinaryValue (const std::vector< char > &v)
bool operator< (const BinaryValue &rhs)
virtual ~BinaryValue ()
virtual void netPack (cCommBuffer *b)
virtual void netUnpack (cCommBuffer *b)

Static Public Attributes

static const BinaryValue UNSPECIFIED_VALUE

Friends

std::ostream & operator<< (std::ostream &os, const BinaryValue &v)


Constructor & Destructor Documentation

BinaryValue::BinaryValue ( const char *  s = ""  ) 

00031                                      : vector<char>(strlen(s)) {
00032     copy(s, s+strlen(s), begin());  // Inherits vector<char>::begin()
00033 }

BinaryValue::BinaryValue ( const std::string &  str  ) 

00035                                              {
00036     *this = BinaryValue(str.c_str());
00037 }

BinaryValue::BinaryValue ( const std::vector< char > &  v  ) 

00039                                                  : vector<char>(v) {
00040 };

virtual BinaryValue::~BinaryValue (  )  [inline, virtual]

00041 {};


Member Function Documentation

bool BinaryValue::operator< ( const BinaryValue rhs  ) 

00048                                                   {
00049     uint minSize = min(this->size(), rhs.size());
00050     for (uint i=0; i<minSize; i++) {
00051         if ((*this)[i] < rhs[i]) {
00052             return true;
00053         } else if ((*this)[i] > rhs[i]) {
00054             return false;
00055         }
00056     }
00057     
00058     return (this->size() < rhs.size()) ? true : false; 
00059 }

void BinaryValue::netPack ( cCommBuffer *  b  )  [virtual]

00104 {
00105     doPacking(b,size());
00106     doPacking(b, (const char*)(&(*begin())), size());
00107 }

void BinaryValue::netUnpack ( cCommBuffer *  b  )  [virtual]

00110 {
00111     int size;
00112     doUnpacking(b, size);
00113     resize(size);
00114     doUnpacking(b, (char*)(&(*begin())), size);
00115 }


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const BinaryValue v 
) [friend]

00043                                                                {
00044     copy(v.begin(), v.end(), ostream_iterator<char>(os, ""));
00045     return os;        // To allow (cout << a) << b;
00046 }


Member Data Documentation

const BinaryValue BinaryValue::UNSPECIFIED_VALUE [static]


The documentation for this class was generated from the following files:
Generated on Thu Apr 17 13:19:28 2008 for ITM OverSim by  doxygen 1.5.3