# HG changeset patch # User Mathieu Lacage # Date 1193666496 -3600 # Node ID c62b4aae737de82a8292f79eae22b6646f1de084 # Parent 895b54d0ad736d4492e3458119b2f5a8b71d5d35 rename print-trace-sources to print-introspected-doxygen diff -r 895b54d0ad73 -r c62b4aae737d .hgignore --- a/.hgignore Mon Oct 29 15:01:14 2007 +0100 +++ b/.hgignore Mon Oct 29 15:01:36 2007 +0100 @@ -8,4 +8,4 @@ ^doc/latex ^\.lock-wscript ^\.waf -^doc/trace-source-list\.h$ +^doc/introspected-doxygen\.h$ diff -r 895b54d0ad73 -r c62b4aae737d doc/doxygen.conf --- a/doc/doxygen.conf Mon Oct 29 15:01:14 2007 +0100 +++ b/doc/doxygen.conf Mon Oct 29 15:01:36 2007 +0100 @@ -495,7 +495,7 @@ INPUT = src \ doc/main.txt \ - doc/trace-source-list.h \ + doc/introspected-doxygen.h \ doc/tracing.h \ # This tag can be used to specify the character encoding of the source files that diff -r 895b54d0ad73 -r c62b4aae737d utils/print-introspected-doxygen.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utils/print-introspected-doxygen.cc Mon Oct 29 15:01:36 2007 +0100 @@ -0,0 +1,135 @@ +#include "ns3/internet-node.h" +#include "ns3/ptr.h" +#include "ns3/trace-resolver.h" +#include "ns3/node-list.h" +#include "ns3/point-to-point-net-device.h" +#include "ns3/csma-net-device.h" +#include "ns3/queue.h" +#include "ns3/mobility-model-notifier.h" +#include "ns3/default-value.h" + +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; + } +} +static 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.Begin ().IsLast ()) + { + 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.Begin (); !m.IsLast (); m.Next ()) + { + os << "/// - " << m.Get () << 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++; + } +} + +static void +PrintOneDefaultValue (DefaultValueBase *value, std::ostream &os) +{ + os << "///
  • \\anchor DefaultValue" << value->GetName () + << " " << value->GetName () << std::endl; + os << "/// " << std::endl; + os << "///
  • " << std::endl; +} + +static void +PrintDefaultValuesDoxygen (std::ostream &os) +{ + os << "/// \\page ListOfDefaultValues The list of default values" << std::endl; + os << "/// \\defgroup ListOfDefaultValuesGroup The list of default values" << std::endl; + os << "/// " << std::endl; +} + + +int main (int argc, char *argv[]) +{ + Ptr node = Create (); + node->AddInterface (Create ()); + + Ptr p2p = Create (node); + p2p->AddQueue (Queue::CreateDefault ()); + Ptr csma = Create (node); + csma->AddQueue (Queue::CreateDefault ()); + + TraceResolver::SourceCollection collection; + NodeList::GetTraceResolver ()->CollectSources ("", TraceContext (), &collection); + PrintDoxygenText (&collection, std::cout); + + + PrintDefaultValuesDoxygen (std::cout); + + return 0; +} diff -r 895b54d0ad73 -r c62b4aae737d utils/print-trace-sources.cc --- a/utils/print-trace-sources.cc Mon Oct 29 15:01:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,135 +0,0 @@ -#include "ns3/internet-node.h" -#include "ns3/ptr.h" -#include "ns3/trace-resolver.h" -#include "ns3/node-list.h" -#include "ns3/point-to-point-net-device.h" -#include "ns3/csma-net-device.h" -#include "ns3/queue.h" -#include "ns3/mobility-model-notifier.h" -#include "ns3/default-value.h" - -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; - } -} -static 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.Begin ().IsLast ()) - { - 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.Begin (); !m.IsLast (); m.Next ()) - { - os << "/// - " << m.Get () << 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++; - } -} - -static void -PrintOneDefaultValue (DefaultValueBase *value, std::ostream &os) -{ - os << "///
  • \\anchor DefaultValue" << value->GetName () - << " " << value->GetName () << std::endl; - os << "///
      " << std::endl; - os << "///
    • Type: " << value->GetType () << "" << std::endl; - os << "///
    • Default value: " << value->GetDefaultValue () << "" << std::endl; - os << "///
    • Description: " << value->GetHelp () << "" << std::endl; - os << "///
    " << std::endl; - os << "///
  • " << std::endl; -} - -static void -PrintDefaultValuesDoxygen (std::ostream &os) -{ - os << "/// \\page ListOfDefaultValues The list of default values" << std::endl; - os << "/// \\defgroup ListOfDefaultValuesGroup The list of default values" << std::endl; - os << "///
      " << std::endl; - for (DefaultValueList::Iterator i = DefaultValueList::Begin (); - i != DefaultValueList::End (); i++) - { - if ((*i)->GetName () == "help") - { - continue; - } - PrintOneDefaultValue (*i, os); - } - os << "///
    " << std::endl; -} - - -int main (int argc, char *argv[]) -{ - Ptr node = Create (); - node->AddInterface (Create ()); - - Ptr p2p = Create (node); - p2p->AddQueue (Queue::CreateDefault ()); - Ptr csma = Create (node); - csma->AddQueue (Queue::CreateDefault ()); - - TraceResolver::SourceCollection collection; - NodeList::GetTraceResolver ()->CollectSources ("", TraceContext (), &collection); - PrintDoxygenText (&collection, std::cout); - - - PrintDefaultValuesDoxygen (std::cout); - - return 0; -} diff -r 895b54d0ad73 -r c62b4aae737d utils/wscript --- a/utils/wscript Mon Oct 29 15:01:14 2007 +0100 +++ b/utils/wscript Mon Oct 29 15:01:36 2007 +0100 @@ -28,9 +28,9 @@ obj = bld.create_ns3_program('replay-simulation', ['simulator']) obj.source = 'replay-simulation.cc' - obj = bld.create_ns3_program('print-trace-sources', + obj = bld.create_ns3_program('print-introspected-doxygen', ['internet-node', 'csma-cd', 'point-to-point']) - obj.source = 'print-trace-sources.cc' + obj.source = 'print-introspected-doxygen.cc' if env['ENABLE_MOBILITY_VISUALIZER']: obj = bld.create_ns3_program('mobility-visualizer', diff -r 895b54d0ad73 -r c62b4aae737d wscript --- a/wscript Mon Oct 29 15:01:14 2007 +0100 +++ b/wscript Mon Oct 29 15:01:36 2007 +0100 @@ -215,8 +215,8 @@ ## generate the trace sources list docs env = Params.g_build.env_of_name('default') proc_env = _get_proc_env() - prog = _find_program('print-trace-sources', env).m_linktask.m_outputs[0].abspath(env) - out = open('doc/trace-source-list.h', 'w') + prog = _find_program('print-introspected-doxygen', env).m_linktask.m_outputs[0].abspath(env) + out = open('doc/introspected-doxygen.h', 'w') if subprocess.Popen([prog], stdout=out, env=proc_env).wait(): raise SystemExit(1) out.close() @@ -354,8 +354,8 @@ def doxygen(): - if not os.path.exists('doc/trace-source-list.h'): - Params.warning("doc/trace-source-list.h does not exist; run waf check to generate it.") + if not os.path.exists('doc/introspected-doxygen.h'): + Params.warning("doc/introspected-doxygen.h does not exist; run waf check to generate it.") ## run doxygen doxygen_config = os.path.join('doc', 'doxygen.conf')