OSFI-C++  3.10.0
OpenSF Integration Library
CLP Class Reference

#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
 

Detailed Description

Provides procedures to parse the command line arguments, generating a list of tokens grouped as:

  • Configuration files
  • Input files
  • Output files

Command line must follow one of the following formats (flag or positional). In particular, if any flagged option (-/–) is passed in, passing positional arguments mixed is an error.

In either form, 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 is made to the possible E2E_HOME variable.

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>)+

If the "local" or "global" options are provided multiple times, only the last value specified is kept for each of the flags.

Positional arguments:
<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>)*

Note that since the comma character is used as a separator, it cannot be part of a file name even if it is a legal path value in the platform.

Constructor & Destructor Documentation

◆ CLP()

CLP::CLP ( int  argc,
char *  argv[] 
)

Class constructor. Needs the command line arguments passed to main.

Parameters
argc- number of arguments
argv- list of array of characters
Exceptions
std::invalid_argumentin case of error.

◆ ~CLP()

virtual CLP::~CLP ( )
virtual

Class destructor.

Member Function Documentation

◆ getConfFile()

std::string CLP::getConfFile ( )

Gets the name of the configuration file. Configuration file can be "" is no configuration file is passed.

Deprecated:
Modules with no global configuration file are deprecated

◆ getConfFiles()

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 2 in which:

  • First entry is the global configuration file
  • Second entry is the local configuration file

Note that when not provided by CLI, the corresponding entry stores an empty string "".

Returns
the list of the configuration files.

◆ getInputFiles()

std::list<std::string> CLP::getInputFiles ( ) const
Returns
the list of the input files.

◆ getOutputFiles()

std::list<std::string> CLP::getOutputFiles ( ) const
Returns
the list of the output files.

The documentation for this class was generated from the following file: