#pragma once #include #include namespace inaf::oasbo::Configurators { /** * @brief The BaseConfigurator class is an abstract base class for configurators in the DAQ system. * * It provides common functionality for reading and pushing configurations to a source, * as well as inserting new configurations into the existing ones. */ class BaseConfigurator{ protected: std::map config; public: /** * @brief Read the configuration from the source. * * @return int Returns 0 on success, or an error code on failure. */ virtual int readConfigFromSource() = 0; /** * @brief Read the configuration for the specified target. * * @param target The target for which to read the configuration. * @return int Returns 0 on success, or an error code on failure. */ virtual int readConfigFromSource(std::string target) = 0; /** * @brief Push the configuration to the source. * * @return int Returns 0 on success, or an error code on failure. */ virtual int pushConfigToSource() = 0; /** * @brief Push the configuration for the specified target. * * @param target The target for which to push the configuration. * @return int Returns 0 on success, or an error code on failure. */ virtual int pushConfigToSource(std::string target) = 0; /** * @brief Insert new configurations into the existing ones. * * @param newConfig The new configurations to insert. * @param target The target for which to insert the new configurations. * @return int Returns 0 on success, or an error code on failure. */ virtual int insert(std::map newConfig, std::string target) = 0; /** * @brief Get the current configuration. * * @return std::map The current configuration. */ virtual std::map getConfig() {return this->config;} /** * @brief Convert the configuration to a string representation. * * @return std::string The string representation of the configuration. */ std::string toString(){ std::string ret = ""; for( const std::pair n : config) { ret += n.first + " : " + n.second + "\n"; } return ret; } virtual ~BaseConfigurator() = default; }; }