9#include <framework/pcore/TxModule.h>
11#include <framework/pcore/EvtMessage.h>
12#include <framework/pcore/DataStoreStreamer.h>
13#include <framework/pcore/ProcHandler.h>
14#include <framework/core/RandomNumbers.h>
15#include <framework/core/Environment.h>
33 B2DEBUG(32,
"Tx: Constructor with RingBuffer done.");
37TxModule::~TxModule() =
default;
49 B2DEBUG(32,
"Tx: Streaming objects limited : " << (
Environment::Instance().getStreamingObjects()).size() <<
" objects");
52 B2DEBUG(32,
getName() <<
" initialized.");
61 B2DEBUG(35,
"beginRun called (will wait for reading processes to finish processing previous run...).");
67 B2DEBUG(35,
"beginRun done.");
90 B2WARNING(
"Ring buffer seems full, removing some previous data.");
98 B2DEBUG(35,
"Tx: objs sent in buffer. Size = " << msg->
size());
106 B2DEBUG(35,
"endRun done.");
112 B2DEBUG(32,
"Tx: terminate called");
Stream/restore DataStore objects to/from EvtMessage.
@ c_DontWriteOut
Object/array should be NOT saved by output modules.
static Environment & Instance()
Static method to get a reference to the Environment instance.
Class to manage streamed object.
int paddedSize() const
Same as size(), but as size of an integer array.
char * buffer()
Get buffer address.
int size() const
Get size of message including headers.
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
const std::string & getName() const
Returns the name of the module.
@ c_Input
This module is an input module (reads data).
@ c_InternalSerializer
This module is an internal serializer/deserializer for parallel processing.
void setName(const std::string &name)
Set the name of the module.
void setType(const std::string &type)
Set the module type.
static bool isInputProcess()
Return true if the process is an input process.
static RandomGenerator & getEventRandomGenerator()
return reference to the event dependent random generator
Class to manage a Ring Buffer placed in an IPC shared memory.
int shmid() const
Return ID of the shared memory.
DataStoreStreamer * m_streamer
DataStoreStreamer.
virtual void initialize() override
Module functions to be called from main process.
virtual void event() override
This method is the core of the module.
bool m_blockingInsert
Whether to block until we can insert data into the ring buffer in event().
TxModule(RingBuffer *rbuf)
Constructor.
virtual void endRun() override
This method is called if the current run ends.
virtual void terminate() override
This method is called at the end of the event processing.
RingBuffer * m_rbuf
RingBuffer (not owned by us)
virtual void beginRun() override
Called when entering a new run.
int m_nsent
No. of sent events.
StoreObjPtr< RandomGenerator > m_randomgenerator
Random Generator object to pass to RxModule.
bool m_handleMergeable
Whether to handle Mergeable objects.
int m_compressionLevel
Compression parameter.
bool m_sendRandomState
Whether to transfer the RandomGenerator state.
Abstract base class for different kinds of events.