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 | List of all members
Pipe Class Reference

#include <Pipe.h>

Public Member Functions

 Pipe (const std::string &pipeName, size_t size=65536 *128, bool newBlockingRt=false, bool newBlockingNonRt=false)
 
 Pipe (Pipe &&)=delete
 
bool setup (const std::string &pipeName=defaultName, size_t size=65536 *128, bool newBlockingRt=false, bool newBlockingNonRt=false)
 
void cleanup ()
 
void setBlockingRt (bool blocking)
 
void setBlockingNonRt (bool blocking)
 
void setTimeoutMsRt (double timeoutMs)
 
void setTimeoutMsNonRt (double timeoutMs)
 
template<typename T >
bool writeNonRt (const T &data)
 
template<typename T >
bool writeNonRt (T *ptr, size_t count)
 
template<typename T >
bool writeRt (const T &data)
 
template<typename T >
bool writeRt (T *ptr, size_t count)
 
template<typename T >
ssize_t readNonRt (T &dest)
 
template<typename T >
ssize_t readNonRt (T *dest, size_t count)
 
template<typename T >
ssize_t readRt (T &dest)
 
template<typename T >
ssize_t readRt (T *dest, size_t count)
 

Detailed Description

A bi-directional pipe to exchange data between a RT and a non-RT thread.

Examples:
Communication/Serial/render.cpp, Gui/frequency-response/render.cpp, Trill/craft-visual/render.cpp, Trill/flex-visual/render.cpp, and Trill/general-settings/render.cpp.

Member Function Documentation

bool Pipe::setup ( const std::string &  pipeName = defaultName,
size_t  size = 65536 * 128,
bool  newBlockingRt = false,
bool  newBlockingNonRt = false 
)

Initialise the Pipe.

Parameters
thename of the Pipe. Pipes with the same name share data.
thesize of the Pipe. This is the amount of data that can be stored in the pipe. If the pipe is full, writes will fail.
whetherreads at the RT side should be blocking (can be modified later)
whetherreads at the non-RT side should be blocking (can be modified later)
Returns
true on success, false otherwise
Examples:
Communication/Serial/render.cpp, Gui/frequency-response/render.cpp, Trill/craft-visual/render.cpp, Trill/flex-visual/render.cpp, and Trill/general-settings/render.cpp.
void Pipe::setBlockingRt ( bool  blocking)

Set whether reads at the RT side should be blocking

void Pipe::setBlockingNonRt ( bool  blocking)

Set whether reads at the non-RT side should be blocking

void Pipe::setTimeoutMsRt ( double  timeoutMs)

Set timeout for blocking reads at the RT side.

void Pipe::setTimeoutMsNonRt ( double  timeoutMs)

Set timeout for blocking reads at the non-RT side.

template<typename T >
bool Pipe::writeNonRt ( const T &  data)
template<typename T >
bool Pipe::writeNonRt ( T *  ptr,
size_t  count 
)

Send data from the non-RT side.

template<typename T >
bool Pipe::writeRt ( const T &  data)

Send data from the RT side.

template<typename T >
bool Pipe::writeRt ( T *  ptr,
size_t  count 
)

Send data from the RT side.

template<typename T >
ssize_t Pipe::readNonRt ( T &  dest)

Read data from the non-RT side.

template<typename T >
ssize_t Pipe::readNonRt ( T *  dest,
size_t  count 
)

Read data from the non-RT side.

template<typename T >
ssize_t Pipe::readRt ( T &  dest)
template<typename T >
ssize_t Pipe::readRt ( T *  dest,
size_t  count 
)

Read data from the RT side.


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