= CommandLine and CommandLineArgument = [[TracNav(TracNav/TOC_Coding)]] These classes serve as a platform to easily declare command line arguments and retrieve them later. By 'later' the code before orxonox starts is being referred which means that we have to declare the possible arguments even before that. I have decided to do it before main via static variable initialisation. [[br]][[br]] == Declaration == If you would like to retrieve the value of a command line argument, you will have to declare it first anywhere in the source (the macro creates a dummy variable in order allow for code execution via function). {{{ namespace orxonox { SetCommandLineArgument(name, defaultValue).setShortcut('char') .setInformation(string); } }}} 'name' is the argument name (without quotation marks) and defaultValue deduces the type. [[br]] == Retrieving a value == Getting the values is quite easy via the static interface of the CommandLine class. Use getArgument(name) to retrieve the entire argument including the information whether the default value was used or not (i.e. argument given in command line or not). And use getValue(name, *value) to get the value directly. [[br]] Be careful with the types. If you declare an argument as (int), you will have to retrieve it with an (int)-type variable. == Passing command line parameters == You can either use full argument names or shortcuts like this: [[br]] {{{ ./orxonox --port 125 }}} or {{{ ./orxonox -p 125 }}} [[br]] Note the difference with "--" and "-". The value after the name or shortcut can be anything that converts to the given type. If the type is boolean and no value is given, it is automatically set to 'true' (so called command line switches). == Usage information == The user can choose to display information on how to use the arguments or display a list. This information is configured via setInformation(string) when declaring a CommandLineArgument. [[br]] The standard pattern is {{{[--name information]}}}