Extend Readout example

This commit is contained in:
Alexey Rybalchenko
2019-04-02 15:23:26 +02:00
committed by Dennis Klein
parent 35399ee039
commit 7e6eb382d5
17 changed files with 416 additions and 299 deletions

View File

@@ -5,36 +5,42 @@
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#ifndef FAIRMQEXAMPLEREGIONBUILDER_H
#define FAIRMQEXAMPLEREGIONBUILDER_H
#include <atomic>
#include "FairMQDevice.h"
namespace example_region
#include <string>
namespace example_readout
{
class Builder : public FairMQDevice
{
public:
Builder() {
OnData("data1", &Builder::HandleData);
}
virtual ~Builder() {}
Builder()
: fOutputChannelName()
{}
void Init() override
{
fOutputChannelName = fConfig->GetValue<std::string>("output-name");
OnData("rb", &Builder::HandleData);
}
protected:
bool HandleData(FairMQMessagePtr& msg, int /*index*/)
{
if (Send(msg, "data2") < 0) {
if (Send(msg, fOutputChannelName) < 0) {
return false;
}
return true;
}
private:
std::string fOutputChannelName;
};
} // namespace example_region
} // namespace example_readout
#endif /* FAIRMQEXAMPLEREGIONBUILDER_H */