Cern
LibTmsApi 2.3.0

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.
 
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.
 

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.
 
BCondValue owriteNumFifoSamples
 The number of samples in the FIFO.
 
BFifoCircPos oreadPos
 Current read position.
 

Detailed Description

template<class Type>
class BFifoCirc< Type >

This class implements a thread safe FIFO buffer.

Member Enumeration Documentation

◆ anonymous enum

template<class Type >
anonymous enum
Enumerator
defaultSize 

Constructor & Destructor Documentation

◆ BFifoCirc()

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

◆ ~BFifoCirc()

template<class Type >
BFifoCirc< Type >::~BFifoCirc ( )

Member Function Documentation

◆ clear()

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

Clear all of the data in the buffer.

◆ mapCircularBuffer()

template<class Type >
BError BFifoCirc< Type >::mapCircularBuffer ( uint32_t  size)
protected

◆ operator[]()

template<class Type >
Type & BFifoCirc< Type >::operator[] ( int  pos)

Direct access to read samples in buffer.

◆ read()

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

◆ readAvailable()

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

Returns the number of bytes of data available.

◆ readData()

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

Pointer to raw data.

◆ readDone()

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

Updates read pointer.

◆ readWaitAvailable()

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

Wait for given number of samples.

◆ size()

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

Return the buffers actual size.

◆ unmapCircularBuffer()

template<class Type >
void BFifoCirc< Type >::unmapCircularBuffer ( )
protected

◆ write()

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

Writes the data to the buffer. Blocks until complete.

◆ writeAvailable()

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

Returns the space available to write.

◆ writeData()

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

Return a pointer to the current start of the buffer.

◆ writeDone()

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

Update the write pointer.

◆ writeWaitAvailable()

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

Wait for the given number of samples.

Member Data Documentation

◆ odata

template<class Type >
Type* BFifoCirc< Type >::odata
protected

◆ olock

template<class Type >
BMutex BFifoCirc< Type >::olock
protected

◆ oreadPos

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

Current read position.

◆ osize

template<class Type >
uint32_t BFifoCirc< Type >::osize
protected

◆ ovmSize

template<class Type >
uint32_t BFifoCirc< Type >::ovmSize
protected

◆ owriteNumFifoSamples

template<class Type >
BCondValue BFifoCirc< Type >::owriteNumFifoSamples
protected

The number of samples in the FIFO.

◆ owritePos

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

Current write position.


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