model: A couple of tricks and fixes in NDN.cxx, so it will play nice with python bindings

Refs #1011 (http://redmine.named-data.net/issues/1011)
diff --git a/ndn.cxx/blob.h b/ndn.cxx/blob.h
index f00d08e..4b488b3 100644
--- a/ndn.cxx/blob.h
+++ b/ndn.cxx/blob.h
@@ -16,16 +16,31 @@
 #include "ns3/ndn-common.h"
 
 #include <vector>
-#include <cstddef>
 
 NDN_NAMESPACE_BEGIN
 
 /**
  * @brief Class representing a general-use binary blob
  */
-class Blob : public std::vector<char>
+class Blob
 {
 public:
+  typedef std::vector<char> base;
+  
+  typedef base::value_type             value_type;
+  typedef base::pointer                pointer;
+  typedef base::const_pointer          const_pointer;
+  typedef base::reference              reference;
+  typedef base::const_reference        const_reference;
+  typedef base::iterator               iterator;
+  typedef base::const_iterator         const_iterator;
+  typedef base::const_reverse_iterator const_reverse_iterator;
+  typedef base::reverse_iterator       reverse_iterator;
+  typedef base::size_type              size_type;
+  typedef base::difference_type        difference_type;
+  typedef base::allocator_type         allocator_type;
+  
+public:
   /**
    * @brief Creates an empty blob
    */
@@ -33,8 +48,13 @@
   {
   }
 
+  Blob (const std::string &data)
+    : m_data (data.begin (), data.end ())
+  {
+  }
+
   Blob (const void *buf, size_t length)
-    : std::vector<char> (reinterpret_cast<const char*> (buf), reinterpret_cast<const char*> (buf) + length)
+    : m_data (reinterpret_cast<const char*> (buf), reinterpret_cast<const char*> (buf) + length)
   {
   }
   
@@ -44,7 +64,7 @@
   inline char*
   buf ()
   {
-    return &front ();
+    return &m_data.front ();
   }
 
   /**
@@ -53,10 +73,57 @@
   inline const char*
   buf () const
   {
-    return &front ();
+    return &m_data.front ();
   }
+
+  iterator begin () { return m_data.begin (); }
+  const_iterator begin () const { return m_data.begin (); }
+  iterator end () { return m_data.end (); }
+  const_iterator end () const { return m_data.end (); }
+  size_t size () const { return m_data.size (); }
+
+  void swap (Blob &x) { m_data.swap (x.m_data); }
+  void push_back (value_type val) { m_data.push_back (val); }
+
+  bool empty () const { return m_data.empty (); }
+
+  Blob &
+  operator = (const Blob &other) { m_data = other.m_data; return *this; }
+
+  reference operator [] (size_type pos) { return m_data [pos]; }
+  const_reference operator [] (size_type pos) const { return m_data [pos]; }
+
+  char getItem (size_type pos) const { return m_data [pos]; }
+
+  void clear () { m_data.clear (); }
+
+private:
+  friend bool operator == (const Blob &a, const Blob &b);
+  friend bool operator <  (const Blob &a, const Blob &b);
+  friend bool operator <= (const Blob &a, const Blob &b);
+  friend bool operator >  (const Blob &a, const Blob &b);
+  friend bool operator >= (const Blob &a, const Blob &b);
+
+private:
+  std::vector< char > m_data;
 };
 
+inline bool operator == (const Blob &a, const Blob &b)  { return a.m_data == b.m_data; }
+inline bool operator <  (const Blob &a, const Blob &b)  { return a.m_data <  b.m_data; }
+inline bool operator <= (const Blob &a, const Blob &b)  { return a.m_data <= b.m_data; }
+inline bool operator >  (const Blob &a, const Blob &b)  { return a.m_data >  b.m_data; }
+inline bool operator >= (const Blob &a, const Blob &b)  { return a.m_data >= b.m_data; }
+
 NDN_NAMESPACE_END
 
+#include <boost/functional/hash.hpp>
+namespace boost
+{
+inline std::size_t
+hash_value (const ns3::ndn::Blob v)
+{
+  return boost::hash_range (v.begin(), v.end());
+}
+}
+
 #endif // NDN_BLOB_H