9 #include <daq/rfarm/event/modules/Rbuf2RbufModule.h>
13 #include "framework/datastore/StoreObjPtr.h"
14 #include "framework/dataobjects/EventMetaData.h"
31 setDescription(
"Encode DataStore into RingBuffer");
34 addParam(
"InputRbufName", m_name_rbufin,
"Name of Input RingBuffer",
36 addParam(
"OutputRbufName", m_name_rbufout,
"Name of Output RingBuffer",
44 B2INFO(
"Rx: Constructor done.");
48 Rbuf2RbufModule::~Rbuf2RbufModule()
52 void Rbuf2RbufModule::initialize()
54 gSystem->Load(
"libdataobjects");
57 m_rbufin =
new RingBuffer(m_name_rbufin.c_str());
58 m_rbufout =
new RingBuffer(m_name_rbufout.c_str());
61 m_eventMetaData.registerInDataStore();
69 B2INFO(
"Rx initialized.");
73 void Rbuf2RbufModule::beginRun()
75 B2INFO(
"beginRun called.");
79 void Rbuf2RbufModule::event()
83 if (m_nrecv == 0)
return;
87 int* evtbuf =
new int[MAXEVTSIZE];
90 while ((size = m_rbufin->remq(evtbuf)) == 0) {
97 int stat = m_rbufout->insq(evtbuf, size);
106 evtmetadata->setExperiment(1);
107 evtmetadata->setRun(1);
108 evtmetadata->setEvent(m_nrecv);
112 B2INFO(
"Rbuf2Rbuf: RingBuffer copied!!");
117 void Rbuf2RbufModule::endRun()
121 B2INFO(
"Rbuf2Rbuf: endRun done.");
125 void Rbuf2RbufModule::terminate()
127 B2INFO(
"Rbuf2Rbuf: terminate called");
A class definition of an input module for Sequential ROOT I/O.
Class to manage a Ring Buffer placed in an IPC shared memory.
bool create(bool replace=false)
Create a default object in the data store.
Type-safe access to single objects in the data store.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.