4 #include <boost/shared_ptr.hpp> 5 #include <yaml-cpp/yaml.h> 10 #define YAML_ITERATOR YAML::const_iterator 12 inline bool parseDouble(
const YAML::Node &
node,
char const * var_name,
double &var_value)
16 var_value = node[var_name].as<
double>();
22 inline bool parseInt(
const YAML::Node &
node,
char const * var_name,
int &var_value)
26 var_value = node[var_name].as<
int>();
31 inline bool parseUInt(
const YAML::Node &
node,
char const * var_name,
unsigned int &var_value)
35 var_value = node[var_name].as<
unsigned int>();
41 inline bool parseString(
const YAML::Node &
node,
char const * var_name, std::string &var_value)
45 var_value = node[var_name].as<std::string>();
51 inline bool parseBool(
const YAML::Node &
node,
char const * var_name,
bool &var_value)
55 var_value = node[var_name];
61 inline bool parseVectorD(
const YAML::Node &
node,
char const * var_name, std::vector<double> &var_value)
66 const YAML::Node n = node[var_name];
67 for (
int i = 0; i < (int)n.size(); i++)
70 value = n[i].as<
double>();
71 var_value.push_back(value);
78 inline const YAML::Node
parseNode(
const YAML::Node &
node,
char const * var_name)
82 std::cout <<
"Can't parse node " << var_name << std::endl;
84 return (node[var_name]);
86 inline void parseKeyDValue(YAML::const_iterator &it, std::string &key,
double &dvalue)
88 key = it->first.as<std::string>();
89 dvalue = it->second.as<
double>();
97 ynode = YAML::LoadFile(filename.c_str());
101 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)
boost::shared_ptr< ros::NodeHandle > node
bool parseString(const YAML::Node &node, char const *var_name, std::string &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)