artdaq_core  v3_05_10
artdaq::SharedMemoryEventReceiver Class Reference

SharedMemoryEventReceiver can receive events (as written by SharedMemoryEventManager) from Shared Memory. More...

#include <artdaq-core/Core/SharedMemoryEventReceiver.hh>

Public Member Functions

 SharedMemoryEventReceiver (uint32_t shm_key, uint32_t broadcast_shm_key)
 Connect to a Shared Memory segment using the given parameters. More...
 
virtual ~SharedMemoryEventReceiver ()=default
 SharedMemoryEventReceiver Destructor.
 
bool ReadyForRead (bool broadcast=false, size_t timeout_us=1000000)
 Determine whether an event is available for reading. More...
 
detail::RawEventHeaderReadHeader (bool &err)
 Get the Event header. More...
 
std::set< Fragment::type_tGetFragmentTypes (bool &err)
 Get a set of Fragment Types present in the event. More...
 
std::unique_ptr< FragmentsGetFragmentsByType (bool &err, Fragment::type_t type)
 Get a pointer to the Fragments of a given type in the event. More...
 
std::string toString ()
 Write out information about the Shared Memory to a string. More...
 
void ReleaseBuffer ()
 Release the buffer currently being read to the Empty state.
 
int GetRank ()
 Returns the Rank of the writing process. More...
 
int GetMyId ()
 Returns the ID of the reading process. More...
 
bool IsEndOfData ()
 Determine if the end of data has been reached (from data shared memory segment) More...
 
int ReadReadyCount ()
 Get the count of available buffers, both broadcasts and data. More...
 
size_t size ()
 Get the size of the data buffer. More...
 

Detailed Description

SharedMemoryEventReceiver can receive events (as written by SharedMemoryEventManager) from Shared Memory.

Definition at line 14 of file SharedMemoryEventReceiver.hh.

Constructor & Destructor Documentation

artdaq::SharedMemoryEventReceiver::SharedMemoryEventReceiver ( uint32_t  shm_key,
uint32_t  broadcast_shm_key 
)

Connect to a Shared Memory segment using the given parameters.

Parameters
shm_keyKey of the Shared Memory segment
broadcast_shm_keyKey of the broadcast Shared Memory segment

Definition at line 11 of file SharedMemoryEventReceiver.cc.

Member Function Documentation

std::unique_ptr< artdaq::Fragments > artdaq::SharedMemoryEventReceiver::GetFragmentsByType ( bool &  err,
Fragment::type_t  type 
)

Get a pointer to the Fragments of a given type in the event.

Parameters
errFlag used to indicate if an error has occurred
typeType of Fragments to get. (Use InvalidFragmentType to get all Fragments)
Returns
std::unique_ptr to a Fragments object containing returned Fragment objects

Definition at line 124 of file SharedMemoryEventReceiver.cc.

std::set< artdaq::Fragment::type_t > artdaq::SharedMemoryEventReceiver::GetFragmentTypes ( bool &  err)

Get a set of Fragment Types present in the event.

Parameters
errFlag used to indicate if an error has occurred
Returns
std::set of Fragment::type_t of all Fragment types in the event

Definition at line 101 of file SharedMemoryEventReceiver.cc.

int artdaq::SharedMemoryEventReceiver::GetMyId ( )
inline

Returns the ID of the reading process.

Returns
The ID of the reading process

Definition at line 79 of file SharedMemoryEventReceiver.hh.

int artdaq::SharedMemoryEventReceiver::GetRank ( )
inline

Returns the Rank of the writing process.

Returns
The rank of the writer process

Definition at line 73 of file SharedMemoryEventReceiver.hh.

bool artdaq::SharedMemoryEventReceiver::IsEndOfData ( )
inline

Determine if the end of data has been reached (from data shared memory segment)

Returns
Whether the EndOfData flah has been raised by the data shared memory segment

Definition at line 85 of file SharedMemoryEventReceiver.hh.

artdaq::detail::RawEventHeader * artdaq::SharedMemoryEventReceiver::ReadHeader ( bool &  err)

Get the Event header.

Parameters
errFlag used to indicate if an error has occurred
Returns
Pointer to RawEventHeader from buffer

Definition at line 82 of file SharedMemoryEventReceiver.cc.

int artdaq::SharedMemoryEventReceiver::ReadReadyCount ( )
inline

Get the count of available buffers, both broadcasts and data.

Returns
The sum of the available data buffer count and the available broadcast buffer count

Definition at line 91 of file SharedMemoryEventReceiver.hh.

bool artdaq::SharedMemoryEventReceiver::ReadyForRead ( bool  broadcast = false,
size_t  timeout_us = 1000000 
)

Determine whether an event is available for reading.

Parameters
broadcast(Default false) Whether to wait for a broadcast buffer only
timeout_us(Default 1000000) Time to wait for buffer to become available.
Returns
Whether an event is available for reading

Definition at line 22 of file SharedMemoryEventReceiver.cc.

size_t artdaq::SharedMemoryEventReceiver::size ( )
inline

Get the size of the data buffer.

Returns
The size of the data buffer

Definition at line 97 of file SharedMemoryEventReceiver.hh.

std::string artdaq::SharedMemoryEventReceiver::toString ( )

Write out information about the Shared Memory to a string.

Returns
String containing information about the current Shared Memory buffers

Definition at line 180 of file SharedMemoryEventReceiver.cc.


The documentation for this class was generated from the following files: