FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
runTestDetectorSampler.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 "FairMQSampler.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  ("data-format", bpo::value<std::string>()->default_value("binary"), "Data format (binary|boost|flatbuffers|msgpack|protobuf|tmessage)")
20  ("input-file", bpo::value<std::string>()->required(), "Path to the input file")
21  ("parameter-file", bpo::value<std::string>()->default_value(""), "Path to the parameter file")
22  ("branch", bpo::value<std::string>()->default_value("FairTestDetectorDigi"), "Name of the Branch")
23  ("out-channel", bpo::value<std::string>()->default_value("data1"), "Name of the output channel")
24  ("ack-channel", bpo::value<std::string>()->default_value("ack"), "Name of the acknowledgement channel")
25  ("chain-input", bpo::value<int>()->default_value(0), "Chain input file more than once (default)");
26  // clang-format on
27 }
28 
29 FairMQDevicePtr getDevice(const FairMQProgOptions& config)
30 {
31  std::string dataFormat = config.GetValue<std::string>("data-format");
32 
33  if (dataFormat == "binary") {
35  } else if (dataFormat == "boost") {
37  void(boost::archive::binary_oarchive&,
38  const unsigned int)>::value
39  == 0) {
40  LOG(error) << "Boost serialization for Output Payload requested, but the output type does not support it. "
41  "Check the TOut parameter. Aborting.";
42  return nullptr;
43  }
45  } else if (dataFormat == "tmessage") {
47  }
48 #ifdef FLATBUFFERS
49  else if (dataFormat == "flatbuffers") {
51  }
52 #endif
53 #ifdef MSGPACK
54  else if (dataFormat == "msgpack") {
56  }
57 #endif
58 #ifdef PROTOBUF
59  else if (dataFormat == "protobuf") {
61  }
62 #endif
63  else {
64  LOG(error)
65  << "No valid data format provided. (--data-format binary|boost|flatbuffers|msgpack|protobuf|tmessage). ";
66  exit(EXIT_FAILURE);
67  }
68 }
void addCustomOptions(bpo::options_description &options)
FairMQDevicePtr getDevice(const FairMQProgOptions &config)