OSFI-C++
3.9.2
OpenSF Integration Library
|
#include <CLP.h>
Public Member Functions | |
CLP (int argc, char *argv[]) | |
virtual | ~CLP () |
std::string | getConfFile () |
std::list< std::string > | getConfFiles () const |
std::list< std::string > | getInputFiles () const |
std::list< std::string > | getOutputFiles () const |
Friends | |
struct | CLPTest |
Provides procedures to parse the command line arguments, generating a list of tokens grouped as:
Command line must follow one of the following formats (flag or positional)
Flag inputs:
<command_line> ::= <executable> <options> <options> ::= (<global_configuration> | <local_configuration> | <input_file> | <output_file>)* <executable>> ::= <file_name> <global_configuration> ::= (–global|-g) <file_name> <local_configuration> ::= (–local|-l) <file_name> <input_file> ::= (–input|-i) <file_name> <output_file> ::= (–output|-o) <file_name> <file_name> ::= (<alphanumeric>)+
All tokens are separated by space, which means that commas can now be used as part of <file_name>
Notice: the above specification allows for multiple -global/-local options. In case multiple options are defined, a complying implementation considers the value of the last option specified. Expected OSFI behaviour: if any option (-/–) is passed in, then only options should be processed – in this case, passing positional arguments mixed with the flag options is considered an error
Positional arguments (expressed in Extended Backus-Naur form):
<command_line> ::= <executable_name> <whitespaces> <configuration_files> <whitespaces> <input_files> <whitespaces> <output_files> <EOL> <executable_name> ::= <file_name> <whitespace> ::= (“ “) <whitespaces> ::= <whitespace>+ <file_name> ::= (<alphanumeric>)+ <configuration_files> ::= <list_of_files> <input_files> ::= <list_of_files> <output_files> ::= <list_of_files> <list_of_files> ::= <file_name> (“,” <file_name>)*
File names must be valid OS-dependant file locations. Per the E2E-ICD, the configuration, input and output file names can be either a full-path name or a relative path name. Relative path names are interpreted by the module as relative to the current working directory. In particular, no reference to the possible E2E_HOME variable is made.
CLP::CLP | ( | int | argc, |
char * | argv[] | ||
) |
Class constructor. Needs the command line arguments passed to main
.
argc | - number of arguments |
argv | - list of array of characters |
std::invalid_argument | in case of error. |
|
virtual |
Class destructor.
std::string CLP::getConfFile | ( | ) |
Gets the name of the configuration file. Configuration file can be "" is no configuration file is passed.
std::list<std::string> CLP::getConfFiles | ( | ) | const |
Whether the global or the local conf files were present in the CLI or not, it always returns a list of size two in which:
Note that when no provided by CLI, the confFiles corresponding position stores an empty string ""
std::list<std::string> CLP::getInputFiles | ( | ) | const |
std::list<std::string> CLP::getOutputFiles | ( | ) | const |