Newer
Older
/* Copyright (C) 2017-2019 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Florian Uhlig [committer] */
/**
* CbmDevNullSink.cxx
*
* @since 2017-11-17
* @author F. Uhlig
*/
#include "CbmDevNullSink.h"
CbmDevNullSink::CbmDevNullSink() : FairMQDevice {}, fNumMessages {0} {}
void CbmDevNullSink::InitTask()
{
// register a handler for data arriving on any channel
int noChannel = fChannels.size();
LOG(info) << "Number of defined input channels: " << noChannel;
LOG(info) << "Channel name: " << entry.first;
OnData(entry.first, &CbmDevNullSink::HandleData);
}
}
// handler is called whenever a message arrives on "data", with a reference to the message and a sub-channel index (here 0)
bool CbmDevNullSink::HandleData(FairMQMessagePtr& msg, int /*index*/)
{
// Don't do anything with the data
// Maybe add an message counter which counts the incomming messages and add
// an output
fNumMessages++;
LOG(info) << "Received message number " << fNumMessages << " with size " << msg->GetSize();