Marsyas  0.5.0-beta1
Public Member Functions
realvec_queue_producer Class Reference

Interface to write data to realvec_queue. More...

#include <realvec_queue.h>

Public Member Functions

mrs_natural capacity ()
 [THREAD-SAFE] Amount of samples reserved for writing.
mrs_realoperator() (mrs_natural observation, mrs_natural sample)
 [THREAD-SAFE] Access data reserved for writing.
 realvec_queue_producer (realvec_queue &destination, mrs_natural capacity)
 [THREAD-SAFE] Construct producer and reserve queue space for writing.
bool reserve (mrs_natural capacity)
 [THREAD-SAFE] Reserve more queue space for writing.
 ~realvec_queue_producer ()
 [THREAD-SAFE] Destroy producer and make the reserved space available to the realvec_queue_consumer for reading.

Detailed Description

Interface to write data to realvec_queue.

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

This class allows a producer of data to push onto a realvec_queue.

Definition at line 209 of file realvec_queue.h.


Constructor & Destructor Documentation

realvec_queue_producer ( realvec_queue destination,
mrs_natural  capacity 
) [inline]

[THREAD-SAFE] Construct producer and reserve queue space for writing.

Parameters:
destinationThe queue to write to.
capacityThe requested amount of samples.

If the amount of free samples in the queue is smaller than requested, no space is reserved, and capacity() will return 0.

Definition at line 224 of file realvec_queue.h.

~realvec_queue_producer ( ) [inline]

[THREAD-SAFE] Destroy producer and make the reserved space available to the realvec_queue_consumer for reading.

Definition at line 239 of file realvec_queue.h.


Member Function Documentation

mrs_natural capacity ( ) [inline]

[THREAD-SAFE] Amount of samples reserved for writing.

Definition at line 250 of file realvec_queue.h.

mrs_real& operator() ( mrs_natural  observation,
mrs_natural  sample 
) [inline]

[THREAD-SAFE] Access data reserved for writing.

Parameters:
observationChannel index in range of 0 to `queue.observations()`
sampleSample index, among reserved samples; in the range of 0 to `capacity()`, where 0 denotes the first reserved sample, and so on...
Returns:
A reference to the data at requested indexes.

Definition at line 282 of file realvec_queue.h.

bool reserve ( mrs_natural  capacity) [inline]

[THREAD-SAFE] Reserve more queue space for writing.

Parameters:
capacityThe requested amount of samples.
Returns:
Whether the requested amount of samples was successfully reserved.

It is only possible to reserve more samples than already reserved. If less or equal amount is requested, this method will return true, but the reserved amount will not change.

If the amount of free samples in the queue is smaller than requested, This method will return false, and the amount of reserved space will not change.

Definition at line 264 of file realvec_queue.h.


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