CbmRoot
CbmDevNullSink.cxx
Go to the documentation of this file.
1 
8 #include "CbmDevNullSink.h"
9 #include "FairMQLogger.h"
10 #include "FairMQProgOptions.h" // device->fConfig
11 
12 using namespace std;
13 
14 CbmDevNullSink::CbmDevNullSink() : FairMQDevice {}, fNumMessages {0} {}
15 
17 
19  // register a handler for data arriving on any channel
20  int noChannel = fChannels.size();
21  LOG(info) << "Number of defined input channels: " << noChannel;
22  for (auto const& entry : fChannels) {
23  LOG(info) << "Channel name: " << entry.first;
24  OnData(entry.first, &CbmDevNullSink::HandleData);
25  }
26 }
27 
28 // handler is called whenever a message arrives on "data", with a reference to the message and a sub-channel index (here 0)
29 bool CbmDevNullSink::HandleData(FairMQMessagePtr& msg, int /*index*/) {
30  // Don't do anything with the data
31  // Maybe add an message counter which counts the incomming messages and add
32  // an output
33  fNumMessages++;
34  LOG(info) << "Received message number " << fNumMessages << " with size "
35  << msg->GetSize();
36  return true;
37 }
38 
CbmDevNullSink.h
CbmDevNullSink::Init
virtual void Init()
Definition: CbmDevNullSink.cxx:16
CbmDevNullSink::CbmDevNullSink
CbmDevNullSink()
Definition: CbmDevNullSink.cxx:14
CbmDevNullSink::HandleData
bool HandleData(FairMQMessagePtr &, int)
Definition: CbmDevNullSink.cxx:29
CbmDevNullSink::fNumMessages
uint64_t fNumMessages
Definition: CbmDevNullSink.h:24
CbmDevNullSink::~CbmDevNullSink
virtual ~CbmDevNullSink()
Definition: CbmDevNullSink.cxx:39
CbmDevNullSink::InitTask
virtual void InitTask()
Definition: CbmDevNullSink.cxx:18