JayBeams
0.1
Another project to have fun coding.
|
Recursively apply functions to config_object, attributes, and sequences of config objects. More...
#include <config_recurse.hpp>
Static Public Member Functions | |
template<typename T , typename... Args> | |
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. More... | |
template<typename T > | |
static std::enable_if< std::is_base_of< config_object, T >::value, void >::type | apply_overrides (T &lhs, YAML::Node const &by_name, class_overrides const &by_class) |
Partial specialization for classes derived from jb::config_object. More... | |
template<typename C , typename T > | |
static void | apply_overrides (config_attribute< C, T > &lhs, YAML::Node const &by_name, class_overrides const &by_class) |
Partial specialization for jb::config_attribute. More... | |
template<typename Sequence > | |
static std::enable_if< std::is_base_of< config_object, typename Sequence::value_type >::value, void >::type | apply_overrides (Sequence &lhs, YAML::Node const &by_name, class_overrides const &by_class) |
Partial specialization for anything looking like a sequence of jb::config_object. More... | |
template<typename T , typename... Args> | |
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. More... | |
template<typename T > | |
static std::enable_if< std::is_base_of< config_object, T >::value, void >::type | add_options (boost::program_options::options_description &options, T const &object, std::string const &prefix, config_object::attribute_descriptor const &d) |
Partial specialization for classes derived from jb::config_object. More... | |
template<typename C , typename T > | |
static void | add_options (boost::program_options::options_description &options, config_attribute< C, T > const &object, std::string const &prefix, config_object::attribute_descriptor const &d) |
Partial specialization for configuration attribute. More... | |
template<typename Sequence > | |
static std::enable_if< std::is_base_of< config_object, typename Sequence::value_type >::value, void >::type | add_options (boost::program_options::options_description &options, Sequence const &object, std::string const &prefix, config_object::attribute_descriptor const &d) |
Partial specialization for anything looking like a sequence of jb::config_object. More... | |
template<typename U , typename V > | |
static void | add_options (boost::program_options::options_description &options, std::pair< U, V > const &object, std::string const &prefix, config_object::attribute_descriptor const &d) |
Partial specialization for things that look like pairs. More... | |
template<typename T , typename... Args> | |
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. More... | |
template<typename T > | |
static std::enable_if< std::is_base_of< config_object, T >::value, void >::type | apply_cmdline_values (T &rhs, boost::program_options::variables_map const &vm, std::string const &name) |
Partial specialization for jb::config_object and derived classes. More... | |
template<typename C , typename T > | |
static void | apply_cmdline_values (config_attribute< C, T > &rhs, boost::program_options::variables_map const &vm, std::string const &name) |
Partial specialization for configuration attribute. More... | |
template<typename Sequence > | |
static std::enable_if< std::is_base_of< config_object, typename Sequence::value_type >::value, void >::type | apply_cmdline_values (Sequence &rhs, boost::program_options::variables_map const &vm, std::string const &name) |
Partial specialization for anything looking like a sequence of jb::config_object. More... | |
template<typename U , typename V > | |
static void | apply_cmdline_values (std::pair< U, V > &rhs, boost::program_options::variables_map const &vm, std::string const &name) |
Partial specialization for std::pair<>. More... | |
template<typename T , typename... Args> | |
static void | validate (T const &, Args...) |
Validate an arbitrary object. More... | |
template<typename T > | |
static std::enable_if< std::is_base_of< config_object, T >::value, void >::type | validate (T const &object) |
Partial specialization of validate() for jb::config_object and derived classes. More... | |
template<typename C , typename T > | |
static void | validate (config_attribute< C, T > const &object) |
Partial of validate() for specialization for jb::config_attribute<>. More... | |
template<typename Sequence > | |
static std::enable_if< std::is_base_of< config_object, typename Sequence::value_type >::value, void >::type | validate (Sequence const &seq) |
Partial specialization of validate() for anything looking like a sequence of jb::config_object. More... | |
template<typename U , typename V > | |
static void | validate (std::pair< U, V > const &object) |
Partial specialization of validate() for std::pair<>. More... | |
template<typename T , typename... Args> | |
static YAML::Node | to_yaml (T const &x, Args...) |
Convert an arbitrary type to a YAML representation. More... | |
template<typename T > | |
static std::enable_if< std::is_base_of< config_object, T >::value, YAML::Node >::type | to_yaml (T const &object) |
Partial specialization of to_yaml() for jb::config_object and derived classes. More... | |
template<typename C , typename T > | |
static YAML::Node | to_yaml (config_attribute< C, T > const &object) |
Partial of to_yaml() for specialization for jb::config_attribute<>. More... | |
template<typename Sequence > | |
static std::enable_if< std::is_base_of< config_object, typename Sequence::value_type >::value, YAML::Node >::type | to_yaml (Sequence const &seq) |
Partial specialization of to_yaml() for anything looking like a sequence of jb::config_object. More... | |
template<typename U , typename V > | |
static YAML::Node | to_yaml (std::pair< U, V > const &object) |
Partial specialization of to_yaml() for std::pair<>. More... | |
Recursively apply functions to config_object, attributes, and sequences of config objects.
This is implemented as a struct with static functions (instead of standalone functions), so jb::config_object can forward declare the struct and grant 'friend' access to functions that should not be exposed otherwise.
Definition at line 41 of file config_recurse.hpp.
|
inlinestatic |
Implement the basic construct to create command-line options ased on a config_object.
Definition at line 115 of file config_recurse.hpp.
References jb::config_object::cmdline_arg_name(), jb::config_object::attribute_descriptor::helpmsg, and jb::config_object::attribute_descriptor::name.
Referenced by add_options(), and jb::config_attribute< jb::testing::microbenchmark_config, bool >::add_options().
|
inlinestatic |
Partial specialization for classes derived from jb::config_object.
Definition at line 130 of file config_recurse.hpp.
References add_options(), jb::config_object::cmdline_arg_name(), and jb::config_object::attribute_descriptor::name.
|
static |
Partial specialization for configuration attribute.
Definition at line 227 of file config_attribute.hpp.
|
inlinestatic |
Partial specialization for anything looking like a sequence of jb::config_object.
Definition at line 154 of file config_recurse.hpp.
References add_options(), jb::config_object::cmdline_arg_name(), jb::config_object::attribute_descriptor::help(), jb::config_object::attribute_descriptor::helpmsg, jb::config_object::attribute_descriptor::name, and jb::testing::defaults::size.
|
inlinestatic |
Partial specialization for things that look like pairs.
Definition at line 180 of file config_recurse.hpp.
References add_options(), jb::config_object::cmdline_arg_name(), jb::config_object::attribute_descriptor::help(), jb::config_object::attribute_descriptor::helpmsg, and jb::config_object::attribute_descriptor::name.
|
inlinestatic |
Get a value from the cmdline values and apply it to the object.
Definition at line 200 of file config_recurse.hpp.
Referenced by jb::config_attribute< jb::testing::microbenchmark_config, bool >::apply_cmdline_values(), and apply_cmdline_values().
|
inlinestatic |
Partial specialization for jb::config_object and derived classes.
Definition at line 214 of file config_recurse.hpp.
References apply_cmdline_values().
|
static |
Partial specialization for configuration attribute.
Definition at line 235 of file config_attribute.hpp.
References jb::config_attribute< C, T >::apply_cmdline_values().
|
inlinestatic |
Partial specialization for anything looking like a sequence of jb::config_object.
Definition at line 236 of file config_recurse.hpp.
References apply_cmdline_values(), and jb::config_object::cmdline_arg_name().
|
inlinestatic |
Partial specialization for std::pair<>.
Definition at line 257 of file config_recurse.hpp.
References apply_cmdline_values(), and jb::config_object::cmdline_arg_name().
|
inlinestatic |
Override a value with the configuration contained in a YAML::Node.
This generic implementation is used by basic types (int, string, vector, etc). We provide partial specializations for all the interesting types (jb::config_attribute, jb::config_objects).
The variadic template makes this the weakest match for resolution when compared to the other partial specializations.
Definition at line 53 of file config_recurse.hpp.
Referenced by apply_overrides(), and jb::config_attribute< jb::testing::microbenchmark_config, bool >::apply_overrides().
|
inlinestatic |
Partial specialization for classes derived from jb::config_object.
Definition at line 69 of file config_recurse.hpp.
References apply_overrides().
|
static |
Partial specialization for jb::config_attribute.
Definition at line 220 of file config_attribute.hpp.
References jb::config_attribute< C, T >::apply_overrides().
|
inlinestatic |
Partial specialization for anything looking like a sequence of jb::config_object.
Definition at line 90 of file config_recurse.hpp.
References apply_overrides().
|
inlinestatic |
Convert an arbitrary type to a YAML representation.
Definition at line 316 of file config_recurse.hpp.
Referenced by jb::config_attribute< jb::testing::microbenchmark_config, bool >::to_yaml(), and to_yaml().
|
inlinestatic |
Partial specialization of to_yaml() for jb::config_object and derived classes.
Definition at line 329 of file config_recurse.hpp.
References to_yaml().
|
static |
Partial of to_yaml() for specialization for jb::config_attribute<>.
Definition at line 247 of file config_attribute.hpp.
References jb::config_attribute< C, T >::to_yaml().
|
inlinestatic |
Partial specialization of to_yaml() for anything looking like a sequence of jb::config_object.
Definition at line 348 of file config_recurse.hpp.
References to_yaml().
|
inlinestatic |
Partial specialization of to_yaml() for std::pair<>.
Definition at line 360 of file config_recurse.hpp.
|
inlinestatic |
Validate an arbitrary object.
Definition at line 268 of file config_recurse.hpp.
Referenced by jb::config_attribute< jb::testing::microbenchmark_config, bool >::validate(), and validate().
|
inlinestatic |
Partial specialization of validate() for jb::config_object and derived classes.
Definition at line 280 of file config_recurse.hpp.
References validate().
|
static |
Partial of validate() for specialization for jb::config_attribute<>.
Definition at line 242 of file config_attribute.hpp.
References jb::config_attribute< C, T >::validate().
|
inlinestatic |
Partial specialization of validate() for anything looking like a sequence of jb::config_object.
Definition at line 299 of file config_recurse.hpp.
References validate().
|
inlinestatic |
Partial specialization of validate() for std::pair<>.
Definition at line 309 of file config_recurse.hpp.
References validate().