1 #ifndef jb_config_attribute_hpp 2 #define jb_config_attribute_hpp 18 #ifndef jb_config_object_hpp 19 #error "This file should only be included from jb/config_object.hpp" 20 #endif // !jb_config_object_hpp 53 template <
typename C,
typename T>
129 template <
typename... Args>
136 template <
typename... Args>
146 container_type* container,
154 container_type* container,
167 value_ = std::move(rhs.value_);
190 boost::program_options::options_description& options,
191 std::string
const& prefix,
198 boost::program_options::variables_map
const& vm,
199 std::string
const&
name)
override {
219 template <
typename C,
typename T>
226 template <
typename C,
typename T>
228 boost::program_options::options_description& options,
231 object.add_options(options, prefix, d);
234 template <
typename C,
typename T>
237 boost::program_options::variables_map
const& vm, std::string
const&
name) {
241 template <
typename C,
typename T>
246 template <
typename C,
typename T>
253 #endif // jb_config_attribute_hpp Breakout some of the helper classes from jb/config_object.hpp.
config_attribute(config_object::attribute_descriptor const &d, container_type *container, Args &&... args)
static void validate(T const &, Args...)
Validate an arbitrary object.
container_type *const container_
attribute_base(attribute_descriptor const &d, config_object *container)
Constructor.
void apply_cmdline_values(boost::program_options::variables_map const &vm, std::string const &name) override
Call the right version of jb::apply_cmdline_values.
YAML::Node to_yaml() const override
Print out the configuration settings in YAML format.
config_attribute(config_object::attribute_descriptor const &d, container_type *container)
Base class for all configuration objects.
std::map< std::string, YAML::Node > class_overrides
Store the overrides for each class.
config_attribute(container_type *container, config_attribute< container_type, value_type > const &rhs)
std::string const & name() const
void swap(config_attribute< container_type, value_type > &rhs)
Swap values, containers are not changed.
config_attribute(config_object::attribute_descriptor const &d, container_type *container, value_type &&t)
container_type & operator()(value_type &&x)
Modify value with move semantics.
config_attribute(container_type *container, value_type const &t)
config_attribute & operator=(config_attribute< container_type, value_type > const &rhs)
Helper class to easily define configuration attributes.
config_attribute(container_type *container, value_type &&t)
static YAML::Node to_yaml(T const &x, Args...)
Convert an arbitrary type to a YAML representation.
value_type const & operator()() const
Accessor.
config_attribute & operator=(config_attribute< container_type, value_type > &&rhs)
void apply_overrides(YAML::Node const &by_name, class_overrides const &by_class) override
Call the right version of jb::apply_overrides for the contained value.
config_attribute(config_object::attribute_descriptor const &d, container_type *container, value_type const &t)
Define the interface to manipulate and access configuration attributes embedded in a config_object...
config_attribute(container_type *container, Args &&... args)
config_attribute(container_type *container)
void add_options(boost::program_options::options_description &options, std::string const &prefix, config_object::attribute_descriptor const &d) const override
Call the right version of jb::add_options for the contained value.
Recursively apply functions to config_object, attributes, and sequences of config objects...
static void apply_cmdline_values(T &rhs, boost::program_options::variables_map const &vm, std::string const &name, Args...)
Get a value from the cmdline values and apply it to the object.
config_attribute(container_type *container, config_attribute< container_type, value_type > &&rhs)
void validate() const override
Call the right version of jb::validate.
container_type & operator()(value_type const &x)
Modify value.
static void apply_overrides(T &lhs, YAML::Node const &by_name, class_overrides const &by_class, Args...)
Override a value with the configuration contained in a YAML::Node.
static void add_options(boost::program_options::options_description &options, T const &object, std::string const &prefix, config_object::attribute_descriptor const &d, Args...)
Implement the basic construct to create command-line options ased on a config_object.
The top-level namespace for the JayBeams library.