Adding helper function to print the raw boost property tree

This commit is contained in:
Matthias Richter 2017-03-30 16:56:57 +02:00 committed by Mohammad Al-Turany
parent e184610c06
commit 9943be507e
2 changed files with 11 additions and 1 deletions

View File

@ -28,7 +28,8 @@ FairMQMap ptreeToMQMap(const boost::property_tree::ptree& pt, const string& id,
{
// Create fair mq map
FairMQMap channelMap;
// helper::PrintDeviceList(pt.get_child(rootNode));
//Helper::PrintPropertyTree(pt);
//Helper::PrintDeviceList(pt.get_child(rootNode), formatFlag);
// Extract value from boost::property_tree
Helper::DeviceParser(pt.get_child(rootNode), channelMap, id, formatFlag);
@ -433,6 +434,14 @@ void SocketParser(const boost::property_tree::ptree& tree, vector<FairMQChannel>
}
}
void PrintPropertyTree(const boost::property_tree::ptree& tree, int level)
{
for (const auto& p : tree) {
std::cout << std::setw(level+1) << level << ": " << p.first << " " << p.second.get_value<string>() << std::endl;
PrintPropertyTree(p.second.get_child(""), level + 1);
}
}
} // Helper namespace
} // FairMQParser namespace

View File

@ -43,6 +43,7 @@ void PrintDeviceList(const boost::property_tree::ptree& tree, const std::string&
void DeviceParser(const boost::property_tree::ptree& tree, FairMQMap& channelMap, const std::string& deviceId, const std::string& formatFlag);
void ChannelParser(const boost::property_tree::ptree& tree, FairMQMap& channelMap, const std::string& formatFlag);
void SocketParser(const boost::property_tree::ptree& tree, std::vector<FairMQChannel>& channelList, const std::string& channelName, const FairMQChannel& commonChannel);
void PrintPropertyTree(const boost::property_tree::ptree& tree, int level = 0);
} // Helper namespace