17 #include "boost/program_options.hpp"
19 #include "FairMQLogger.h"
20 #include "FairMQParser.h"
21 #include "FairMQProgOptions.h"
25 #include "FairMQTransportFactoryNN.h"
27 #include "FairMQTransportFactoryZMQ.h"
30 using namespace boost::program_options;
32 int main(
int argc,
char** argv)
35 sampler.CatchSignals();
37 FairMQProgOptions config;
43 options_description samplerOptions(
"Sampler options");
44 samplerOptions.add_options()
45 (
"text", value<std::string>(&text)->default_value(
"Hello"),
"Text to send out");
47 config.AddToCmdLineOptions(samplerOptions);
49 if (config.ParseAll(argc, argv))
54 std::string
filename = config.GetValue<std::string>(
"config-json-file");
55 std::string
id = config.GetValue<std::string>(
"id");
57 config.UserParser<FairMQParser::JSON>(
filename, id);
59 sampler.fChannels = config.GetFairMQMap();
61 LOG(INFO) <<
"PID: " << getpid();
64 FairMQTransportFactory* transportFactory =
new FairMQTransportFactoryNN();
66 FairMQTransportFactory* transportFactory =
new FairMQTransportFactoryZMQ();
69 sampler.SetTransport(transportFactory);
74 sampler.ChangeState(
"INIT_DEVICE");
75 sampler.WaitForEndOfState(
"INIT_DEVICE");
77 sampler.ChangeState(
"INIT_TASK");
78 sampler.WaitForEndOfState(
"INIT_TASK");
80 sampler.ChangeState(
"RUN");
81 sampler.InteractiveStateLoop();
83 catch (std::exception& e)
85 LOG(ERROR) << e.what();
86 LOG(INFO) <<
"Command line options are the following: ";
int main(int argc, char **argv)
virtual void SetProperty(const int key, const std::string &value)