FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
runTestDetectorProcessor.cxx
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 
9 #include "FairMQProcessor.h"
11 #include "runFairMQDevice.h"
12 
13 namespace bpo = boost::program_options;
14 
15 void addCustomOptions(bpo::options_description& options)
16 {
17  // clang-format off
18  options.add_options()
19  ("in-channel", bpo::value<std::string>()->default_value("data1"), "Name of the input channel")
20  ("out-channel", bpo::value<std::string>()->default_value("data2"), "Name of the output channel")
21  ("data-format", bpo::value<std::string>()->default_value("binary"), "Data format (binary|boost|flatbuffers|msgpack|protobuf|tmessage)");
22  // clang-format on
23 }
24 
25 FairMQDevicePtr getDevice(const FairMQProgOptions& config)
26 {
27  std::string dataFormat = config.GetValue<std::string>("data-format");
28 
29  if (dataFormat == "binary") {
34  } else if (dataFormat == "boost") {
36  void(boost::archive::binary_iarchive&,
37  const unsigned int)>::value
38  == 0) {
39  LOG(error) << "Boost serialization for Input Payload requested, but the input type does not support it. "
40  "Check the TIn parameter. Aborting.";
41  return nullptr;
42  }
44  void(boost::archive::binary_oarchive&,
45  const unsigned int)>::value
46  == 0) {
47  LOG(error) << "Boost serialization for Output Payload requested, but the output type does not support it. "
48  "Check the TOut parameter. Aborting.";
49  return nullptr;
50  }
53  boost::archive::binary_iarchive,
54  boost::archive::binary_oarchive>>;
55  } else if (dataFormat == "tmessage") {
56  return new FairMQProcessor<
58  }
59 #ifdef FLATBUFFERS
60  else if (dataFormat == "flatbuffers") {
63  TestDetectorFlat::DigiPayload,
64  TestDetectorFlat::HitPayload>>;
65  }
66 #endif
67 #ifdef MSGPACK
68  else if (dataFormat == "msgpack") {
69  return new FairMQProcessor<
71  }
72 #endif
73 #ifdef PROTOBUF
74  else if (dataFormat == "protobuf") {
77  TestDetectorProto::DigiPayload,
78  TestDetectorProto::HitPayload>>;
79  }
80 #endif
81  else {
82  LOG(error)
83  << "No valid data format provided. (--data-format binary|boost|flatbuffers|msgpack|protobuf|tmessage). ";
84  return nullptr;
85  }
86 }
void addCustomOptions(bpo::options_description &options)
FairMQDevicePtr getDevice(const FairMQProgOptions &config)