LibBeamApi  1.3.0
Public Types | Public Member Functions | Private Member Functions | Private Attributes
BFifo Class Reference

This class implements a thread safe FIFO buffer. More...

#include <BFifo.h>

List of all members.

Public Types

enum  { defaultSize = 1024 }

Public Member Functions

 BFifo (uint32_t size=defaultSize)
 ~BFifo ()
uint32_t size ()
 Return the buffers actual size.
void clear ()
 Clear all of the data in the buffer.
uint32_t writeAvailable ()
 Returns the space available to write.
BError writeWaitAvailable (uint32_t numFifoSamples)
 Wait for the given number of samples.
BError write (const Type *data, uint32_t numFifoSamples)
 Writes the data to the buffer. Blocks until complete.
Type * writeData ()
 Return a pointer to the current start of the buffer.
void writeDone (uint32_t numFifoSamples)
 Update the write pointer.
uint32_t readAvailable ()
 Returns the number of bytes of data available.
BError readWaitAvailable (uint32_t numFifoSamples)
 Wait for given number of samples.
BError read (Type *data, uint32_t numFifoSamples)
Type * readData ()
 Pointer to raw data.
BError readDone (uint32_t numFifoSamples)
 Updates read pointer.
Type & operator[] (int pos)
 Direct access to read samples in buffer.

Private Member Functions

BError mapCircularBuffer (uint32_t size)
void unmapCircularBuffer ()

Private Attributes

BMutex olock
uint32_t ovmSize
uint32_t osize
Type * odata
BFifoPos owritePos
 Current write position.
BCondValue owriteNumFifoSamples
 The number of samples in the FIFO.
BFifoPos oreadPos
 Current read position.

Detailed Description

This class implements a thread safe FIFO buffer.


Member Enumeration Documentation

anonymous enum
Enumerator:
defaultSize 

Constructor & Destructor Documentation

BFifo::BFifo ( uint32_t  size = defaultSize)
BFifo::~BFifo ( )

Member Function Documentation

void BFifo::clear ( )

Clear all of the data in the buffer.

BError BFifo::mapCircularBuffer ( uint32_t  size) [private]
Type& BFifo::operator[] ( int  pos)

Direct access to read samples in buffer.

BError BFifo::read ( Type *  data,
uint32_t  numFifoSamples 
)
uint32_t BFifo::readAvailable ( )

Returns the number of bytes of data available.

Type* BFifo::readData ( )

Pointer to raw data.

BError BFifo::readDone ( uint32_t  numFifoSamples)

Updates read pointer.

BError BFifo::readWaitAvailable ( uint32_t  numFifoSamples)

Wait for given number of samples.

uint32_t BFifo::size ( )

Return the buffers actual size.

void BFifo::unmapCircularBuffer ( ) [private]
BError BFifo::write ( const Type *  data,
uint32_t  numFifoSamples 
)

Writes the data to the buffer. Blocks until complete.

uint32_t BFifo::writeAvailable ( )

Returns the space available to write.

Type* BFifo::writeData ( )

Return a pointer to the current start of the buffer.

void BFifo::writeDone ( uint32_t  numFifoSamples)

Update the write pointer.

BError BFifo::writeWaitAvailable ( uint32_t  numFifoSamples)

Wait for the given number of samples.


Member Data Documentation

Type* BFifo::odata [private]
BMutex BFifo::olock [private]

Current read position.

uint32_t BFifo::osize [private]
uint32_t BFifo::ovmSize [private]

The number of samples in the FIFO.

Current write position.


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