/* * File: FairMQParserExample.cxx * Author: winckler * * Created on May 14, 2015, 5:01 PM */ #include "FairMQParserExample.h" #include "FairMQLogger.h" #include namespace FairMQParser { //////////////////////////////////////////////////////////////////////////// //----------- filename version FairMQMap XML::UserParser(const std::string& filename, const std::string& device_id, const std::string& root_node) { boost::property_tree::ptree pt; boost::property_tree::read_xml(filename, pt); return ptreeToMQMap(pt,device_id,root_node,"xml"); } //----------- stringstream version FairMQMap XML::UserParser(std::stringstream& input_ss, const std::string& device_id, const std::string& root_node) { boost::property_tree::ptree pt; boost::property_tree::read_xml(input_ss, pt); return ptreeToMQMap(pt,device_id,root_node,"xml"); } // other xml examples //////////////////////////////////////////////////////////////////////////// boost::property_tree::ptree MQXML2::UserParser(const std::string& filename) { boost::property_tree::ptree pt; boost::property_tree::read_xml(filename, pt); return pt; } // TODO : finish implementation //////////////////////////////////////////////////////////////////////////// boost::property_tree::ptree MQXML3::UserParser(const std::string& filename, const std::string& devicename) { // Create an empty property tree object boost::property_tree::ptree pt; boost::property_tree::read_xml(filename, pt); // Create fair mq map auto xml = pt.get_child(""); std::vector> match; std::pair device_match; ProcessTree(xml.begin (), xml.end (), std::back_inserter(match), [] (const std::string& key) { return key == "device"; }); // for each device for (const auto& pair: match) { if(pair.second.get(".name") == devicename) { device_match=pair; } else { //match.erase(std::remove(match.begin(), match.end(), pair), match.end()); continue; } //std::cout << "pair.first " << pair.first << std::endl;//device //std::cout << "\t node = " << pair.first // << "\t name = " << pair.second.get(".name") // << "\t id = " << pair.second.get(".id"); //std::cout<