1 #ifndef RAM_UTILS_YAML_UTILS_HPP 2 #define RAM_UTILS_YAML_UTILS_HPP 5 #include <yaml-cpp/yaml.h> 16 var_value = node[var_name].as<
double>();
27 var_value = node[var_name].as<
int>();
33 unsigned int &var_value)
38 var_value = node[var_name].as<
unsigned int>();
44 std::string &var_value)
49 var_value = node[var_name].as<std::string>();
60 var_value = node[var_name];
66 std::vector<bool> &var_value)
72 const YAML::Node n = node[var_name];
73 for (
int i = 0; i < (int)n.size(); i++)
76 value = n[i].as<
bool>();
77 var_value.push_back(value);
84 std::vector<double> &var_value)
90 const YAML::Node n = node[var_name];
91 for (
int i = 0; i < (int)n.size(); i++)
94 value = n[i].as<
double>();
95 var_value.push_back(value);
100 inline const YAML::Node
parseNode(
const YAML::Node &node,
101 char const *var_name)
104 std::cout <<
"Can't parse node " << var_name << std::endl;
105 return (node[var_name]);
112 key = it->first.as<std::string>();
113 dvalue = it->second.as<
double>();
122 ynode = YAML::LoadFile(filename.c_str());
126 std::cout <<
"could not open %s in yamlNodeFromFileName()" << filename << std::endl;
bool parseBool(const YAML::Node &node, char const *var_name, bool &var_value)
bool parseVectorD(const YAML::Node &node, char const *var_name, std::vector< double > &var_value)
void parseKeyDValue(YAML::const_iterator &it, std::string &key, double &dvalue)
bool parseInt(const YAML::Node &node, char const *var_name, int &var_value)
const YAML::Node parseNode(const YAML::Node &node, char const *var_name)
bool parseString(const YAML::Node &node, char const *var_name, std::string &var_value)
bool parseVectorB(const YAML::Node &node, char const *var_name, std::vector< bool > &var_value)
bool parseUInt(const YAML::Node &node, char const *var_name, unsigned int &var_value)
bool parseDouble(const YAML::Node &node, char const *var_name, double &var_value)
bool yamlNodeFromFileName(const std::string filename, YAML::Node &ynode)