BinaryValue Class Reference

#include <BinaryValue.h>

List of all members.


Detailed Description

Definition at line 29 of file BinaryValue.h.


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

Definition at line 33 of file BinaryValue.cc.

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  ) 

Definition at line 38 of file BinaryValue.cc.

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

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

Definition at line 43 of file BinaryValue.cc.

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

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

Definition at line 38 of file BinaryValue.h.

00038 {};


Member Function Documentation

bool BinaryValue::operator< ( const BinaryValue &  rhs  ) 

Definition at line 58 of file BinaryValue.cc.

00059 {
00060     size_type minSize = min(this->size(), rhs.size());
00061     for (size_type 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]

Definition at line 72 of file BinaryValue.cc.

Referenced by doPacking().

00073 {
00074     doPacking(b,size());
00075     doPacking(b, (const char*)(&(*begin())), size());
00076 }

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

Definition at line 78 of file BinaryValue.cc.

Referenced by doUnpacking().

00079 {
00080     int size;
00081     doUnpacking(b, size);
00082     resize(size);
00083     doUnpacking(b, (char*)(&(*begin())), size);
00084 }

bool BinaryValue::isUnspecified (  )  const

Definition at line 47 of file BinaryValue.cc.

Referenced by DHT::handleGetRequest().

00048 {
00049     return empty();
00050 }


Friends And Related Function Documentation

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

Definition at line 53 of file BinaryValue.cc.

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 Wed Mar 25 16:32:52 2009 for OverSim by  doxygen 1.5.5