Go to the documentation of this file.
16 #ifndef UTILS_YAML_UTILS_H_
17 #define UTILS_YAML_UTILS_H_
19 #include <yaml-cpp/yaml.h>
25 #include "glog/logging.h"
29 std::vector<std::string>
get_yaml_files(
const std::string& plugin_dir);
36 YAML::Emitter& emitter);
40 namespace config_parsing {
42 bool get_scalar(YAML::Node node,
const std::string& key, T& value) {
43 YAML::Node cur = node[key];
44 if (cur && cur.IsScalar()) {
53 std::vector<T>& seq) {
54 YAML::Node cur = node[key];
55 if (cur && cur.IsSequence()) {
58 for (
int i = 0; i < num; ++i) {
59 seq.push_back(cur[i].as<T>());
71 LOG(ERROR) <<
"Expect key: " << key <<
" set to " << value
76 LOG(ERROR) <<
"Expect key: " << key <<
" set to " << value <<
" but got "
86 #endif // UTILS_YAML_UTILS_H_
Status write_yaml_node_to_yaml_string(const YAML::Node &node, YAML::Emitter &emitter)
Definition: yaml_utils.cc:135
std::vector< std::string > get_yaml_files(const std::string &plugin_dir)
Definition: yaml_utils.cc:25
bool get_scalar(YAML::Node node, const std::string &key, T &value)
Definition: yaml_utils.h:42
Definition: adj_list.h:23
Result< std::string > get_yaml_string_from_yaml_node(const YAML::Node &node)
Definition: yaml_utils.cc:122
bool get_sequence(YAML::Node node, const std::string &key, std::vector< T > &seq)
Definition: yaml_utils.h:52
static bool expect_config(YAML::Node root, const std::string &key, const V &value)
Definition: yaml_utils.h:67
Result< std::string > get_json_string_from_yaml(const std::string &file_path)
Definition: yaml_utils.cc:94