src/core/command-line.h
changeset 4654 2eaebe77d66b
parent 3190 51fe9001a679
     1.1 --- a/src/core/command-line.h	Mon Jun 02 10:30:24 2008 -0700
     1.2 +++ b/src/core/command-line.h	Sat Jul 04 08:15:48 2009 +0200
     1.3 @@ -24,6 +24,8 @@
     1.4  #include <sstream>
     1.5  #include <list>
     1.6  
     1.7 +#include "ns3/callback.h"
     1.8 +
     1.9  namespace ns3 {
    1.10  
    1.11  /**
    1.12 @@ -56,6 +58,17 @@
    1.13  		 const std::string &help,
    1.14  		 T &value);
    1.15  
    1.16 +
    1.17 +  /**
    1.18 +   * \param name the name of the user-supplied argument
    1.19 +   * \param help some help text used by --PrintHelp
    1.20 +   * \param callback a callback function that will be invoked to parse
    1.21 +   * and collect the value.  This normally used by language bindings.
    1.22 +   */
    1.23 +  void AddValue (const std::string &name,
    1.24 +		 const std::string &help,
    1.25 +                 Callback<bool, std::string> callback);
    1.26 +
    1.27    /**
    1.28     * \param argc the 'argc' variable: number of arguments (including the
    1.29     *        main program name as first element).
    1.30 @@ -82,6 +95,13 @@
    1.31      virtual bool Parse (std::string value);
    1.32      T *m_valuePtr;
    1.33    };
    1.34 +  class CallbackItem : public Item
    1.35 +  {
    1.36 +  public:
    1.37 +    virtual bool Parse (std::string value);
    1.38 +    Callback<bool, std::string> m_callback;
    1.39 +  };
    1.40 +
    1.41    void HandleArgument (std::string name, std::string value) const;
    1.42    void PrintHelp (void) const;
    1.43    void PrintGlobals (void) const;