mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 09:31:45 +00:00
Refactor the examples after move from FairRoot
This commit is contained in:
@@ -31,8 +31,8 @@ FairMQMap ptreeToMQMap(const boost::property_tree::ptree& pt, const string& id,
|
||||
{
|
||||
// Create fair mq map
|
||||
FairMQMap channelMap;
|
||||
//Helper::PrintPropertyTree(pt);
|
||||
//Helper::PrintDeviceList(pt.get_child(rootNode));
|
||||
// boost::property_tree::json_parser::write_json(std::cout, pt);
|
||||
// Helper::PrintDeviceList(pt.get_child(rootNode));
|
||||
// Extract value from boost::property_tree
|
||||
Helper::DeviceParser(pt.get_child(rootNode), channelMap, id);
|
||||
|
||||
@@ -93,8 +93,6 @@ void DeviceParser(const boost::property_tree::ptree& tree, FairMQMap& channelMap
|
||||
{
|
||||
string deviceIdKey;
|
||||
|
||||
LOG(debug) << "Looking for '" << deviceId << "' id/key in the provided config file...";
|
||||
|
||||
// For each node in fairMQOptions
|
||||
for (const auto& p : tree)
|
||||
{
|
||||
@@ -122,7 +120,7 @@ void DeviceParser(const boost::property_tree::ptree& tree, FairMQMap& channelMap
|
||||
continue;
|
||||
}
|
||||
|
||||
LOG(debug) << "Found with following channels:";
|
||||
LOG(debug) << "Found following channels for device ID '" << deviceId << "' :";
|
||||
|
||||
ChannelParser(q.second, channelMap);
|
||||
}
|
||||
@@ -260,14 +258,6 @@ 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) {
|
||||
cout << setw(level+1) << level << ": " << p.first << " " << p.second.get_value<string>() << endl;
|
||||
PrintPropertyTree(p.second.get_child(""), level + 1);
|
||||
}
|
||||
}
|
||||
|
||||
} // Helper namespace
|
||||
|
||||
} // namespace parser
|
||||
|
@@ -41,7 +41,6 @@ void PrintDeviceList(const boost::property_tree::ptree& tree);
|
||||
void DeviceParser(const boost::property_tree::ptree& tree, FairMQMap& channelMap, const std::string& deviceId);
|
||||
void ChannelParser(const boost::property_tree::ptree& tree, FairMQMap& channelMap);
|
||||
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
|
||||
|
||||
|
@@ -240,7 +240,7 @@ void FairMQProgOptions::InitOptionDescription()
|
||||
("port-range-max", po::value<int >()->default_value(32000), "End of the port range for dynamic initialization.")
|
||||
("print-channels", po::value<bool >()->implicit_value(true), "Print registered channel endpoints in a machine-readable format (<channel name>:<min num subchannels>:<max num subchannels>)")
|
||||
("shm-segment-size", po::value<size_t>()->default_value(2000000000), "Shared memory: size of the shared memory segment (in bytes).")
|
||||
("shm-monitor", po::value<bool >()->default_value(false), "Shared memory: run monitor daemon.")
|
||||
("shm-monitor", po::value<bool >()->default_value(true), "Shared memory: run monitor daemon.")
|
||||
("rate", po::value<float >()->default_value(0.), "Rate for conditional run loop (Hz).")
|
||||
("session", po::value<string>()->default_value("default"), "Session name.")
|
||||
;
|
||||
|
@@ -44,7 +44,6 @@ FairMQMap SUBOPT::UserParser(const vector<string>& channelConfig, const string&
|
||||
ptree channelProperties;
|
||||
|
||||
ptree socketsArray;
|
||||
ptree socketProperties;
|
||||
|
||||
string argString(token);
|
||||
char* subopts = &argString[0];
|
||||
@@ -57,6 +56,12 @@ FairMQMap SUBOPT::UserParser(const vector<string>& channelConfig, const string&
|
||||
channelName = value;
|
||||
channelProperties.put("name", channelName);
|
||||
}
|
||||
else if (subopt == ADDRESS)
|
||||
{
|
||||
ptree socketProperties;
|
||||
socketProperties.put(channelOptionKeys[subopt], value);
|
||||
socketsArray.push_back(make_pair("", socketProperties));
|
||||
}
|
||||
else if (subopt >= 0 && value != nullptr)
|
||||
{
|
||||
channelProperties.put(channelOptionKeys[subopt], value);
|
||||
@@ -65,7 +70,6 @@ FairMQMap SUBOPT::UserParser(const vector<string>& channelConfig, const string&
|
||||
|
||||
if (channelName != "")
|
||||
{
|
||||
socketsArray.push_back(make_pair("", socketProperties));
|
||||
channelProperties.add_child("sockets", socketsArray);
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user