utils/print-trace-sources.cc
changeset 1399 5945e92014e2
parent 1376 ad7e61edfb9d
child 1400 382b2a36384c
--- a/utils/print-trace-sources.cc	Wed Aug 29 16:43:19 2007 +0200
+++ b/utils/print-trace-sources.cc	Thu Aug 30 13:58:15 2007 +0200
@@ -9,6 +9,79 @@
 
 using namespace ns3;
 
+void
+PrintSimpleText (const TraceResolver::SourceCollection *sources, std::ostream &os)
+{
+  for (TraceResolver::SourceCollection::Iterator i = sources->Begin (); i != sources->End (); i++)
+    {
+      os << "source=" << i->path << std::endl;
+      os << "TraceContext=[";
+      i->context.PrintAvailable (os, ",");
+      os << "]" << std::endl;
+      os << "help=\"" << i->doc.GetHelp () << "\"" << std::endl;
+      os << "void TraceSinkCallback (const TraceContext &";
+      for (TraceDoc::Iterator k = i->doc.ArgsBegin (); k != i->doc.ArgsEnd (); k++)
+        {
+          os << ", " << k->first;
+        }
+      os << ")" << std::endl;
+      os << "argument 1  --  the trace context associated to the connected trace source." << std::endl;
+      uint32_t k = 2;
+      for (TraceDoc::Iterator j = i->doc.ArgsBegin (); j != i->doc.ArgsEnd (); j++)
+        {
+          os << "argument " << k << "  --  " << j->second << "." << std::endl;
+          k++;
+        }
+      os << std::endl;
+    }
+}
+void
+PrintDoxygenText (const TraceResolver::SourceCollection *sources, std::ostream &os)
+{
+  uint32_t z = 0;
+  for (TraceResolver::SourceCollection::Iterator i = sources->Begin (); i != sources->End (); i++)
+    {
+      os << "///" << std::endl;
+      os << "/// \\ingroup TraceSourceList" << std::endl; 
+      os << "/// \\brief " << i->doc.GetHelp () << std::endl;
+      os << "/// \\param arg1 the trace context associated to the connected trace source." << std::endl;
+      uint32_t j = 2;
+      for (TraceDoc::Iterator l = i->doc.ArgsBegin (); l != i->doc.ArgsEnd (); l++)
+        {
+          os << "/// \\param arg" << j << " " << l->second << "." << std::endl;
+          j++;
+        }
+      os << "///" << std::endl;
+      os << "///" << std::endl;
+      os << "/// The path to this trace source is: " << i->path << "." << std::endl;
+      os << "///" << std::endl;
+      if (i->context.AvailableBegin () == i->context.AvailableEnd ())
+        {
+          os << "/// No data can be extracted from \\p arg1 with ns3::TraceContext::GetElement." << std::endl;
+        }
+      else
+        {
+          os << "/// The following classes can be extracted from \\p arg1 with " << std::endl;
+          os << "/// ns3::TraceContext::GetElement:" << std::endl;
+          for (TraceContext::Iterator m = i->context.AvailableBegin (); m != i->context.AvailableEnd (); m++)
+            {
+              os << "///  - " << (*m) << std::endl;
+            }
+        }
+      os << "void TraceSinkCallback" << z << " (const TraceContext & arg1" ;
+      j = 2;
+      for (TraceDoc::Iterator k = i->doc.ArgsBegin (); k != i->doc.ArgsEnd (); k++)
+        {
+          os << ", " << k->first << " arg" << j;
+          j++;
+        }
+      os << ");" << std::endl;
+      os << std::endl;
+      z++;
+    }
+}
+
+
 int main (int argc, char *argv[])
 {
   Ptr<Node> node = Create<InternetNode> ();
@@ -21,7 +94,7 @@
 
   TraceResolver::SourceCollection collection;
   NodeList::GetTraceResolver ()->CollectSources ("", TraceContext (), &collection);
-  collection.Print (std::cout);
+  PrintDoxygenText (&collection, std::cout);
 
   return 0;
 }