Bounded single-producer / single-consumer ring buffer used to decouple acquisition threads from processing threads. More...
#include "../utils_global.h"#include <QPair>#include <QSemaphore>#include <QSharedPointer>#include <Eigen/Core>
Go to the source code of this file.
Classes | |
| class | UTILSLIB::CircularBuffer< T > |
| Thread-safe lock-free circular (ring) buffer for producer-consumer data exchange between threads. More... | |
Namespaces | |
| namespace | UTILSLIB |
| Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms). | |
Typedefs | |
| typedef CircularBuffer< int > | UTILSLIB::CircularBuffer_int |
| typedef CircularBuffer< short > | UTILSLIB::CircularBuffer_short |
| typedef CircularBuffer< char > | UTILSLIB::CircularBuffer_char |
| typedef CircularBuffer< double > | UTILSLIB::CircularBuffer_double |
| typedef CircularBuffer< QPair< int, int > > | UTILSLIB::CircularBuffer_pair_int_int |
| typedef CircularBuffer< QPair< double, double > > | UTILSLIB::CircularBuffer_pair_double_double |
| typedef CircularBuffer< Eigen::MatrixXd > | UTILSLIB::CircularBuffer_Matrix_double |
| typedef CircularBuffer< Eigen::MatrixXf > | UTILSLIB::CircularBuffer_Matrix_float |
Bounded single-producer / single-consumer ring buffer used to decouple acquisition threads from processing threads.
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2017-2026 MNE-CPP Authors
The template UTILSLIB::CircularBuffer wraps a fixed-size T array with two QSemaphore counters — one tracking free slots, one tracking filled slots — so push and pop block (with a configurable timeout) instead of busy-waiting when the buffer is full or empty. This is the building block behind the RtClient / RtCmd transports in COMMUNICATIONLIB and behind every plugin in MNE Scan that streams matrices across thread boundaries.
The implementation is fully header-only so consumers can specialise on Eigen matrices or POD samples without forcing an explicit instantiation in UTILSLIB. pause() lets the downstream consumer drop incoming data temporarily without tearing down the producer thread.
Definition in file circularbuffer.h.