Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sensors:
- - id: 5
- hardwareId: 28-000005a32133
- type: 1
- - id: 6
- hardwareId: 28-000005a32132
- type: 4
- YAML::Node config = YAML::LoadFile(config_path);
- const YAML::Node& node_test1 = confg["sensors"];
- for (std::size_t i = 0; i < node_test1.size(); i++) {
- const YAML::Node& node_test2 = node_test1[i];
- std::cout << "Id: " << node_test2["id"].as<std::string>() << std::endl;
- std::cout << "hardwareId: " << node_test2["hardwareId"].as<std::string>() << std::endl << std::endl;
- }
- YAML::Node config = YAML::LoadFile(config_path);
- const YAML::Node& sensors = config["sensors"];
- for (YAML::iterator it = sensors.begin(); it != sensors.end(); ++it) {
- const YAML::Node& sensor = *it;
- std::cout << "Id: " << sensor["id"].as<std::string>() << "n";
- std::cout << "hardwareId: " << sensor["hardwareId"].as<std::string>() << "nn";
- }
- YAML::Node config = YAML::LoadFile(config_path);
- const YAML::Node& sensors = config["sensors"];
- for (YAML::const_iterator it = sensors.begin(); it != sensors.end(); ++it) {
- const YAML::Node& sensor = *it;
- std::cout << "Id: " << sensor["id"].as<std::string>() << "n";
- std::cout << "hardwareId: " << sensor["hardwareId"].as<std::string>() << "nn";
- }
Add Comment
Please, Sign In to add comment