Cern
LibTmsApi 2.3.0
BFifo< Type > Class Template Reference

#include <BFifo.h>

Public Member Functions

 BFifo (BUInt size)
 
 ~BFifo ()
 
void clear ()
 
BUInt size ()
 Returns fifo size.
 
BError resize (BUInt size)
 Resize FIFO, clears it as well.
 
BUInt writeAvailable ()
 How many items that can be written.
 
BUInt writeAvailableChunk ()
 How many items that can be written in a chunk.
 
BError write (const Type v)
 Write a single item.
 
BError write (const Type *data, BUInt num)
 Write a set of items. Can only write a maximum of writeAvailableChunk() to save going beyond end of FIFO buffer.
 
Type * writeData ()
 Returns a pointer to the data.
 
Type * writeData (BUInt &num)
 Returns a pointer to the data and how many can be written in a chunk.
 
void writeDone (BUInt num)
 Indicates when write is complete.
 
void writeBackup (BUInt num)
 Backup, remove num items at end of fifo. Careful, make sure read is not already happening.
 
BUInt readAvailable ()
 How many items are available to read.
 
BUInt readAvailableChunk ()
 How many items are available to read in a chunk.
 
Type read ()
 Read one item.
 
BError read (Type *data, BUInt num)
 Read a set of items.
 
Type readPos (BUInt pos)
 Read item at given offset from current read position.
 
Type * readData ()
 Returns a pointer to the data.
 
Type * readData (BUInt &num)
 Returns a pointer to the data and how many can be read in a chunk.
 
void readDone (BUInt num)
 
Type & operator[] (int pos)
 Direct access to read samples in buffer.
 

Protected Attributes

BMutex olock
 
BUInt osize
 The size of the FIFO.
 
Type * odata
 FIFO memory buffer.
 
BUInt owritePos
 The write pointer.
 
BUInt oreadPos
 The read pointer.
 

Constructor & Destructor Documentation

◆ BFifo()

template<class Type >
BFifo< Type >::BFifo ( BUInt  size)

◆ ~BFifo()

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

Member Function Documentation

◆ clear()

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

◆ operator[]()

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

Direct access to read samples in buffer.

◆ read() [1/2]

template<class Type >
Type BFifo< Type >::read ( )

Read one item.

◆ read() [2/2]

template<class Type >
BError BFifo< Type >::read ( Type *  data,
BUInt  num 
)

Read a set of items.

◆ readAvailable()

template<class Type >
BUInt BFifo< Type >::readAvailable ( )

How many items are available to read.

◆ readAvailableChunk()

template<class Type >
BUInt BFifo< Type >::readAvailableChunk ( )

How many items are available to read in a chunk.

◆ readData() [1/2]

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

Returns a pointer to the data.

◆ readData() [2/2]

template<class Type >
Type * BFifo< Type >::readData ( BUInt num)

Returns a pointer to the data and how many can be read in a chunk.

◆ readDone()

template<class Type >
void BFifo< Type >::readDone ( BUInt  num)

◆ readPos()

template<class Type >
Type BFifo< Type >::readPos ( BUInt  pos)

Read item at given offset from current read position.

◆ resize()

template<class Type >
BError BFifo< Type >::resize ( BUInt  size)

Resize FIFO, clears it as well.

◆ size()

template<class Type >
BUInt BFifo< Type >::size ( )

Returns fifo size.

◆ write() [1/2]

template<class Type >
BError BFifo< Type >::write ( const Type *  data,
BUInt  num 
)

Write a set of items. Can only write a maximum of writeAvailableChunk() to save going beyond end of FIFO buffer.

◆ write() [2/2]

template<class Type >
BError BFifo< Type >::write ( const Type  v)

Write a single item.

◆ writeAvailable()

template<class Type >
BUInt BFifo< Type >::writeAvailable ( )

How many items that can be written.

◆ writeAvailableChunk()

template<class Type >
BUInt BFifo< Type >::writeAvailableChunk ( )

How many items that can be written in a chunk.

◆ writeBackup()

template<class Type >
void BFifo< Type >::writeBackup ( BUInt  num)

Backup, remove num items at end of fifo. Careful, make sure read is not already happening.

◆ writeData() [1/2]

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

Returns a pointer to the data.

◆ writeData() [2/2]

template<class Type >
Type * BFifo< Type >::writeData ( BUInt num)

Returns a pointer to the data and how many can be written in a chunk.

◆ writeDone()

template<class Type >
void BFifo< Type >::writeDone ( BUInt  num)

Indicates when write is complete.

Member Data Documentation

◆ odata

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

FIFO memory buffer.

◆ olock

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

◆ oreadPos

template<class Type >
BUInt BFifo< Type >::oreadPos
protected

The read pointer.

◆ osize

template<class Type >
BUInt BFifo< Type >::osize
protected

The size of the FIFO.

◆ owritePos

template<class Type >
BUInt BFifo< Type >::owritePos
protected

The write pointer.


The documentation for this class was generated from the following file:
  • /src/cern/tms/tms/beam/libBeam/BFifo.h