src/common/packet.cc
changeset 3208 1a754d09c4ba
parent 3158 2a4305eeca93
child 3230 e59680767a04
--- a/src/common/packet.cc	Mon Jun 02 10:51:55 2008 -0700
+++ b/src/common/packet.cc	Tue Jun 03 16:20:17 2008 -0700
@@ -291,8 +291,30 @@
 void 
 Packet::PrintTags (std::ostream &os) const
 {
-  // XXX:
-  //m_tagList.Print (os, " ");
+  TagIterator i = GetTagIterator ();
+  while (i.HasNext ())
+    {
+      TagIterator::Item item = i.Next ();
+      os << item.GetTypeId ().GetName () << " [" << item.GetStart () << "-" << item.GetEnd () << "]";
+      Callback<ObjectBase *> constructor = item.GetTypeId ().GetConstructor ();
+      if (constructor.IsNull ())
+        {
+          if (i.HasNext ())
+            {
+              os << " ";
+            }
+          continue;
+        }
+      Tag *tag = dynamic_cast<Tag *> (constructor ());
+      NS_ASSERT (tag != 0);
+      os << " ";
+      tag->Print (os);
+      if (i.HasNext ())
+        {
+          os << " ";
+        }
+      delete tag;
+    }
 }
 
 void 
@@ -576,6 +598,9 @@
           }
       }
   }
+  virtual void Print (std::ostream &os) const {
+    os << N;
+  }
   ATestTag ()
     : ATestTagBase () {}
 };