Marsyas  0.5.0-beta1
Public Member Functions
realvec_queue_consumer Class Reference

Interface to read data from realvec_queue. More...

#include <realvec_queue.h>

Public Member Functions

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

Detailed Description

Interface to read data from realvec_queue.

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

This class allows a consumer of data to pop off of a realvec_queue.

Definition at line 298 of file realvec_queue.h.


Constructor & Destructor Documentation

realvec_queue_consumer ( realvec_queue source,
mrs_natural  capacity 
) [inline]

[THREAD-SAFE] Construct consumer and reserve queue space for reading.

Parameters:
sourceThe queue to read from.
capacityThe requested amount of samples.

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

Definition at line 313 of file realvec_queue.h.

~realvec_queue_consumer ( ) [inline]

[THREAD-SAFE] Destroy consumer and make the reserved space available to the realvec_queue_producer to reuse for writing.

Definition at line 328 of file realvec_queue.h.


Member Function Documentation

mrs_natural capacity ( ) [inline]

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

Definition at line 339 of file realvec_queue.h.

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

[THREAD-SAFE] Access data reserved for reading.

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 371 of file realvec_queue.h.

bool reserve ( mrs_natural  capacity) [inline]

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

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 available 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 353 of file realvec_queue.h.


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