mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-12 16:21:13 +00:00
Initialize all data members in initializer lists. Reorder data members in initializer list to have the same order as in the class declaration. Comment or remove unused parameters and unused variables. Convert all old style casts to the correct and explicit c++ cast like const_cast, static_cast, dynamic_cast or reinterpret_cast. In most cases static_cast is used.
75 lines
2.2 KiB
C++
75 lines
2.2 KiB
C++
/*
|
|
* File: FairMQParserExample.cxx
|
|
* Author: winckler
|
|
*
|
|
* Created on May 14, 2015, 5:01 PM
|
|
*/
|
|
|
|
#include "FairMQParserExample.h"
|
|
#include "FairMQLogger.h"
|
|
#include <boost/property_tree/xml_parser.hpp>
|
|
|
|
|
|
namespace FairMQParser
|
|
{
|
|
|
|
// 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<std::pair<std::string, boost::property_tree::ptree>> match;
|
|
std::pair<std::string, boost::property_tree::ptree> 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<std::string>("<xmlattr>.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<std::string>("<xmlattr>.name")
|
|
// << "\t id = " << pair.second.get<std::string>("<xmlattr>.id");
|
|
//std::cout<<std::endl;
|
|
}
|
|
|
|
return device_match.second;
|
|
}
|
|
|
|
|
|
|
|
|
|
} // end FairMQParser namespace
|