#include <BinaryValue.h>
Public Member Functions | |
BinaryValue (const char *s="") | |
BinaryValue (const std::string &str) | |
BinaryValue (const std::vector< char > &v) | |
BinaryValue (size_t n) | |
BinaryValue (const char *b, const char *e) | |
bool | operator< (const BinaryValue &rhs) |
BinaryValue & | 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) |
Definition at line 29 of file BinaryValue.h.
BinaryValue::BinaryValue | ( | const char * | s = "" |
) |
Definition at line 33 of file BinaryValue.cc.
Referenced by BinaryValue().
: vector<char>(strlen(s)) { copy(s, s+strlen(s), begin()); // Inherits vector<char>::begin() }
BinaryValue::BinaryValue | ( | const std::string & | str | ) |
Definition at line 42 of file BinaryValue.cc.
{ *this = BinaryValue(str.c_str()); }
BinaryValue::BinaryValue | ( | const std::vector< char > & | v | ) |
Definition at line 47 of file BinaryValue.cc.
: vector<char>(v) { };
BinaryValue::BinaryValue | ( | size_t | n | ) |
Definition at line 38 of file BinaryValue.cc.
: vector<char>(n) { }
BinaryValue::BinaryValue | ( | const char * | b, | |
const char * | e | |||
) |
Definition at line 51 of file BinaryValue.cc.
: vector<char>(b, e) { };
virtual BinaryValue::~BinaryValue | ( | ) | [inline, virtual] |
Definition at line 41 of file BinaryValue.h.
{};
bool BinaryValue::isUnspecified | ( | ) | const |
Definition at line 61 of file BinaryValue.cc.
Referenced by CBRDHT::handleGetRequest().
{
return empty();
}
void BinaryValue::netPack | ( | cCommBuffer * | b | ) | [virtual] |
Definition at line 86 of file BinaryValue.cc.
Referenced by doPacking().
void BinaryValue::netUnpack | ( | cCommBuffer * | b | ) | [virtual] |
Definition at line 92 of file BinaryValue.cc.
Referenced by doUnpacking().
{ uint16_t size; doUnpacking(b, size); resize(size); doUnpacking(b, (char*)(&(*begin())), size); }
BinaryValue & BinaryValue::operator+= | ( | const BinaryValue & | rhs | ) |
Definition at line 55 of file BinaryValue.cc.
{ insert(end(), rhs.begin(), rhs.end()); return *this; }
bool BinaryValue::operator< | ( | const BinaryValue & | rhs | ) |
Definition at line 72 of file BinaryValue.cc.
{ size_type minSize = min(this->size(), rhs.size()); for (size_type i=0; i<minSize; i++) { if ((*this)[i] < rhs[i]) { return true; } else if ((*this)[i] > rhs[i]) { return false; } } return (this->size() < rhs.size()) ? true : false; }
std::ostream& operator<< | ( | std::ostream & | os, | |
const BinaryValue & | v | |||
) | [friend] |
Definition at line 67 of file BinaryValue.cc.
{ copy(v.begin(), v.end(), ostream_iterator<char>(os, "")); return os; // To allow (cout << a) << b; }
const BinaryValue BinaryValue::UNSPECIFIED_VALUE [static] |
Definition at line 31 of file BinaryValue.h.
Referenced by P2pnsCache::getData(), GlobalDhtTestMap::getRandomKey(), DHT::handleGetRequest(), CBRDHT::handleGetRequest(), DHT::handleGetResponse(), CBRDHT::handleGetResponse(), DHT::handleLookupResponse(), CBRDHT::handleLookupResponse(), and CBRDHT::handleRpcTimeout().