parse command-line argumentsInstances of this class can be used to parse command-line arguments: users can register new arguments with CommandLine::AddValue but the most important functionality provided by this class is that it can be used to set the 'initial value' of every attribute in the system with the --TypeIdNameAttributeName=value syntax and it can be used to set the value of every GlobalValue in the system with the --GlobalValueName=value syntax.
More...
#include <command-line.h>
List of all members.
Public Member Functions |
template<typename T > |
void | AddValue (const std::string &name, const std::string &help, T &value) |
void | AddValue (const std::string &name, const std::string &help, Callback< bool, std::string > callback) |
void | Parse (int argc, char *argv[]) const |
Detailed Description
parse command-line arguments
Instances of this class can be used to parse command-line arguments: users can register new arguments with CommandLine::AddValue but the most important functionality provided by this class is that it can be used to set the 'initial value' of every attribute in the system with the --TypeIdNameAttributeName=value syntax and it can be used to set the value of every GlobalValue in the system with the --GlobalValueName=value syntax.
Member Function Documentation
template<typename T >
void ns3::CommandLine::AddValue |
( |
const std::string & |
name, |
|
|
const std::string & |
help, |
|
|
T & |
value | |
|
) |
| | |
- Parameters:
-
| name | the name of the user-supplied argument |
| help | some help text used by --PrintHelp |
| value | a reference to the variable where the value parsed will be stored (if no value is parsed, this variable is not modified). |
void ns3::CommandLine::AddValue |
( |
const std::string & |
name, |
|
|
const std::string & |
help, |
|
|
Callback< bool, std::string > |
callback | |
|
) |
| | |
- Parameters:
-
| name | the name of the user-supplied argument |
| help | some help text used by --PrintHelp |
| callback | a callback function that will be invoked to parse and collect the value. This normally used by language bindings. |
void ns3::CommandLine::Parse |
( |
int |
argc, |
|
|
char * |
argv[] | |
|
) |
| | const |
- Parameters:
-
| argc | the 'argc' variable: number of arguments (including the main program name as first element). |
| argv | the 'argv' variable: a null-terminated array of strings, each of which identifies a command-line argument. |
Obviously, this method will parse the input command-line arguments and will attempt to handle them all.
The documentation for this class was generated from the following file: