Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Public Member Functions | Static Public Member Functions | List of all members
DataFifo Class Reference

#include <DataFifo.h>

Public Member Functions

int setup (const std::string &name, size_t msgSize, size_t maxMsg, bool blocking, bool recreate=true)
 
int send (const char *buf, size_t size)
 
int receive (char *buf, double timeoutMs=0)
 
int cleanup ()
 

Static Public Member Functions

static bool test ()
 

Detailed Description

Uni-directional RT-safe-queue. A light wrapper around __wrap_mq_...

Member Function Documentation

int DataFifo::setup ( const std::string &  name,
size_t  msgSize,
size_t  maxMsg,
bool  blocking,
bool  recreate = true 
)

Set queue

Parameters
namename of queue (should start with / and contain no other /)
msgSizemaximum size of each message in the queue (bytes)
maxMsgmaximum number of messages in the queue
blockingset to 1 if queue should block when reading and not data is available, 0 for non-blocking
recreateif a queue with the same name already exists, destroy it and create a new one (this is the only way the msgSize and maxMsg parameters can be enforced).
Returns
0 on success, -errno otherwise
int DataFifo::send ( const char *  buf,
size_t  size 
)

Send buffer to queue

Parameters
bufbuffer containing data to send
sizemaximum size of each message
Returns
0 on success, -errno otherwise
int DataFifo::receive ( char *  buf,
double  timeoutMs = 0 
)

Receive buffer from queue

Parameters
bufbuffer to write the received data into. This must have space for at least size bytes, as passed to setup()
Returns
size of message on success, -errno otherwise
int DataFifo::cleanup ( )

Cleanup queue

Returns
0 on success, -errno otherwise

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