mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 16:46:47 +00:00
52 lines
1.3 KiB
C++
52 lines
1.3 KiB
C++
/********************************************************************************
|
|
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
|
|
* *
|
|
* This software is distributed under the terms of the *
|
|
* GNU Lesser General Public Licence (LGPL) version 3, *
|
|
* copied verbatim in the file "LICENSE" *
|
|
********************************************************************************/
|
|
/**
|
|
* Sink.cxx
|
|
*
|
|
* @since 2014-10-10
|
|
* @author A. Rybalchenko
|
|
*/
|
|
|
|
#include "Sink.h"
|
|
#include "Header.h"
|
|
|
|
using namespace std;
|
|
|
|
namespace example_multipart
|
|
{
|
|
|
|
Sink::Sink()
|
|
{
|
|
OnData("data", &Sink::HandleData);
|
|
}
|
|
|
|
bool Sink::HandleData(FairMQParts& parts, int /*index*/)
|
|
{
|
|
Header header;
|
|
header.stopFlag = (static_cast<Header*>(parts.At(0)->GetData()))->stopFlag;
|
|
|
|
LOG(info) << "Received message with " << parts.Size() << " parts";
|
|
|
|
LOG(info) << "Received header with stopFlag: " << header.stopFlag;
|
|
LOG(info) << "Received body of size: " << parts.At(1)->GetSize();
|
|
|
|
if (header.stopFlag == 1)
|
|
{
|
|
LOG(info) << "stopFlag is 1, going IDLE";
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
Sink::~Sink()
|
|
{
|
|
}
|
|
|
|
}
|