print-trace-sources.cc -> print-introspected-doxygen.cc
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Thu, 15 Nov 2007 10:35:55 +0100
changeset 1855ee15fef0cb62
parent 1854 8a3deb9c57dc
child 1856 0f572793e57a
print-trace-sources.cc -> print-introspected-doxygen.cc
doc/doxygen.conf
utils/print-introspected-doxygen.cc
utils/print-trace-sources.cc
utils/wscript
wscript
     1.1 --- a/doc/doxygen.conf	Thu Nov 15 10:25:35 2007 +0100
     1.2 +++ b/doc/doxygen.conf	Thu Nov 15 10:35:55 2007 +0100
     1.3 @@ -495,7 +495,7 @@
     1.4  
     1.5  INPUT                  = src \
     1.6                           doc/main.txt \
     1.7 -                         doc/trace-source-list.h \
     1.8 +                         doc/introspected-doxygen.h \
     1.9                           doc/tracing.h
    1.10  
    1.11  # This tag can be used to specify the character encoding of the source files that 
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/utils/print-introspected-doxygen.cc	Thu Nov 15 10:35:55 2007 +0100
     2.3 @@ -0,0 +1,135 @@
     2.4 +#include "ns3/internet-node.h"
     2.5 +#include "ns3/ptr.h"
     2.6 +#include "ns3/trace-resolver.h"
     2.7 +#include "ns3/node-list.h"
     2.8 +#include "ns3/point-to-point-net-device.h"
     2.9 +#include "ns3/csma-net-device.h"
    2.10 +#include "ns3/queue.h"
    2.11 +#include "ns3/mobility-model-notifier.h"
    2.12 +#include "ns3/default-value.h"
    2.13 +
    2.14 +using namespace ns3;
    2.15 +
    2.16 +void
    2.17 +PrintSimpleText (const TraceResolver::SourceCollection *sources, std::ostream &os)
    2.18 +{
    2.19 +  for (TraceResolver::SourceCollection::Iterator i = sources->Begin (); i != sources->End (); i++)
    2.20 +    {
    2.21 +      os << "source=" << i->path << std::endl;
    2.22 +      os << "TraceContext=[";
    2.23 +      i->context.PrintAvailable (os, ",");
    2.24 +      os << "]" << std::endl;
    2.25 +      os << "help=\"" << i->doc.GetHelp () << "\"" << std::endl;
    2.26 +      os << "void TraceSinkCallback (const TraceContext &";
    2.27 +      for (TraceDoc::Iterator k = i->doc.ArgsBegin (); k != i->doc.ArgsEnd (); k++)
    2.28 +        {
    2.29 +          os << ", " << k->first;
    2.30 +        }
    2.31 +      os << ")" << std::endl;
    2.32 +      os << "argument 1  --  the trace context associated to the connected trace source." << std::endl;
    2.33 +      uint32_t k = 2;
    2.34 +      for (TraceDoc::Iterator j = i->doc.ArgsBegin (); j != i->doc.ArgsEnd (); j++)
    2.35 +        {
    2.36 +          os << "argument " << k << "  --  " << j->second << "." << std::endl;
    2.37 +          k++;
    2.38 +        }
    2.39 +      os << std::endl;
    2.40 +    }
    2.41 +}
    2.42 +static void
    2.43 +PrintDoxygenText (const TraceResolver::SourceCollection *sources, std::ostream &os)
    2.44 +{
    2.45 +  uint32_t z = 0;
    2.46 +  for (TraceResolver::SourceCollection::Iterator i = sources->Begin (); i != sources->End (); i++)
    2.47 +    {
    2.48 +      os << "///" << std::endl;
    2.49 +      os << "/// \\ingroup TraceSourceList" << std::endl; 
    2.50 +      os << "/// \\brief " << i->doc.GetHelp () << std::endl;
    2.51 +      os << "/// \\param arg1 the trace context associated to the connected trace source." << std::endl;
    2.52 +      uint32_t j = 2;
    2.53 +      for (TraceDoc::Iterator l = i->doc.ArgsBegin (); l != i->doc.ArgsEnd (); l++)
    2.54 +        {
    2.55 +          os << "/// \\param arg" << j << " " << l->second << "." << std::endl;
    2.56 +          j++;
    2.57 +        }
    2.58 +      os << "///" << std::endl;
    2.59 +      os << "///" << std::endl;
    2.60 +      os << "/// The path to this trace source is: <b><tt>\"" << i->path << "\"</tt></b>." << std::endl;
    2.61 +      os << "///" << std::endl;
    2.62 +      if (i->context.Begin ().IsLast ())
    2.63 +        {
    2.64 +          os << "/// No data can be extracted from \\p arg1 with ns3::TraceContext::GetElement." << std::endl;
    2.65 +        }
    2.66 +      else
    2.67 +        {
    2.68 +          os << "/// The following classes can be extracted from \\p arg1 with " << std::endl;
    2.69 +          os << "/// ns3::TraceContext::GetElement:" << std::endl;
    2.70 +          for (TraceContext::Iterator m = i->context.Begin (); !m.IsLast (); m.Next ())
    2.71 +            {
    2.72 +              os << "///  - " << m.Get () << std::endl;
    2.73 +            }
    2.74 +        }
    2.75 +      os << "void TraceSinkCallback" << z << " (const TraceContext & arg1" ;
    2.76 +      j = 2;
    2.77 +      for (TraceDoc::Iterator k = i->doc.ArgsBegin (); k != i->doc.ArgsEnd (); k++)
    2.78 +        {
    2.79 +          os << ", " << k->first << " arg" << j;
    2.80 +          j++;
    2.81 +        }
    2.82 +      os << ");" << std::endl;
    2.83 +      os << std::endl;
    2.84 +      z++;
    2.85 +    }
    2.86 +}
    2.87 +
    2.88 +static void
    2.89 +PrintOneDefaultValue (DefaultValueBase *value, std::ostream &os)
    2.90 +{
    2.91 +  os << "///  <li> \\anchor DefaultValue" << value->GetName ()
    2.92 +     << " " << value->GetName () << std::endl;
    2.93 +  os << "///    <ul>" << std::endl;
    2.94 +  os << "///         <li>Type: " << value->GetType () << "</td></tr>" << std::endl;
    2.95 +  os << "///         <li>Default value: " << value->GetDefaultValue () << "</td></tr>" << std::endl;
    2.96 +  os << "///         <li>Description: " << value->GetHelp () << "</td></tr>" << std::endl;
    2.97 +  os << "///    </ul>" << std::endl;
    2.98 +  os << "///  </li>" << std::endl;
    2.99 +}
   2.100 +
   2.101 +static void
   2.102 +PrintDefaultValuesDoxygen (std::ostream &os)
   2.103 +{
   2.104 +  os << "/// \\page ListOfDefaultValues The list of default values" << std::endl;
   2.105 +  os << "/// \\defgroup ListOfDefaultValuesGroup The list of default values" << std::endl;
   2.106 +  os << "/// <ul>" << std::endl;
   2.107 +  for (DefaultValueList::Iterator i = DefaultValueList::Begin ();
   2.108 +       i != DefaultValueList::End (); i++)
   2.109 +    {
   2.110 +      if ((*i)->GetName () == "help")
   2.111 +	{
   2.112 +	  continue;
   2.113 +	}
   2.114 +      PrintOneDefaultValue (*i, os);
   2.115 +    }
   2.116 +  os << "/// </ul>" << std::endl;
   2.117 +}
   2.118 +
   2.119 +
   2.120 +int main (int argc, char *argv[])
   2.121 +{
   2.122 +  Ptr<Node> node = Create<InternetNode> ();
   2.123 +  node->AddInterface (Create<MobilityModelNotifier> ());
   2.124 +
   2.125 +  Ptr<PointToPointNetDevice> p2p = Create<PointToPointNetDevice> (node);
   2.126 +  p2p->AddQueue (Queue::CreateDefault ());
   2.127 +  Ptr<CsmaNetDevice> csma = Create<CsmaNetDevice> (node);
   2.128 +  csma->AddQueue (Queue::CreateDefault ());
   2.129 +
   2.130 +  TraceResolver::SourceCollection collection;
   2.131 +  NodeList::GetTraceResolver ()->CollectSources ("", TraceContext (), &collection);
   2.132 +  PrintDoxygenText (&collection, std::cout);
   2.133 +
   2.134 +
   2.135 +  PrintDefaultValuesDoxygen (std::cout);
   2.136 +
   2.137 +  return 0;
   2.138 +}
     3.1 --- a/utils/print-trace-sources.cc	Thu Nov 15 10:25:35 2007 +0100
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,135 +0,0 @@
     3.4 -#include "ns3/internet-node.h"
     3.5 -#include "ns3/ptr.h"
     3.6 -#include "ns3/trace-resolver.h"
     3.7 -#include "ns3/node-list.h"
     3.8 -#include "ns3/point-to-point-net-device.h"
     3.9 -#include "ns3/csma-net-device.h"
    3.10 -#include "ns3/queue.h"
    3.11 -#include "ns3/mobility-model-notifier.h"
    3.12 -#include "ns3/default-value.h"
    3.13 -
    3.14 -using namespace ns3;
    3.15 -
    3.16 -void
    3.17 -PrintSimpleText (const TraceResolver::SourceCollection *sources, std::ostream &os)
    3.18 -{
    3.19 -  for (TraceResolver::SourceCollection::Iterator i = sources->Begin (); i != sources->End (); i++)
    3.20 -    {
    3.21 -      os << "source=" << i->path << std::endl;
    3.22 -      os << "TraceContext=[";
    3.23 -      i->context.PrintAvailable (os, ",");
    3.24 -      os << "]" << std::endl;
    3.25 -      os << "help=\"" << i->doc.GetHelp () << "\"" << std::endl;
    3.26 -      os << "void TraceSinkCallback (const TraceContext &";
    3.27 -      for (TraceDoc::Iterator k = i->doc.ArgsBegin (); k != i->doc.ArgsEnd (); k++)
    3.28 -        {
    3.29 -          os << ", " << k->first;
    3.30 -        }
    3.31 -      os << ")" << std::endl;
    3.32 -      os << "argument 1  --  the trace context associated to the connected trace source." << std::endl;
    3.33 -      uint32_t k = 2;
    3.34 -      for (TraceDoc::Iterator j = i->doc.ArgsBegin (); j != i->doc.ArgsEnd (); j++)
    3.35 -        {
    3.36 -          os << "argument " << k << "  --  " << j->second << "." << std::endl;
    3.37 -          k++;
    3.38 -        }
    3.39 -      os << std::endl;
    3.40 -    }
    3.41 -}
    3.42 -static void
    3.43 -PrintDoxygenText (const TraceResolver::SourceCollection *sources, std::ostream &os)
    3.44 -{
    3.45 -  uint32_t z = 0;
    3.46 -  for (TraceResolver::SourceCollection::Iterator i = sources->Begin (); i != sources->End (); i++)
    3.47 -    {
    3.48 -      os << "///" << std::endl;
    3.49 -      os << "/// \\ingroup TraceSourceList" << std::endl; 
    3.50 -      os << "/// \\brief " << i->doc.GetHelp () << std::endl;
    3.51 -      os << "/// \\param arg1 the trace context associated to the connected trace source." << std::endl;
    3.52 -      uint32_t j = 2;
    3.53 -      for (TraceDoc::Iterator l = i->doc.ArgsBegin (); l != i->doc.ArgsEnd (); l++)
    3.54 -        {
    3.55 -          os << "/// \\param arg" << j << " " << l->second << "." << std::endl;
    3.56 -          j++;
    3.57 -        }
    3.58 -      os << "///" << std::endl;
    3.59 -      os << "///" << std::endl;
    3.60 -      os << "/// The path to this trace source is: <b><tt>\"" << i->path << "\"</tt></b>." << std::endl;
    3.61 -      os << "///" << std::endl;
    3.62 -      if (i->context.Begin ().IsLast ())
    3.63 -        {
    3.64 -          os << "/// No data can be extracted from \\p arg1 with ns3::TraceContext::GetElement." << std::endl;
    3.65 -        }
    3.66 -      else
    3.67 -        {
    3.68 -          os << "/// The following classes can be extracted from \\p arg1 with " << std::endl;
    3.69 -          os << "/// ns3::TraceContext::GetElement:" << std::endl;
    3.70 -          for (TraceContext::Iterator m = i->context.Begin (); !m.IsLast (); m.Next ())
    3.71 -            {
    3.72 -              os << "///  - " << m.Get () << std::endl;
    3.73 -            }
    3.74 -        }
    3.75 -      os << "void TraceSinkCallback" << z << " (const TraceContext & arg1" ;
    3.76 -      j = 2;
    3.77 -      for (TraceDoc::Iterator k = i->doc.ArgsBegin (); k != i->doc.ArgsEnd (); k++)
    3.78 -        {
    3.79 -          os << ", " << k->first << " arg" << j;
    3.80 -          j++;
    3.81 -        }
    3.82 -      os << ");" << std::endl;
    3.83 -      os << std::endl;
    3.84 -      z++;
    3.85 -    }
    3.86 -}
    3.87 -
    3.88 -static void
    3.89 -PrintOneDefaultValue (DefaultValueBase *value, std::ostream &os)
    3.90 -{
    3.91 -  os << "///  <li> \\anchor DefaultValue" << value->GetName ()
    3.92 -     << " " << value->GetName () << std::endl;
    3.93 -  os << "///    <ul>" << std::endl;
    3.94 -  os << "///         <li>Type: " << value->GetType () << "</td></tr>" << std::endl;
    3.95 -  os << "///         <li>Default value: " << value->GetDefaultValue () << "</td></tr>" << std::endl;
    3.96 -  os << "///         <li>Description: " << value->GetHelp () << "</td></tr>" << std::endl;
    3.97 -  os << "///    </ul>" << std::endl;
    3.98 -  os << "///  </li>" << std::endl;
    3.99 -}
   3.100 -
   3.101 -static void
   3.102 -PrintDefaultValuesDoxygen (std::ostream &os)
   3.103 -{
   3.104 -  os << "/// \\page ListOfDefaultValues The list of default values" << std::endl;
   3.105 -  os << "/// \\defgroup ListOfDefaultValuesGroup The list of default values" << std::endl;
   3.106 -  os << "/// <ul>" << std::endl;
   3.107 -  for (DefaultValueList::Iterator i = DefaultValueList::Begin ();
   3.108 -       i != DefaultValueList::End (); i++)
   3.109 -    {
   3.110 -      if ((*i)->GetName () == "help")
   3.111 -	{
   3.112 -	  continue;
   3.113 -	}
   3.114 -      PrintOneDefaultValue (*i, os);
   3.115 -    }
   3.116 -  os << "/// </ul>" << std::endl;
   3.117 -}
   3.118 -
   3.119 -
   3.120 -int main (int argc, char *argv[])
   3.121 -{
   3.122 -  Ptr<Node> node = Create<InternetNode> ();
   3.123 -  node->AddInterface (Create<MobilityModelNotifier> ());
   3.124 -
   3.125 -  Ptr<PointToPointNetDevice> p2p = Create<PointToPointNetDevice> (node);
   3.126 -  p2p->AddQueue (Queue::CreateDefault ());
   3.127 -  Ptr<CsmaNetDevice> csma = Create<CsmaNetDevice> (node);
   3.128 -  csma->AddQueue (Queue::CreateDefault ());
   3.129 -
   3.130 -  TraceResolver::SourceCollection collection;
   3.131 -  NodeList::GetTraceResolver ()->CollectSources ("", TraceContext (), &collection);
   3.132 -  PrintDoxygenText (&collection, std::cout);
   3.133 -
   3.134 -
   3.135 -  PrintDefaultValuesDoxygen (std::cout);
   3.136 -
   3.137 -  return 0;
   3.138 -}
     4.1 --- a/utils/wscript	Thu Nov 15 10:25:35 2007 +0100
     4.2 +++ b/utils/wscript	Thu Nov 15 10:35:55 2007 +0100
     4.3 @@ -28,9 +28,9 @@
     4.4      obj = bld.create_ns3_program('replay-simulation', ['simulator'])
     4.5      obj.source = 'replay-simulation.cc'
     4.6  
     4.7 -    obj = bld.create_ns3_program('print-trace-sources',
     4.8 +    obj = bld.create_ns3_program('print-introspected-doxygen',
     4.9                                   ['internet-node', 'csma-cd', 'point-to-point'])
    4.10 -    obj.source = 'print-trace-sources.cc'
    4.11 +    obj.source = 'print-introspected-doxygen.cc'
    4.12  
    4.13      if env['ENABLE_MOBILITY_VISUALIZER']:
    4.14          obj = bld.create_ns3_program('mobility-visualizer',
     5.1 --- a/wscript	Thu Nov 15 10:25:35 2007 +0100
     5.2 +++ b/wscript	Thu Nov 15 10:35:55 2007 +0100
     5.3 @@ -214,8 +214,8 @@
     5.4      ## generate the trace sources list docs
     5.5      env = Params.g_build.env_of_name('default')
     5.6      proc_env = _get_proc_env()
     5.7 -    prog = _find_program('print-trace-sources', env).m_linktask.m_outputs[0].abspath(env)
     5.8 -    out = open('doc/trace-source-list.h', 'w')
     5.9 +    prog = _find_program('print-introspected-doxygen', env).m_linktask.m_outputs[0].abspath(env)
    5.10 +    out = open('doc/introspected-doxygen.h', 'w')
    5.11      if subprocess.Popen([prog], stdout=out, env=proc_env).wait():
    5.12          raise SystemExit(1)
    5.13      out.close()
    5.14 @@ -353,8 +353,8 @@
    5.15  
    5.16  
    5.17  def doxygen():
    5.18 -    if not os.path.exists('doc/trace-source-list.h'):
    5.19 -        Params.warning("doc/trace-source-list.h does not exist; run waf check to generate it.")
    5.20 +    if not os.path.exists('doc/introspected-doxygen.h'):
    5.21 +        Params.warning("doc/introspected-doxygen.h does not exist; run waf check to generate it.")
    5.22  
    5.23      ## run doxygen
    5.24      doxygen_config = os.path.join('doc', 'doxygen.conf')