Marsyas  0.5.0-beta1
Data Structures | Files | Functions
Core classes which are not MarSystems

These classes are not MarSystems, but are fundamental classes for Marsyas. More...

Data Structures

class  Collection
 List of files. More...
class  NumericLib
 Assorted Numerical Routines. More...
class  realvec
 Vector of mrs_real values. More...
class  realvec_queue_consumer
 Interface to read data from realvec_queue. More...
class  realvec_queue_producer
 Interface to write data to realvec_queue. More...
class  stage< T >
 Thread-safe lock-free exchange of large data. More...
class  statistics
 Assorted Stastical Routines Routines for computing Nth moments around a mean (such as std, skewness, and kurtosis). More...

Files

file  common_header.h
file  common_source.h
file  types.h

Functions

template<typename T >
clipped (const T &lower, const T &n, const T &upper)
 Lock-free fixed-size queue, implemented as a realvec-based ringbuffer.

Detailed Description

These classes are not MarSystems, but are fundamental classes for Marsyas.


Function Documentation

T Marsyas::clipped ( const T &  lower,
const T &  n,
const T &  upper 
)

Lock-free fixed-size queue, implemented as a realvec-based ringbuffer.

Author:
Jakob Leben <jakob.leben@gmail.com>

The relavec_queue is a thread-safe, lock-free, fixed-size queue (FIFO) of multiple channels of mrs_real values, for use by a single data producing thread and a single data consuming thread.

"Fixed-size" means that the size (i.e. the amount of samples the queue can contain) can only be defined while other threads are not pushing and popping data (i.e. not in a thread-safe manner).

"Single-producer, single-consumer" means that the queue is thread-safe only as long as a single thread is pushing to it, and a single thread is popping from it.

"Lock-free" means that the thread synchronization only uses atomic operations and no mutexes or any other kind of synchronization methods subject to thread-priority inversion. This makes it suitable for real-time applications.

This class operates in combination with the realvec_queue_producer and realvec_queue_consumer classes: the realvec_queue only contains the data to pass between the producer and the consumer, but does not provide an interface to write and read data. Those interfaces are provided by the other two classes, respectively.

Definition at line 63 of file realvec_queue.h.