5 #include <yaml-cpp/yaml.h> 9 #define YAML_ITERATOR YAML::const_iterator 12 char const * var_name,
17 var_value = node[var_name].as<
double>();
24 char const * var_name,
29 var_value = node[var_name].as<
int>();
36 char const * var_name,
37 unsigned int &var_value)
41 var_value = node[var_name].as<
unsigned int>();
48 char const * var_name,
49 std::string &var_value)
53 var_value = node[var_name].as<std::string>();
60 char const * var_name,
65 var_value = node[var_name];
72 char const * var_name,
73 std::vector<bool> &var_value)
78 const YAML::Node n = node[var_name];
79 for (
int i = 0; i < (int)n.size(); i++)
82 value = n[i].as<
bool>();
83 var_value.push_back(value);
91 char const * var_name,
92 std::vector<double> &var_value)
97 const YAML::Node n = node[var_name];
98 for (
int i = 0; i < (int)n.size(); i++)
101 value = n[i].as<
double>();
102 var_value.push_back(value);
109 inline const YAML::Node
parseNode(
const YAML::Node &node,
110 char const * var_name)
114 std::cout <<
"Can't parse node " << var_name << std::endl;
116 return (node[var_name]);
123 key = it->first.as<std::string>();
124 dvalue = it->second.as<
double>();
133 ynode = YAML::LoadFile(filename.c_str());
137 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 yamlNodeFromFileName(std::string filename, YAML::Node &ynode)
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)