model: Add ability to print interest to the standard output, so it plays nice with PyNDN
Refs #1010 (http://redmine.named-data.net/issues/1010)
diff --git a/bindings/modulegen__gcc_ILP32.py b/bindings/modulegen__gcc_ILP32.py
index 0e3df61..c072610 100644
--- a/bindings/modulegen__gcc_ILP32.py
+++ b/bindings/modulegen__gcc_ILP32.py
@@ -5039,6 +5039,7 @@
return
def register_Ns3NdnContentObject_methods(root_module, cls):
+ cls.add_output_stream_operator()
## ndn-content-object.h (module 'ndnSIM'): ns3::ndn::ContentObject::ContentObject(ns3::Ptr<ns3::Packet> payload=ns3::Create( )) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::Packet >', 'payload', default_value='ns3::Create( )')])
## ndn-content-object.h (module 'ndnSIM'): ns3::ndn::ContentObject::ContentObject(ns3::ndn::ContentObject const & other) [copy constructor]
diff --git a/bindings/modulegen__gcc_LP64.py b/bindings/modulegen__gcc_LP64.py
index 0e3df61..c072610 100644
--- a/bindings/modulegen__gcc_LP64.py
+++ b/bindings/modulegen__gcc_LP64.py
@@ -5039,6 +5039,7 @@
return
def register_Ns3NdnContentObject_methods(root_module, cls):
+ cls.add_output_stream_operator()
## ndn-content-object.h (module 'ndnSIM'): ns3::ndn::ContentObject::ContentObject(ns3::Ptr<ns3::Packet> payload=ns3::Create( )) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::Packet >', 'payload', default_value='ns3::Create( )')])
## ndn-content-object.h (module 'ndnSIM'): ns3::ndn::ContentObject::ContentObject(ns3::ndn::ContentObject const & other) [copy constructor]
diff --git a/model/ndn-content-object.cc b/model/ndn-content-object.cc
index ecf3197..9df1d27 100644
--- a/model/ndn-content-object.cc
+++ b/model/ndn-content-object.cc
@@ -31,7 +31,8 @@
namespace ndn {
ContentObject::ContentObject (Ptr<Packet> payload/* = Create<Packet> ()*/)
- : m_signature (0)
+ : m_name (Create<Name> ())
+ , m_signature (0)
, m_payload (payload)
, m_wire (0)
{
diff --git a/model/ndn-content-object.h b/model/ndn-content-object.h
index c79ddf9..58e88a3 100644
--- a/model/ndn-content-object.h
+++ b/model/ndn-content-object.h
@@ -190,6 +190,13 @@
mutable Ptr<const Packet> m_wire;
};
+inline std::ostream &
+operator << (std::ostream &os, const ContentObject &d)
+{
+ d.Print (os);
+ return os;
+}
+
/**
* @ingroup ndn-exceptions
* @brief Class for ContentObject parsing exception