![]() |
Iguana LATEST
Implementation Guardian of Analysis Algorithms
|
#include <YAMLReader.h>
A YAMLReader based on yaml-cpp.
Definition at line 14 of file YAMLReader.h.
Public Types | |
| using | node_finder_t = std::function<YAML::Node(YAML::Node const)> |
| A function f : Node A -> Node B which searches YAML::Node A for a specific YAML::Node B, returning it. | |
| using | node_id_t = std::variant<std::string, node_finder_t> |
| using | node_path_t = std::deque<node_id_t> |
| Representation of a path of YAML::Nodes in a YAML::Node tree, e.g., in a YAML file. | |
Public Member Functions | |
| YAMLReader (std::string_view name="config") | |
| template<typename SCALAR> | |
| std::optional< SCALAR > | GetScalar (node_path_t node_path) |
| Read a scalar value from a YAML::Node path; searches all currently loaded config files. | |
| template<typename SCALAR> | |
| std::optional< SCALAR > | GetScalar (YAML::Node node) |
| Read a scalar value from a YAML::Node. | |
| template<typename SCALAR> | |
| 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. | |
| template<typename SCALAR> | |
| std::optional< std::vector< SCALAR > > | GetVector (YAML::Node node) |
| Read a vector value from a YAML::Node. | |
| template<typename SCALAR> | |
| 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 range specified by key. | |
| void | LoadFiles () |
| Parse the YAML files added by ConfigFileReader::AddFile. | |
| Public Member Functions inherited from iguana::ConfigFileReader | |
| ConfigFileReader (std::string_view name="config") | |
| void | AddDirectory (std::string const &dir) |
| void | AddFile (std::string const &name, bool verbose_errors=true) |
| std::string | FindFile (std::string name, bool verbose_errors=true) |
| void | PrintDirectories (Logger::Level const level=Logger::info) |
| Public Member Functions inherited from iguana::Object | |
| Object (std::string_view name="", Logger::Level lev=Logger::DEFAULT_LEVEL) | |
| std::unique_ptr< Logger > & | GetLog () |
| std::string | GetName () const |
| std::unique_ptr< Logger > & | Log () |
| void | SetLogLevel (Logger::Level const lev) |
| void | SetLogLevel (std::string_view lev) |
| void | SetName (std::string_view name) |
Static Public Member Functions | |
| static std::string | NodePath2String (node_path_t const &node_path) |
| Convert a YAML::Node path to a string. | |
| Static Public Member Functions inherited from iguana::ConfigFileReader | |
| static std::string | ConvertAlgoNameToConfigName (std::string_view algo_name, std::string_view ext="yaml") |
| static std::string | GetConfigInstallationPrefix () |
Additional Inherited Members | |
| Protected Attributes inherited from iguana::ConfigFileReader | |
| std::deque< std::string > | m_directories |
| Stack of directories to search for a file. | |
| std::deque< std::string > | m_files |
| Stack of file names to parse. | |
| Protected Attributes inherited from iguana::Object | |
| std::unique_ptr< Logger > | m_log |
| Logger instance for this object | |
| std::string | m_name |
| The name of this object. | |

| using iguana::YAMLReader::node_finder_t = std::function<YAML::Node(YAML::Node const)> |
A function f : Node A -> Node B which searches YAML::Node A for a specific YAML::Node B, returning it.
Definition at line 20 of file YAMLReader.h.
| using iguana::YAMLReader::node_id_t = std::variant<std::string, node_finder_t> |
Variant for identifying a YAML::Node:
Definition at line 25 of file YAMLReader.h.
| using iguana::YAMLReader::node_path_t = std::deque<node_id_t> |
Representation of a path of YAML::Nodes in a YAML::Node tree, e.g., in a YAML file.
Definition at line 28 of file YAMLReader.h.
|
inline |
| name | of this reader (for Logger) |
Definition at line 31 of file YAMLReader.h.
|
inline |
Definition at line 34 of file YAMLReader.h.
| std::optional< SCALAR > iguana::YAMLReader::GetScalar | ( | node_path_t | node_path | ) |
Read a scalar value from a YAML::Node path; searches all currently loaded config files.
| node_path | the YAML::Node path |
| std::optional< SCALAR > iguana::YAMLReader::GetScalar | ( | YAML::Node | node | ) |
Read a scalar value from a YAML::Node.
| node | the YAML::Node to read |
| std::optional< std::vector< SCALAR > > iguana::YAMLReader::GetVector | ( | node_path_t | node_path | ) |
Read a vector value from a YAML::Node path; searches all currently loaded config files.
| node_path | the YAML::Node path |
| std::optional< std::vector< SCALAR > > iguana::YAMLReader::GetVector | ( | YAML::Node | node | ) |
Read a vector value from a YAML::Node.
| node | the YAML::Node to read |
| node_finder_t iguana::YAMLReader::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 range specified by key.
| key | the key of the sub-YAML::Node to use as the range (its value must be a 2-vector) |
| val | the scalar value to check |
|
static |
Convert a YAML::Node path to a string.
| node_path | the YAML::Node path |