Bayeux
3.4.1
Core Foundation library for SuperNEMO
|
Configuration variant string preprocessor. More...
#include <bayeux/datatools/configuration/io.h>
Public Types | |
enum | flag_type { FLAG_TRACE = datatools::bit_mask::bit00, FLAG_REMOVE_QUOTES = datatools::bit_mask::bit01 } |
Construction flags. More... | |
Public Member Functions | |
bool | is_remove_quotes () const |
Check the remove quotes flag. More... | |
void | set_remove_quotes (bool) |
Set the remove quotes flag. More... | |
variant_preprocessor (unsigned int flags_=0) | |
Default constructor. More... | |
bool | has_repository () const |
Check if a variant configuration repository is used. More... | |
void | set_repository (const variant_repository &repository_) |
Set the variant configuration repository. More... | |
void | reset_repository () |
Reset the variant configuration repository. More... | |
bool | repository_is_active () const |
Check if the variant configuration repository is active. More... | |
const variant_repository & | get_repository () const |
Get the variant configuration repository. More... | |
command::returned_info | preprocess (const std::string &source_, std::string &target_) const |
Process a source string into a target string. More... | |
std::string | preprocess_string (const std::string &source_) const |
Process a source string into a target string. More... | |
bool | preprocess_boolean (const std::string &source_) const |
Process a source string into a target boolean. More... | |
int | preprocess_integer (const std::string &source_) const |
Process a source string into a target integer. More... | |
double | preprocess_real (const std::string &source_) const |
Process a source string into a target double. More... | |
void | preprocess_args_options (int argc_, char **argv_, std::vector< std::string > &preprocessed_args_) |
Process a list of arguments and options. More... | |
void | preprocess_args_options (const std::vector< std::string > &args_, std::vector< std::string > &preprocessed_args_) |
Process a list of arguments and options. More... | |
command::returned_info | preprocess_parameter (const std::string ¶meter_token_, std::string ¶meter_effective_token_) const |
Process a source string into a target string as a variant parameter. More... | |
command::returned_info | resolve_variant (const std::string &variant_desc_, bool &variant_active_, bool &variant_reverse_) const |
logger::priority | get_logging () const |
Return the logging priority. More... | |
void | set_logging (logger::priority) |
Set the logging priority. More... | |
Configuration variant string preprocessor.
datatools::configuration::variant_preprocessor::variant_preprocessor | ( | unsigned int | flags_ = 0 | ) |
Default constructor.
logger::priority datatools::configuration::variant_preprocessor::get_logging | ( | ) | const |
Return the logging priority.
const variant_repository& datatools::configuration::variant_preprocessor::get_repository | ( | ) | const |
Get the variant configuration repository.
bool datatools::configuration::variant_preprocessor::has_repository | ( | ) | const |
Check if a variant configuration repository is used.
bool datatools::configuration::variant_preprocessor::is_remove_quotes | ( | ) | const |
Check the remove quotes flag.
command::returned_info datatools::configuration::variant_preprocessor::preprocess | ( | const std::string & | source_, |
std::string & | target_ | ||
) | const |
Process a source string into a target string.
void datatools::configuration::variant_preprocessor::preprocess_args_options | ( | int | argc_, |
char ** | argv_, | ||
std::vector< std::string > & | preprocessed_args_ | ||
) |
Process a list of arguments and options.
The 'argc_' and 'argv_' parameters should be the same as passed to 'main'.
void datatools::configuration::variant_preprocessor::preprocess_args_options | ( | const std::vector< std::string > & | args_, |
std::vector< std::string > & | preprocessed_args_ | ||
) |
Process a list of arguments and options.
The 'args_' parameter should not include program name.
bool datatools::configuration::variant_preprocessor::preprocess_boolean | ( | const std::string & | source_ | ) | const |
Process a source string into a target boolean.
int datatools::configuration::variant_preprocessor::preprocess_integer | ( | const std::string & | source_ | ) | const |
Process a source string into a target integer.
command::returned_info datatools::configuration::variant_preprocessor::preprocess_parameter | ( | const std::string & | parameter_token_, |
std::string & | parameter_effective_token_ | ||
) | const |
Process a source string into a target string as a variant parameter.
double datatools::configuration::variant_preprocessor::preprocess_real | ( | const std::string & | source_ | ) | const |
Process a source string into a target double.
std::string datatools::configuration::variant_preprocessor::preprocess_string | ( | const std::string & | source_ | ) | const |
Process a source string into a target string.
bool datatools::configuration::variant_preprocessor::repository_is_active | ( | ) | const |
Check if the variant configuration repository is active.
void datatools::configuration::variant_preprocessor::reset_repository | ( | ) |
Reset the variant configuration repository.
command::returned_info datatools::configuration::variant_preprocessor::resolve_variant | ( | const std::string & | variant_desc_, |
bool & | variant_active_, | ||
bool & | variant_reverse_ | ||
) | const |
Parse a string and check if a given configuration variant is activate
variant_desc_ | The string to be parsed |
variant_active_ | The flag that checks if the variant is activated |
variant_reverse_ | The flag that checks if the test must be reversed |
command::CEC_SUCCESS : variant has been succesfully resolved or default value is used command::CEC_PARSING_FAILURE : syntax error in variant description command::CEC_CONTEXT_INVALID : variant repository is not activated command::CEC_SCOPE_INVALID : variant registry is unknown command::CEC_PARAMETER_INVALID_KEY : variant record is unknown
Supported syntax is:
Case 1:
The 'variant_active_' value is set to true if the 'geometry:has_detector_0/if_detector' variant is found activated from the variant repository. The 'variant_reverse_' flag is set to false.
Case 2:
The 'variant_active_' value is set to true if the 'geometry:has_detector_0/if_detector' variant is found activated from the variant repository. The 'variant_reverse_' flag is set to false. if the 'geometry:has_detector_0/if_detector' variant is not found from the variant repository, the 'variant_active_' is set to 'true' by default.
Case 3:
The 'variant_active_' value is set to true if the 'geometry:has_detector_0/if_detector' variant is found activated from the variant repository, false elsewhere. The 'variant_reverse_' flag is set to true to indicate that the test uses reversed logic.
void datatools::configuration::variant_preprocessor::set_logging | ( | logger::priority | ) |
Set the logging priority.
void datatools::configuration::variant_preprocessor::set_remove_quotes | ( | bool | ) |
Set the remove quotes flag.
void datatools::configuration::variant_preprocessor::set_repository | ( | const variant_repository & | repository_ | ) |
Set the variant configuration repository.