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

#include <DataBuffer.h>

Public Member Functions

 DataBuffer (char type, unsigned int size)
 
void cleanup ()
 
void setup (char type, unsigned int size)
 
unsigned int getNumElements ()
 
unsigned int getNumBytes ()
 
unsigned int getCapacity ()
 
char getType ()
 
std::vector< char > * getBuffer ()
 
char * getAsChar ()
 
int32_t * getAsInt ()
 
float * getAsFloat ()
 

Detailed Description

DataBuffer.h

Basic class for holding byte buffers with type declaration. Data is stored as bytes and can be retrieved raw or cast as int32 or float.

Created on: June 2019 Author: Adan L. Benito

Member Function Documentation

void DataBuffer::setup ( char  type,
unsigned int  size 
)
inline

Setup function for the buffer.

Parameters
typeCharacter representing the type contained by the buffer.
sizeMaximum size of the container. This is calculated assuming 32 bit floats & ints.
unsigned int DataBuffer::getNumElements ( )
inline

Get number of elements in buffer.

Returns
Number of elements in buffer.
unsigned int DataBuffer::getNumBytes ( )
inline

Get number of bytes in buffer.

Returns
Size of container.
unsigned int DataBuffer::getCapacity ( )
inline

Get maximum number of bytes that the buffer can hold.

Returns
Container's capacity.
char DataBuffer::getType ( )
inline
Returns
Buffer type.
std::vector<char>* DataBuffer::getBuffer ( )
inline
Returns
Pointer to container.
char* DataBuffer::getAsChar ( )
inline
Returns
Pointer to raw byte buffer
int32_t* DataBuffer::getAsInt ( )
inline
Returns
Pointer to buffer contents cast as int32
float* DataBuffer::getAsFloat ( )
inline
Returns
Pointer to buffer contents cast as float

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