LibTmsApi  2.0.0
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
BFifoCirc< Type > Class Template Reference

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

#include <BFifoCirc.h>

Public Types

enum  { defaultSize = 1024 }
 

Public Member Functions

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

Protected Member Functions

BError mapCircularBuffer (uint32_t size)
 
void unmapCircularBuffer ()
 

Protected Attributes

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

Detailed Description

template<class Type>
class BFifoCirc< Type >

This class implements a thread safe FIFO buffer.

Member Enumeration Documentation

template<class Type >
anonymous enum
Enumerator
defaultSize 

Constructor & Destructor Documentation

template<class Type >
BFifoCirc< Type >::BFifoCirc ( uint32_t  size = defaultSize)
template<class Type >
BFifoCirc< Type >::~BFifoCirc ( )

Member Function Documentation

template<class Type >
void BFifoCirc< Type >::clear ( )

Clear all of the data in the buffer.

template<class Type >
BError BFifoCirc< Type >::mapCircularBuffer ( uint32_t  size)
protected
template<class Type >
Type& BFifoCirc< Type >::operator[] ( int  pos)

Direct access to read samples in buffer.

template<class Type >
BError BFifoCirc< Type >::read ( Type *  data,
uint32_t  numFifoSamples 
)
template<class Type >
uint32_t BFifoCirc< Type >::readAvailable ( )

Returns the number of bytes of data available.

template<class Type >
Type* BFifoCirc< Type >::readData ( )

Pointer to raw data.

template<class Type >
BError BFifoCirc< Type >::readDone ( uint32_t  numFifoSamples)

Updates read pointer.

template<class Type >
BError BFifoCirc< Type >::readWaitAvailable ( uint32_t  numFifoSamples)

Wait for given number of samples.

template<class Type >
uint32_t BFifoCirc< Type >::size ( )

Return the buffers actual size.

template<class Type >
void BFifoCirc< Type >::unmapCircularBuffer ( )
protected
template<class Type >
BError BFifoCirc< Type >::write ( const Type *  data,
uint32_t  numFifoSamples 
)

Writes the data to the buffer. Blocks until complete.

template<class Type >
uint32_t BFifoCirc< Type >::writeAvailable ( )

Returns the space available to write.

template<class Type >
Type* BFifoCirc< Type >::writeData ( )

Return a pointer to the current start of the buffer.

template<class Type >
void BFifoCirc< Type >::writeDone ( uint32_t  numFifoSamples)

Update the write pointer.

template<class Type >
BError BFifoCirc< Type >::writeWaitAvailable ( uint32_t  numFifoSamples)

Wait for the given number of samples.

Member Data Documentation

template<class Type >
Type* BFifoCirc< Type >::odata
protected
template<class Type >
BMutex BFifoCirc< Type >::olock
protected
template<class Type >
BFifoCircPos BFifoCirc< Type >::oreadPos
protected

Current read position.

template<class Type >
uint32_t BFifoCirc< Type >::osize
protected
template<class Type >
uint32_t BFifoCirc< Type >::ovmSize
protected
template<class Type >
BCondValue BFifoCirc< Type >::owriteNumFifoSamples
protected

The number of samples in the FIFO.

template<class Type >
BFifoCircPos BFifoCirc< Type >::owritePos
protected

Current write position.


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