utils/print-introspected-doxygen.cc
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Mon, 03 Mar 2008 01:58:57 +0100
changeset 2542 a9b88fdc09d6
parent 2540 4e9ba43f7b9e
child 2577 5b41cb5c3fcf
permissions -rw-r--r--
kill TraceResolver et al.
     1 #include "ns3/internet-node.h"
     2 #include "ns3/ptr.h"
     3 #include "ns3/node-list.h"
     4 #include "ns3/point-to-point-net-device.h"
     5 #include "ns3/csma-net-device.h"
     6 #include "ns3/queue.h"
     7 #include "ns3/drop-tail-queue.h"
     8 #include "ns3/mobility-model-notifier.h"
     9 #include "ns3/default-value.h"
    10 #include "ns3/string.h"
    11 
    12 using namespace ns3;
    13 
    14 
    15 static void
    16 PrintOneDefaultValue (DefaultValueBase *value, std::ostream &os)
    17 {
    18   os << "///  <li> \\anchor DefaultValue" << value->GetName ()
    19      << " " << value->GetName () << std::endl;
    20   os << "///    <ul>" << std::endl;
    21   os << "///         <li>Type: " << value->GetType () << "</td></tr>" << std::endl;
    22   os << "///         <li>Default value: " << value->GetDefaultValue () << "</td></tr>" << std::endl;
    23   os << "///         <li>Description: " << value->GetHelp () << "</td></tr>" << std::endl;
    24   os << "///    </ul>" << std::endl;
    25   os << "///  </li>" << std::endl;
    26 }
    27 
    28 static void
    29 PrintDefaultValuesDoxygen (std::ostream &os)
    30 {
    31   os << "/// \\page ListOfDefaultValues The list of default values" << std::endl;
    32   os << "/// \\defgroup ListOfDefaultValuesGroup The list of default values" << std::endl;
    33   os << "/// <ul>" << std::endl;
    34   for (DefaultValueList::Iterator i = DefaultValueList::Begin ();
    35        i != DefaultValueList::End (); i++)
    36     {
    37       if ((*i)->GetName () == "help")
    38 	{
    39 	  continue;
    40 	}
    41       PrintOneDefaultValue (*i, os);
    42     }
    43   os << "/// </ul>" << std::endl;
    44 }
    45 
    46 
    47 int main (int argc, char *argv[])
    48 {
    49   Ptr<Node> node = CreateObject<InternetNode> ();
    50   node->AggregateObject (CreateObject<MobilityModelNotifier> ());
    51 
    52   Ptr<PointToPointNetDevice> p2p = CreateObjectWith<PointToPointNetDevice> ("Node", node, 
    53 									    "Address", Mac48Address::Allocate ());
    54   node->AddDevice (p2p);
    55   p2p->AddQueue (CreateObject<DropTailQueue> ());
    56   Ptr<CsmaNetDevice> csma = CreateObjectWith<CsmaNetDevice> ("Node", node, 
    57 							     "Address", Mac48Address::Allocate (),
    58 							     "EncapsulationMode", String ("Llc"));
    59   node->AddDevice (csma);
    60   csma->AddQueue (CreateObject<DropTailQueue> ());
    61 
    62 
    63   PrintDefaultValuesDoxygen (std::cout);
    64 
    65   return 0;
    66 }