FairMQ Examples cleanup

- Rename Tutorial3 MQ files for uniform naming.
  - Add search for dylib in FindDDS.cmake (OSX).
  - Add more detail to the DDS example readme.
  - MQ Example 3 (DDS): choose network interface via command line option.
  - Give FairMQ examples their own CMakeLists.txt for clarity.
  - Remove C++11 checks in Tutorial3 from the code (they are now in CMake).
  - Add Serializer for device properties (FairMQDevice::ListProperties()).
This commit is contained in:
Alexey Rybalchenko
2015-09-29 11:07:27 +02:00
committed by Mohammad Al-Turany
parent a75486f3ec
commit 19afacb504
26 changed files with 746 additions and 220 deletions

View File

@@ -45,11 +45,13 @@ int main(int argc, char** argv)
try
{
std::string text;
std::string text; // text to be sent for processing.
std::string interfaceName; // name of the network interface to use for communication.
options_description samplerOptions("Sampler options");
samplerOptions.add_options()
("text", value<std::string>(&text)->default_value("Hello"), "Text to send out");
("text", value<std::string>(&text)->default_value("Hello"), "Text to send out")
("network-interface", value<std::string>(&interfaceName)->default_value("eth0"), "Name of the network interface to use (e.g. eth0, ib0, wlan0, en0...)");
config.AddToCmdLineOptions(samplerOptions);
@@ -83,22 +85,14 @@ int main(int argc, char** argv)
FairMQ::tools::getHostIPs(IPs);
stringstream ss;
// Check if ib0 (infiniband) interface is available, otherwise try eth0 or wlan0.
if (IPs.count("ib0"))
if (IPs.count(interfaceName))
{
ss << "tcp://" << IPs["ib0"] << ":1";
}
else if (IPs.count("eth0"))
{
ss << "tcp://" << IPs["eth0"] << ":1";
}
else if (IPs.count("wlan0"))
{
ss << "tcp://" << IPs["wlan0"] << ":1";
ss << "tcp://" << IPs[interfaceName] << ":1";
}
else
{
LOG(INFO) << ss.str();
LOG(ERROR) << "Could not find ib0, eth0 or wlan0";
LOG(ERROR) << "Could not find provided network interface: \"" << interfaceName << "\"!, exiting.";
exit(EXIT_FAILURE);
}
string initialOutputAddress = ss.str();