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
17namespace Belle2 {
22 class DataStoreStreamer;
23
25 class RxModule : public Module {
26 public:
27
32 explicit RxModule(RingBuffer* rbuf);
33 virtual ~RxModule();
34
36 virtual void initialize() override;
37
38 virtual void beginRun() override;
39 virtual void event() override;
40 virtual void endRun() override;
41 virtual void terminate() override;
42
44 void disableMergeableHandling(bool disable = true) { m_handleMergeable = !disable; }
45
47 void initStreamer();
48
50 void readEvent();
51
52 private:
55
58
61
64
65 bool m_handleMergeable = true;
69 };
70
72} // end namespace Belle2
Stream/restore DataStore objects to/from EvtMessage.
Base class for Modules.
Definition: Module.h:72
Class to manage a Ring Buffer placed in an IPC shared memory.
Definition: RingBuffer.h:39
Module to decode data store contents from RingBuffer.
Definition: RxModule.h:25
DataStoreStreamer * m_streamer
Used for serialization.
Definition: RxModule.h:57
virtual void initialize() override
Module functions to be called from main process.
Definition: RxModule.cc:67
void initStreamer()
initialize m_streamer.
Definition: RxModule.cc:38
virtual void event() override
This method is the core of the module.
Definition: RxModule.cc:83
virtual void endRun() override
This method is called if the current run ends.
Definition: RxModule.cc:93
virtual void terminate() override
This method is called at the end of the event processing.
Definition: RxModule.cc:95
RingBuffer * m_rbuf
attached RingBuffer.
Definition: RxModule.h:54
virtual void beginRun() override
Called when entering a new run.
Definition: RxModule.cc:81
int m_nrecv
Current event number.
Definition: RxModule.h:63
void readEvent()
Gets data from m_rbuf and puts it into the data store.
Definition: RxModule.cc:44
StoreObjPtr< RandomGenerator > m_randomgenerator
Random Generator object to receive from TxModule.
Definition: RxModule.h:68
bool m_handleMergeable
Whether to handle Mergeable objects.
Definition: RxModule.h:65
int m_compressionLevel
Compression Level.
Definition: RxModule.h:60
void disableMergeableHandling(bool disable=true)
Disable handling of Mergeable objects.
Definition: RxModule.h:44
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
Abstract base class for different kinds of events.