mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 09:31:45 +00:00
Fix CIDs 10587, 10813, 10911, 10912, 10402, 10403, 10577, 10578, 10579, 10848, 10861, 10865, 10868, 10910.
Move classes inheriting from device to a subdirectory. Make sure only protobuf library installed by fairsoft is used. Cleanup FairMQDevice and fix some initialization list warnings. Loop to duplicate input files in Sampler. Add some documentation to FairMQ.
This commit is contained in:
64
fairmq/devices/FairMQSplitter.cxx
Normal file
64
fairmq/devices/FairMQSplitter.cxx
Normal file
@@ -0,0 +1,64 @@
|
||||
/********************************************************************************
|
||||
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
|
||||
* *
|
||||
* This software is distributed under the terms of the *
|
||||
* GNU Lesser General Public Licence version 3 (LGPL) version 3, *
|
||||
* copied verbatim in the file "LICENSE" *
|
||||
********************************************************************************/
|
||||
/**
|
||||
* FairMQSplitter.cxx
|
||||
*
|
||||
* @since 2012-12-06
|
||||
* @author D. Klein, A. Rybalchenko
|
||||
*/
|
||||
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include "FairMQLogger.h"
|
||||
#include "FairMQSplitter.h"
|
||||
|
||||
FairMQSplitter::FairMQSplitter()
|
||||
{
|
||||
}
|
||||
|
||||
FairMQSplitter::~FairMQSplitter()
|
||||
{
|
||||
}
|
||||
|
||||
void FairMQSplitter::Run()
|
||||
{
|
||||
LOG(INFO) << ">>>>>>> Run <<<<<<<";
|
||||
|
||||
boost::thread rateLogger(boost::bind(&FairMQDevice::LogSocketRates, this));
|
||||
|
||||
bool received = false;
|
||||
int direction = 0;
|
||||
|
||||
while (fState == RUNNING)
|
||||
{
|
||||
FairMQMessage* msg = fTransportFactory->CreateMessage();
|
||||
|
||||
received = fPayloadInputs->at(0)->Receive(msg);
|
||||
|
||||
if (received)
|
||||
{
|
||||
fPayloadOutputs->at(direction)->Send(msg);
|
||||
direction++;
|
||||
if (direction >= fNumOutputs)
|
||||
{
|
||||
direction = 0;
|
||||
}
|
||||
received = false;
|
||||
}
|
||||
|
||||
delete msg;
|
||||
}
|
||||
|
||||
try {
|
||||
rateLogger.interrupt();
|
||||
rateLogger.join();
|
||||
} catch(boost::thread_resource_error& e) {
|
||||
LOG(ERROR) << e.what();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user