BinaryValue Class Reference

#include <BinaryValue.h>

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)
bool isUnspecified () const

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 = ""  ) 

Referenced by BinaryValue().

00033                                      : vector<char>(strlen(s))
00034 {
00035     copy(s, s+strlen(s), begin());  // Inherits vector<char>::begin()
00036 }

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

00039 {
00040     *this = BinaryValue(str.c_str());
00041 }

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

00043                                                  : vector<char>(v)
00044 {
00045 };

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

00038 {};


Member Function Documentation

bool BinaryValue::operator< ( const BinaryValue rhs  ) 

00059 {
00060     uint minSize = min(this->size(), rhs.size());
00061     for (uint i=0; i<minSize; i++) {
00062         if ((*this)[i] < rhs[i]) {
00063             return true;
00064         } else if ((*this)[i] > rhs[i]) {
00065             return false;
00066         }
00067     }
00068 
00069     return (this->size() < rhs.size()) ? true : false;
00070 }

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

Referenced by doPacking().

00112 {
00113     doPacking(b,size());
00114     doPacking(b, (const char*)(&(*begin())), size());
00115 }

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

Referenced by doUnpacking().

00118 {
00119     int size;
00120     doUnpacking(b, size);
00121     resize(size);
00122     doUnpacking(b, (char*)(&(*begin())), size);
00123 }

bool BinaryValue::isUnspecified (  )  const

Referenced by DHT::handleGetRequest().

00048 {
00049     return empty();
00050 }


Friends And Related Function Documentation

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

00053                                                                {
00054     copy(v.begin(), v.end(), ostream_iterator<char>(os, ""));
00055     return os;        // To allow (cout << a) << b;
00056 }


Member Data Documentation


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

Generated on Fri Sep 19 13:05:06 2008 for ITM OverSim by  doxygen 1.5.5