From 115ef7ca180a7c52b7cc352e5b4642c427eff4a2 Mon Sep 17 00:00:00 2001 From: Raj Bhattacharjea Date: Fri, 11 May 2007 10:37:01 -0400 Subject: [PATCH] Added/fixed some doxygen --- doc/main.txt | 1 + src/applications/application.h | 121 +++++++++++++++++++-------------- src/core/command-line.h | 32 +++++++++ src/core/default-value.h | 22 ++++++ 4 files changed, 124 insertions(+), 52 deletions(-) diff --git a/doc/main.txt b/doc/main.txt index e267038ca..c2b398e7f 100644 --- a/doc/main.txt +++ b/doc/main.txt @@ -19,6 +19,7 @@ * - a class to register regression tests with the test manager: ns3::Test and ns3::TestManager * - debugging facilities: \ref debugging, \ref assert, \ref error * - \ref randomvariable + * - \ref config * - a class to handle automatic deletion of multiple sets of objects of different types: * ns3::ObjectContainer * diff --git a/src/applications/application.h b/src/applications/application.h index 9d6c4cb4d..235e8b4bc 100644 --- a/src/applications/application.h +++ b/src/applications/application.h @@ -21,32 +21,6 @@ #ifndef __APPLICATION_H__ #define __APPLICATION_H__ -// -// \brief The base class for all ns3 applicationes -// -// Class Application is the base class for all ns3 applications. -// Applications are associated with individual nodes, and are created -// using the AddApplication method in the ApplicationManager capability. -// -// Conceptually, an application has zero or more Socket -// objects associated with it, that are created using the Socket -// creation API of the Kernel capability. The Socket object -// API is modeled after the -// well-known BSD sockets interface, although it is somewhat -// simplified for use with ns3. Further, any socket call that -// would normally "block" in normal sockets will return immediately -// in ns3. A set of "upcalls" are defined that will be called when -// the previous blocking call would normally exit. THis is documented -// in more detail Socket class in socket.h. -// -// There is a second application class in ns3, called "ThreadedApplication" -// that implements a true sockets interface, which should be used -// when porting existing sockets code to ns3. The true -// sockets approach is significantly -// less memory--efficient using private stacks for each defined application, -// so that approach should be used with care. The design and implementation -// of the ThreadedApplication are still being discussed. - #include "ns3/event-id.h" #include "ns3/nstime.h" #include "ns3/object.h" @@ -56,6 +30,32 @@ namespace ns3 { class Node; class RandomVariable; +/** + * \brief The base class for all ns3 applicationes + * + * Class Application is the base class for all ns3 applications. + * Applications are associated with individual nodes, and are created + * using the AddApplication method in the ApplicationManager capability. + * + * Conceptually, an application has zero or more Socket + * objects associated with it, that are created using the Socket + * creation API of the Kernel capability. The Socket object + * API is modeled after the + * well-known BSD sockets interface, although it is somewhat + * simplified for use with ns3. Further, any socket call that + * would normally "block" in normal sockets will return immediately + * in ns3. A set of "upcalls" are defined that will be called when + * the previous blocking call would normally exit. THis is documented + * in more detail Socket class in socket.h. + * + * There is a second application class in ns3, called "ThreadedApplication" + * that implements a true sockets interface, which should be used + * when porting existing sockets code to ns3. The true + * sockets approach is significantly + * less memory--efficient using private stacks for each defined application, + * so that approach should be used with care. The design and implementation + * of the ThreadedApplication are still being discussed. + */ class Application : public Object { public: @@ -66,43 +66,60 @@ public: virtual Application* Copy() const = 0; // All applications must provide - // \brief Specify application start time - // Applications start at various times in the simulation scenario. - // The Start method specifies when the application should be - // started. The application subclasses should override the - // private "StartApplication" method defined below, which is called at the - // time specified, to cause the application to begin. - // \param Start time for this application, relative to the - // current simulation time. + /** + * \brief Specify application start time + * + * Applications start at various times in the simulation scenario. + * The Start method specifies when the application should be + * started. The application subclasses should override the + * private "StartApplication" method defined below, which is called at the + * time specified, to cause the application to begin. + * \param Start time for this application, relative to the + * current simulation time. + */ void Start(const Time&); - // \brief Same as above, but uses a random variable for start time - // The random variable returns the desired start time in units of - // Seconds. + /** + * \brief Same as above, but uses a random variable for start time + * + * The random variable returns the desired start time in units of + * Seconds. + */ void Start(const RandomVariable&); - // \brief Specify application stop time - // Once an application has started, it is sometimes useful - // to stop the application. The Stop method specifies when an - // application is to stop. The application subclasses should override - // the private StopApplication method defined below, to cause the application - // to stop. - // \param Stop time for this application, relative to the - // current simulation time. + /** + * \brief Specify application stop time + * + * Once an application has started, it is sometimes useful + * to stop the application. The Stop method specifies when an + * application is to stop. The application subclasses should override + * the private StopApplication method defined below, to cause the application + * to stop. + * \param Stop time for this application, relative to the + * current simulation time. + */ void Stop(const Time&); - // \brief Same as above, but uses a random variable for stop time - // The random variable returns the desired stop time in units of - // Seconds. + /** + * \brief Same as above, but uses a random variable for stop time + * + * The random variable returns the desired stop time in units of + * Seconds. + */ void Stop(const RandomVariable&); - // \brief Attaches an application to a specific node - // Specifies which node object this application is associated with. - // \param Node object to associate with this application. + /** + * \brief Attaches an application to a specific node + * + * Specifies which node object this application is associated with. + * \param Node object to associate with this application. + */ void SetNode(Node *); - // \brief Returns the pointer to the attached node. + /** + * \brief Returns the pointer to the attached node. + */ Node* PeekNode() const; // Members diff --git a/src/core/command-line.h b/src/core/command-line.h index f3186fde5..046058dd4 100644 --- a/src/core/command-line.h +++ b/src/core/command-line.h @@ -8,16 +8,48 @@ namespace ns3 { +/** + * \brief Command line argument processing class + * \ingroup config + * + * Often times in simulations, the user will want the ability to change and + * tweak simulation parameters without having to recompile the entire + * simulation. This can be done by passing arguments in from the command + * line invocation of a simulation. + * This class is a collection of static functions to aid in this facility. + * By using it, users get the automatic things like support for --help command + * line arguments. See samples/main-default-value.cc for more info. + */ class CommandLine { public: + /** + * \brief Add a command line argument to the system + * \param name Name of the string to expect on the command line + * \param help A help string for this param, displayed --help is used. + * \param value The desination to store the value read from the command line + */ template static void AddArgValue (const std::string &name, const std::string &help, T &value); + /** + * \brief Add a command line triggered function call to the system + * \param name Name of the string to expect on the command line + * \param help A help string for this param, displayed --help is used. + * \param value An ns3::Callback that gets called if name is present as a + * commandline argument. + */ static void AddArgCommand (const std::string &name, const std::string &help, Callback cb); + /** + * \brief Parse the command line for arguments thus far added + * \param argc Number of strings on the command line; pass this directly from + * the first argument of your main(int,char**) function + * \param argv Array of strings passed in as arguments; pass this directly from + * the second argument of your main(int,char**) function + */ static void Parse (int argc, char *argv[]); private: template diff --git a/src/core/default-value.h b/src/core/default-value.h index ef703ce84..f64e691fb 100644 --- a/src/core/default-value.h +++ b/src/core/default-value.h @@ -6,6 +6,11 @@ #include #include "callback.h" +/** + * \defgroup config Simulation configuration + * + */ + namespace ns3 { class DefaultValueBase @@ -45,6 +50,7 @@ class DefaultValueList }; /** + * \ingroup config * \param name name of variable to bind * \param value value to bind to the specified variable * @@ -58,6 +64,7 @@ void Bind (std::string name, std::string value); /** * \brief A Boolean variable for ns3::Bind + * \ingroup config * * Every instance of this type is automatically * registered in the variable pool which is used @@ -95,6 +102,7 @@ private: /** * \brief An Integer variable for ns3::Bind + * \ingroup config * * Every instance of this type is automatically * registered in the variable pool which is used @@ -147,6 +155,14 @@ private: T m_value; }; +/** + * \brief Named enumeration defaults + * \ingroup config + * + * Every instance of this type is automatically + * registered in the variable pool which is used + * by ns3::Bind. + */ class StringEnumDefaultValue : public DefaultValueBase { public: @@ -168,6 +184,7 @@ private: /** * \brief An enum variable for ns3::Bind + * \ingroup config * * Every instance of this type is automatically * registered in the variable pool which is used @@ -232,6 +249,11 @@ public: T m_value; }; +/** + * \brief Class used to call a certain function during the configuration of the + * simulation + * \ingroup config + */ class CommandDefaultValue : public DefaultValueBase { public: