event_detector 1.0.0
Loading...
Searching...
No Matches
Classes | Public Member Functions | Public Attributes | List of all members
event_detector::BufferManager Class Reference

Component of the Event Detector responsible for buffering live data. More...

#include <BufferManager.hpp>

Classes

class  DataBuffers
 Template class designed to hold all buffers for a specific data type. More...
 

Public Member Functions

 BufferManager ()
 Creates a new BufferManager.
 
void lockBuffers (const bool is_write)
 Locks all buffers for either write or read mode.
 
void unlockBuffers (const bool is_write)
 Unlocks all buffers for either write or read mode.
 
std::string getInfo () const
 Returns a string representation of all buffers that are currently present.
 

Public Attributes

std::mutex buffer_lock_mutex_
 mutex for locking all buffer access
 
std::condition_variable buffer_lock_condition_variable_
 condition variable to lock write/read buffer access
 
int buffer_lock_n_threads_ = 0
 helper variable to count threads in write/read buffer access mode
 

Detailed Description

Component of the Event Detector responsible for buffering live data.

As one of the three components of the Event Detector, the BufferManager buffers all incoming data streams for a certain amount of time. Time is evaluated on a milli-second level. In order to access the buffer, its members provide various getter functions.

Definition at line 54 of file BufferManager.hpp.

Member Function Documentation

◆ getInfo()

std::string event_detector::BufferManager::getInfo ( ) const

Returns a string representation of all buffers that are currently present.

Returns
std::string string representation of the buffers

◆ lockBuffers()

void event_detector::BufferManager::lockBuffers ( const bool  is_write)

Locks all buffers for either write or read mode.

If all buffers are locked in write mode, then a call to this function in read mode will block. Calls to this function in write mode will continue. This allows to run multiple threads in parallel, but only if they are of the same mode, i.e. writing/reading from buffers. The same behavior applies the other way round.

Parameters
is_writewrite/read mode

◆ unlockBuffers()

void event_detector::BufferManager::unlockBuffers ( const bool  is_write)

Unlocks all buffers for either write or read mode.

Buffers stay locked in write or read mode, as long as there are other threads within the same mode that have not yet unlocked the buffers.

Parameters
is_writewrite/read mode

Member Data Documentation

◆ buffer_lock_condition_variable_

std::condition_variable event_detector::BufferManager::buffer_lock_condition_variable_

condition variable to lock write/read buffer access

Definition at line 324 of file BufferManager.hpp.

◆ buffer_lock_mutex_

std::mutex event_detector::BufferManager::buffer_lock_mutex_
mutable

mutex for locking all buffer access

Definition at line 319 of file BufferManager.hpp.

◆ buffer_lock_n_threads_

int event_detector::BufferManager::buffer_lock_n_threads_ = 0

helper variable to count threads in write/read buffer access mode

Definition at line 329 of file BufferManager.hpp.


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