Belle II Software development
RxModule.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <framework/core/Module.h>
12#include <framework/pcore/RingBuffer.h>
13#include <framework/datastore/StoreObjPtr.h>
14#include <framework/core/RandomGenerator.h>
15
16#include <vector>
17
18
19namespace Belle2 {
25
27 class RxModule : public Module {
28 public:
29
34 explicit RxModule(RingBuffer* rbuf);
35 virtual ~RxModule() override;
36
38 virtual void initialize() override;
39
40 virtual void event() override;
41 virtual void terminate() override;
42
44 void disableMergeableHandling(bool disable = true) { m_handleMergeable = !disable; }
45
47 void initStreamer();
48
56 void readEvent();
57
58 private:
61
64
67
70
76 std::vector<int> m_evtbuf;
77
78 bool m_handleMergeable = true;
79
82 };
83
85} // end namespace Belle2
Stream/restore DataStore objects to/from EvtMessage.
Module()
Constructor.
Definition Module.cc:30
Class to manage a Ring Buffer placed in an IPC shared memory.
Definition RingBuffer.h:39
DataStoreStreamer * m_streamer
Used for serialization.
Definition RxModule.h:63
virtual void initialize() override
Module functions to be called from main process.
Definition RxModule.cc:70
void initStreamer()
initialize m_streamer.
Definition RxModule.cc:36
virtual void event() override
This method is the core of the module.
Definition RxModule.cc:88
virtual void terminate() override
This method is called at the end of the event processing.
Definition RxModule.cc:98
std::vector< int > m_evtbuf
Receive buffer in words, grown on demand by readEvent().
Definition RxModule.h:76
RingBuffer * m_rbuf
attached RingBuffer.
Definition RxModule.h:60
int m_nrecv
Current event number.
Definition RxModule.h:69
void readEvent()
Gets data from m_rbuf and puts it into the data store.
Definition RxModule.cc:42
StoreObjPtr< RandomGenerator > m_randomgenerator
Random Generator object to receive from TxModule.
Definition RxModule.h:81
bool m_handleMergeable
Whether to handle Mergeable objects.
Definition RxModule.h:78
int m_compressionLevel
Compression Level.
Definition RxModule.h:66
void disableMergeableHandling(bool disable=true)
Disable handling of Mergeable objects.
Definition RxModule.h:44
RxModule(RingBuffer *rbuf)
Constructor.
Definition RxModule.cc:19
Type-safe access to single objects in the data store.
Definition StoreObjPtr.h:96
Abstract base class for different kinds of events.