DiFfRG
Loading...
Searching...
No Matches
DiFfRG::ConfigurationHelper Class Reference

Class to read parameters given from the command line and from a parameter file. More...

#include <configuration_helper.hh>

Public Member Functions

 ConfigurationHelper (int argc, char *argv[], const std::string parameter_file="parameter.json")
 Construct a new Configuration Helper object To get an overview of the available arguments, just pass –help as an argument.
 
 ConfigurationHelper (const ConfigurationHelper &)
 Copy a Configuration Helper.
 
 ConfigurationHelper (const JSONValue &json)
 Construct a new Configuration Helper object from a JSONValue object.
 
void append (std::string arg)
 Add a CLI-like argument to the list of arguments.
 
JSONValueget_json ()
 Obtain the JSON object containing all the parameters.
 
const JSONValueget_json () const
 Obtain the JSON object containing all the parameters.
 
std::string get_log_file () const
 
std::string get_parameter_file () const
 
std::string get_output_name () const
 
std::string get_output_folder () const
 
std::string get_top_folder () const
 

Private Member Functions

void parse ()
 
void parse_cli ()
 
void setup_logging ()
 
void print_usage_message ()
 
void generate_parameter_file ()
 

Private Attributes

std::list< std::string > args
 
std::list< std::pair< std::string, std::string > > cli_parameters
 
uint depth_console = 0
 
uint depth_file = 3
 
JSONValue json
 
bool parsed
 
std::string parameter_file
 

Static Private Attributes

static bool logger_initialized
 

Detailed Description

Class to read parameters given from the command line and from a parameter file.

Constructor & Destructor Documentation

◆ ConfigurationHelper() [1/3]

DiFfRG::ConfigurationHelper::ConfigurationHelper ( int argc,
char * argv[],
const std::string parameter_file = "parameter.json" )

Construct a new Configuration Helper object To get an overview of the available arguments, just pass –help as an argument.

Parameters
argcForwarded argc from main() function
argvForwarded argv from main() function
parameter_fileThe name of the parameter file to be read

◆ ConfigurationHelper() [2/3]

DiFfRG::ConfigurationHelper::ConfigurationHelper ( const ConfigurationHelper & )

Copy a Configuration Helper.

◆ ConfigurationHelper() [3/3]

DiFfRG::ConfigurationHelper::ConfigurationHelper ( const JSONValue & json)

Construct a new Configuration Helper object from a JSONValue object.

Member Function Documentation

◆ append()

void DiFfRG::ConfigurationHelper::append ( std::string arg)

Add a CLI-like argument to the list of arguments.

◆ generate_parameter_file()

void DiFfRG::ConfigurationHelper::generate_parameter_file ( )
private

◆ get_json() [1/2]

JSONValue & DiFfRG::ConfigurationHelper::get_json ( )

Obtain the JSON object containing all the parameters.

◆ get_json() [2/2]

const JSONValue & DiFfRG::ConfigurationHelper::get_json ( ) const

Obtain the JSON object containing all the parameters.

◆ get_log_file()

std::string DiFfRG::ConfigurationHelper::get_log_file ( ) const

◆ get_output_folder()

std::string DiFfRG::ConfigurationHelper::get_output_folder ( ) const

◆ get_output_name()

std::string DiFfRG::ConfigurationHelper::get_output_name ( ) const

◆ get_parameter_file()

std::string DiFfRG::ConfigurationHelper::get_parameter_file ( ) const

◆ get_top_folder()

std::string DiFfRG::ConfigurationHelper::get_top_folder ( ) const

◆ parse()

void DiFfRG::ConfigurationHelper::parse ( )
private

◆ parse_cli()

void DiFfRG::ConfigurationHelper::parse_cli ( )
private

◆ print_usage_message()

void DiFfRG::ConfigurationHelper::print_usage_message ( )
private

◆ setup_logging()

void DiFfRG::ConfigurationHelper::setup_logging ( )
private

Member Data Documentation

◆ args

std::list<std::string> DiFfRG::ConfigurationHelper::args
private

◆ cli_parameters

std::list<std::pair<std::string, std::string> > DiFfRG::ConfigurationHelper::cli_parameters
private

◆ depth_console

uint DiFfRG::ConfigurationHelper::depth_console = 0
private

◆ depth_file

uint DiFfRG::ConfigurationHelper::depth_file = 3
private

◆ json

JSONValue DiFfRG::ConfigurationHelper::json
private

◆ logger_initialized

bool DiFfRG::ConfigurationHelper::logger_initialized
staticprivate

◆ parameter_file

std::string DiFfRG::ConfigurationHelper::parameter_file
private

◆ parsed

bool DiFfRG::ConfigurationHelper::parsed
private

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