Belle II Software light-2505-deimos
AsyncWrapper.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
13namespace Belle2 {
18 class RxModule;
19 class TxModule;
20 class RingBuffer;
21
34 class AsyncWrapper : public Module {
35 public:
39 explicit AsyncWrapper(const std::string& moduleType);
40
42
45
50 void initialize() override;
52 void event() override;
54 void terminate() override;
55
57 static bool isAsync() { return s_isAsync; }
58
60 static int numAvailableEvents();
61
62
63 private:
66
69
72
75
78
80 static bool s_isAsync;
81
84 };
85
86}
ModulePtr getWrapped()
Access wrapped module (owned by AsyncWrapper).
TxModule * m_tx
transmitting module.
void initialize() override
Call this from initialize().
void event() override
Call this from event().
void terminate() override
Call this from terminate().
ModulePtr m_wrappedModule
The wrapped module.
AsyncWrapper(const std::string &moduleType)
Wrap am module of given type.
static bool isAsync()
returns true if the current process is on the receiving (async) side of an AsyncWrapper.
RxModule * m_rx
receiving module.
static int numAvailableEvents()
Return number of events available in the RingBuffer.
RingBuffer * m_ringBuffer
shared memory buffer
static RingBuffer * s_currentRingBuffer
if s_isAsync is true, this contains the corresponding RingBuffer, see numAvailableEvents().
static bool s_isAsync
true if the current process is on the receiving (async) side of an AsyncWrapper.
bool m_discardOldEvents
Discard old events when buffer is full.
Module()
Constructor.
Definition Module.cc:30
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
Module for encoding data store contents into a RingBuffer.
Definition TxModule.h:25
std::shared_ptr< Module > ModulePtr
Defines a pointer to a module object as a boost shared pointer.
Definition Module.h:43
Abstract base class for different kinds of events.