16 #include "ns3/ndn-common.h" 
   29   typedef std::vector<char> base;
 
   31   typedef base::value_type             value_type;
 
   32   typedef base::pointer                pointer;
 
   33   typedef base::const_pointer          const_pointer;
 
   34   typedef base::reference              reference;
 
   35   typedef base::const_reference        const_reference;
 
   36   typedef base::iterator               iterator;
 
   37   typedef base::const_iterator         const_iterator;
 
   38   typedef base::const_reverse_iterator const_reverse_iterator;
 
   39   typedef base::reverse_iterator       reverse_iterator;
 
   40   typedef base::size_type              size_type;
 
   41   typedef base::difference_type        difference_type;
 
   42   typedef base::allocator_type         allocator_type;
 
   52   Blob (
const std::string &data)
 
   53     : m_data (data.begin (), data.end ())
 
   57   Blob (
const void *buf, 
size_t length)
 
   58     : m_data (reinterpret_cast<const char*> (buf), reinterpret_cast<const char*> (buf) + length)
 
   68     return &m_data.front ();
 
   77     return &m_data.front ();
 
   80   iterator begin () { 
return m_data.begin (); }
 
   81   const_iterator begin ()
 const { 
return m_data.begin (); }
 
   82   iterator end () { 
return m_data.end (); }
 
   83   const_iterator end ()
 const { 
return m_data.end (); }
 
   84   size_t size ()
 const { 
return m_data.size (); }
 
   86   void swap (Blob &x) { m_data.swap (x.m_data); }
 
   87   void push_back (value_type val) { m_data.push_back (val); }
 
   89   bool empty ()
 const { 
return m_data.empty (); }
 
   92   operator = (
const Blob &other) { m_data = other.m_data; 
return *
this; }
 
   94   reference operator [] (size_type 
pos) { 
return m_data [
pos]; }
 
   95   const_reference operator [] (size_type 
pos)
 const { 
return m_data [
pos]; }
 
   97   char getItem (size_type 
pos)
 const { 
return m_data [
pos]; }
 
   99   void clear () { m_data.clear (); }
 
  102   friend bool operator == (
const Blob &a, 
const Blob &b);
 
  103   friend bool operator <  (
const Blob &a, 
const Blob &b);
 
  104   friend bool operator <= (
const Blob &a, 
const Blob &b);
 
  105   friend bool operator >  (
const Blob &a, 
const Blob &b);
 
  106   friend bool operator >= (
const Blob &a, 
const Blob &b);
 
  109   std::vector< char > m_data;
 
  112 inline bool operator == (
const Blob &a, 
const Blob &b)  { 
return a.m_data == b.m_data; }
 
  113 inline bool operator <  (
const Blob &a, 
const Blob &b)  { 
return a.m_data <  b.m_data; }
 
  114 inline bool operator <= (
const Blob &a, 
const Blob &b)  { 
return a.m_data <= b.m_data; }
 
  115 inline bool operator >  (
const Blob &a, 
const Blob &b)  { 
return a.m_data >  b.m_data; }
 
  116 inline bool operator >= (
const Blob &a, 
const Blob &b)  { 
return a.m_data >= b.m_data; }
 
  120 #include <boost/functional/hash.hpp> 
  126   return boost::hash_range (v.begin(), v.end());
 
Class representing a general-use binary blob. 
 
Blob()
Creates an empty blob. 
 
char * buf()
Get pointer to the first byte of the binary blob. 
 
const char * buf() const 
Get const pointer to the first byte of the binary blob. 
 
boost::error_info< struct tag_pos, int > pos
Report of the position of the error (error-specific meaning)