Belle II Software light-2406-ragdoll
TxModule.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 TxModule : public Module {
26
27 // Public functions
28 public:
29
34 explicit TxModule(RingBuffer* rbuf);
35 virtual ~TxModule();
36
38 virtual void initialize() override;
39
40 virtual void beginRun() override;
41 virtual void event() override;
42 virtual void endRun() override;
43 virtual void terminate() override;
44
50 void setBlockingInsert(bool block) { m_blockingInsert = block; }
51
53 void disableMergeableHandling(bool disable = true) { m_handleMergeable = !disable; }
54
56 void disableSendRandomState(bool disable = true) { m_sendRandomState = !disable; }
57 private:
58
61
64
67
70
73
74 bool m_handleMergeable = true;
75 bool m_sendRandomState = true;
79 };
80
82} // 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
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
Module for encoding data store contents into a RingBuffer.
Definition: TxModule.h:25
DataStoreStreamer * m_streamer
DataStoreStreamer.
Definition: TxModule.h:66
virtual void initialize() override
Module functions to be called from main process.
Definition: TxModule.cc:40
virtual void event() override
This method is the core of the module.
Definition: TxModule.cc:72
bool m_blockingInsert
Whether to block until we can insert data into the ring buffer in event().
Definition: TxModule.h:72
virtual void endRun() override
This method is called if the current run ends.
Definition: TxModule.cc:105
virtual void terminate() override
This method is called at the end of the event processing.
Definition: TxModule.cc:111
RingBuffer * m_rbuf
RingBuffer (not owned by us)
Definition: TxModule.h:63
virtual void beginRun() override
Called when entering a new run.
Definition: TxModule.cc:57
int m_nsent
No. of sent events.
Definition: TxModule.h:69
StoreObjPtr< RandomGenerator > m_randomgenerator
Random Generator object to pass to RxModule.
Definition: TxModule.h:78
void disableSendRandomState(bool disable=true)
Disable sending of RandomGenerator state.
Definition: TxModule.h:56
bool m_handleMergeable
Whether to handle Mergeable objects.
Definition: TxModule.h:74
int m_compressionLevel
Compression parameter.
Definition: TxModule.h:60
void disableMergeableHandling(bool disable=true)
Disable handling of Mergeable objects.
Definition: TxModule.h:53
bool m_sendRandomState
Whether to transfer the RandomGenerator state.
Definition: TxModule.h:75
void setBlockingInsert(bool block)
Whether to block until we can insert data into the ring buffer in event().
Definition: TxModule.h:50
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24