10 #ifndef DAQ_DPM_SERVER_CONFIGMANAGER_HPP
11 #define DAQ_DPM_SERVER_CONFIGMANAGER_HPP
15 #include <boost/numeric/conversion/cast.hpp>
53 m_mgr.
Visit(std::forward<Func>(func));
60 template <
class AttrType,
class T>
61 void UpdateFromConfig(T* ptr,
62 elt::configng::CiiConfigInstanceNode
const& node,
64 auto info = m_mgr.
Get(ptr);
66 if (
auto value = GetParamAs<AttrType>(info.metadata.canonical_name, node); value) {
67 if constexpr (std::is_same_v<T, std::uint16_t>) {
68 m_mgr.
Update(ptr, boost::numeric_cast<std::uint16_t>(*value), origin);
69 }
else if constexpr (std::is_same_v<T, std::chrono::seconds>) {
70 m_mgr.
Update(ptr, T{*value}, origin);
72 m_mgr.
Update(ptr, *value, origin);
76 log4cplus::Logger m_logger;
Maintains the associativity of configuration attributes with metadata and value origin/priority.
void Visit(Func &&func)
Visit each registered parameter.
bool Update(AttrType *ptr, T const &value, OriginInfo const &origin)
Update configuration value taking into account the origin of the change.
CurrentValue< AttrType > Get(AttrType *ptr) const
Get current configuration value and associated metadata and origin.
DPM Server specific configuration manager.
Configuration const & GetConfig() const
ConfigManager(log4cplus::Logger logger)
void LoadConfig()
Load configuration file and update configuration.
bool ParseArguments(int argc, char *argv[])
Parse configuration from command line arguments.
void Visit(Func &&func)
Visit all configuration parameters.
daq::config::Manager and associated types.
@ Configuration
Configuration file.
std::optional< T > GetParamAs(std::string const &query, elt::configng::CiiConfigInstanceNode const &node)
Performs lookup of parameters in the form root/node/leaf relative to the provided node.
Mutable metadata about a configuration attribute that describes where a value comes from.
Represents active configuration.