event_detector 1.0.0
|
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 | |
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.
std::string event_detector::BufferManager::getInfo | ( | ) | const |
Returns a string representation of all buffers that are currently present.
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.
is_write | write/read mode |
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.
is_write | write/read mode |
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.
|
mutable |
mutex for locking all buffer access
Definition at line 319 of file BufferManager.hpp.
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.