/** * Reimplementation of YAML::Node.Load() from 5.x+ yaml-cpp, to be replaced with that when ROS switches over. * * @param str Valid YAML. * @return First root node of given YAML. */ std::auto_ptr<YAML::Node> YAML_Node_Load(std::string str) { YAML::Node ret; std::istringstream str_ss(str); YAML::Parser parser(str_ss); parser.GetNextDocument(ret); return ret.Clone(); }
Configuration::Configuration() { char cwd[1024]; std::ifstream file; std::string configName = ".bzt.yaml"; getcwd(cwd, sizeof(cwd)); std::vector<std::string> components; boost::algorithm::split(components, cwd, boost::algorithm::is_any_of("/")); do { std::string path = boost::algorithm::join(components, "/"); file.open(path+"/.bzt.yaml"); components.pop_back(); if (file.good()) { YAML::Parser parser(file); YAML::Node config; parser.GetNextDocument(config); m_configs.push_back(config.Clone()); } } while (components.size() > 0); }