7#include <yaml-cpp/yaml.h>
9#include "ConfigFileReader.h"
25 using node_id_t = std::variant<std::string, node_finder_t>;
51 template <
typename SCALAR>
57 template <
typename SCALAR>
63 template <
typename SCALAR>
64 std::optional<std::vector<SCALAR>>
GetVector(YAML::Node node);
69 template <
typename SCALAR>
76 template <
typename SCALAR>
85 YAML::Node FindNode(YAML::Node node,
node_path_t node_path);
88 std::deque<std::pair<YAML::Node, std::string>> m_configs;
ConfigFileReader(std::string_view name="config")
A YAMLReader based on yaml-cpp.
static std::string NodePath2String(node_path_t const &node_path)
Convert a YAML::Node path to a string.
std::optional< SCALAR > GetScalar(node_path_t node_path)
Read a scalar value from a YAML::Node path; searches all currently loaded config files.
node_finder_t InRange(std::string const &key, SCALAR val)
Create a function to search a YAML::Node for a sub-YAML::Node such that the scalar val is within a ra...
std::deque< node_id_t > node_path_t
Representation of a path of YAML::Nodes in a YAML::Node tree, e.g., in a YAML file.
std::variant< std::string, node_finder_t > node_id_t
void LoadFiles()
Parse the YAML files added by ConfigFileReader::AddFile.
std::optional< std::vector< SCALAR > > GetVector(YAML::Node node)
Read a vector value from a YAML::Node.
std::optional< std::vector< SCALAR > > GetVector(node_path_t node_path)
Read a vector value from a YAML::Node path; searches all currently loaded config files.
std::function< YAML::Node(YAML::Node const)> node_finder_t
A function f : Node A -> Node B which searches YAML::Node A for a specific YAML::Node B,...
std::optional< SCALAR > GetScalar(YAML::Node node)
Read a scalar value from a YAML::Node.
YAMLReader(std::string_view name="config")