FairRoot/PandaRoot
Functions
runPndTopixSink.cxx File Reference
#include <PndMQTopix4Sink.h>
#include <iostream>
#include <TApplication.h>
#include "boost/program_options.hpp"
#include "FairMQLogger.h"
#include "FairMQParser.h"
#include "FairMQProgOptions.h"
#include "FairMQTransportFactoryZMQ.h"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 33 of file runPndTopixSink.cxx.

References filename.

34 {
35  PndMQTopix4Sink sink;
36  sink.CatchSignals();
37 
38  FairMQProgOptions config;
39 
40  try
41  {
42  config.ParseAll(argc, argv);
43 
44  std::string filename = config.GetValue<std::string>("config-json-file");
45  std::string id = config.GetValue<std::string>("id");
46 
47  config.UserParser<FairMQParser::JSON>(filename, id);
48 
49  sink.fChannels = config.GetFairMQMap();
50 
51  LOG(INFO) << "PID: " << getpid();
52 
53 #ifdef NANOMSG
54  FairMQTransportFactory* transportFactory = new FairMQTransportFactoryNN();
55 #else
56  FairMQTransportFactory* transportFactory = new FairMQTransportFactoryZMQ();
57 #endif
58 
59  sink.SetTransport(transportFactory);
60 
61  sink.SetProperty(PndMQTopix4Sink::Id, id);
62 
63  sink.ChangeState("INIT_DEVICE");
64  sink.WaitForEndOfState("INIT_DEVICE");
65 
66  sink.ChangeState("INIT_TASK");
67  sink.WaitForEndOfState("INIT_TASK");
68 
69  sink.ChangeState("RUN");
70  sink.InteractiveStateLoop();
71  }
72  catch (std::exception& e)
73  {
74  LOG(ERROR) << e.what();
75  LOG(INFO) << "Command line options are the following: ";
76  config.PrintHelp();
77  return 1;
78  }
79 
80  return 0;
81 }
const string filename