add operator << for Packet and TraceContext
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Mon, 27 Aug 2007 13:15:27 +0200
changeset 1360 7686e996bd1d
parent 1359 969f9671ee09
child 1361 85344cd127f5
add operator << for Packet and TraceContext
src/common/packet.cc
src/common/packet.h
src/core/trace-context.cc
src/core/trace-context.h
--- a/src/common/packet.cc	Mon Aug 27 13:15:13 2007 +0200
+++ b/src/common/packet.cc	Mon Aug 27 13:15:27 2007 +0200
@@ -199,6 +199,12 @@
   buffer.RemoveAtStart (metadataDeserialized);
 }
 
+std::ostream& operator<< (std::ostream& os, const Packet &packet)
+{
+  packet.Print (os);
+  return os;
+}
+
 
 } // namespace ns3
 
--- a/src/common/packet.h	Mon Aug 27 13:15:13 2007 +0200
+++ b/src/common/packet.h	Mon Aug 27 13:15:27 2007 +0200
@@ -328,6 +328,8 @@
   static uint32_t m_globalUid;
 };
 
+std::ostream& operator<< (std::ostream& os, const Packet &packet);
+
 /**
  * \defgroup packetperf Packet Performance
  * The current implementation of the byte buffers and tag list is based
--- a/src/core/trace-context.cc	Mon Aug 27 13:15:13 2007 +0200
+++ b/src/core/trace-context.cc	Mon Aug 27 13:15:27 2007 +0200
@@ -231,6 +231,12 @@
   } while (true);
 }
 
+std::ostream& operator<< (std::ostream& os, const TraceContext &context)
+{
+  context.Print (os);
+  return os;
+}
+
 }//namespace ns3
 
 #include "test.h"
--- a/src/core/trace-context.h	Mon Aug 27 13:15:13 2007 +0200
+++ b/src/core/trace-context.h	Mon Aug 27 13:15:27 2007 +0200
@@ -99,6 +99,8 @@
   } * m_data;
 };
 
+std::ostream& operator<< (std::ostream& os, const TraceContext &context);
+
 }//namespace ns3
 
 namespace ns3 {