diff --git a/deps/Base-DAQ b/deps/Base-DAQ index 8a0ea2d0e699863df5fe1c91caf2d7b0855957be..a00f9a27afbf5f75dab7db2368b9b9b6fcb395e1 160000 --- a/deps/Base-DAQ +++ b/deps/Base-DAQ @@ -1 +1 @@ -Subproject commit 8a0ea2d0e699863df5fe1c91caf2d7b0855957be +Subproject commit a00f9a27afbf5f75dab7db2368b9b9b6fcb395e1 diff --git a/include/CL_Conf.h b/include/CL_Conf.h index 87f3086d5d4fd812b5eaf81f6537551857b9f932..8e1863ba44f2ead5c754d19a9501f50a3c4e6eef 100644 --- a/include/CL_Conf.h +++ b/include/CL_Conf.h @@ -4,21 +4,36 @@ namespace inaf::oasbo::Configurators { - +/** + * @brief The CLConfigurator class is a concrete implementation of the BaseConfigurator class. + * It provides functionality to read and push configurations from/to a source using command line arguments (--param1 --param2 and so on). + * Check the Base_Configurator.h file for more information. + */ class CLConfigurator: public BaseConfigurator { protected: - int argc; - char** argv; + int argc; /**< The number of command line arguments. */ + char **argv; /**< The array of command line arguments. */ public: - CLConfigurator(int argc, char** argv); + /** + * @brief Constructs a CLConfigurator object with the specified command line arguments. + * @param argc The number of command line arguments. + * @param argv The array of command line arguments. + */ + CLConfigurator(int argc, char **argv); int readConfigFromSource() override; + int readConfigFromSource(std::string target) override; + int pushConfigToSource() override; + int pushConfigToSource(std::string target) override; + int insert(std::map, std::string target) override; - ~CLConfigurator() { } + + ~CLConfigurator() { + } }; } diff --git a/src/CL_Conf.cpp b/src/CL_Conf.cpp index dec6995f8a2df1823868a6ba9276fd23c8ad7450..1fafc1c28e61efa456a7b3d95dbeb2ce73b31e67 100644 --- a/src/CL_Conf.cpp +++ b/src/CL_Conf.cpp @@ -17,27 +17,28 @@ int CLConfigurator::pushConfigToSource() { } int CLConfigurator::readConfigFromSource(std::string target) { - for (int i = 1; i < argc-1; ++i) { + for (int i = 1; i < argc - 1; ++i) { std::string arg = argv[i]; boost::to_lower(arg); - size_t posTarget = arg.find("--"+target); + size_t posTarget = arg.find("--" + target); size_t posSeparator = arg.find('_'); - if (posTarget == 0 && posSeparator == std::string("--"+target).size()) { + if (posTarget == 0 + && posSeparator == std::string("--" + target).size()) { std::string key = arg.substr(2); - this->config[key] = argv[i+1]; + this->config[key] = argv[i + 1]; } } return 1; } int CLConfigurator::readConfigFromSource() { - for (int i = 1; i < argc-1; ++i) { + for (int i = 1; i < argc - 1; ++i) { std::string arg = argv[i]; size_t posDash = arg.find("--"); size_t posSeparator = arg.find('_'); if (posDash == 0 && posSeparator != std::string::npos) { std::string key = arg.substr(2); - this->config[key] = argv[i+1]; + this->config[key] = argv[i + 1]; } } return 1;