Account
| Beamlib 3.3.4 This is the Beam C++ class library. |
A template first in first out data buffer to store any object types. More...
#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. | |
| BError | rebase () |
| Rebases fifo so read pointer is at zero moving memory as needed. | |
| 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 * | 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 | readPos (BUInt pos) |
| Read item at given offset from current read position. | |
| void | writePos (BUInt pos, const Type &v) |
| Write item at given offset from current read position. | |
| Type & | operator[] (int pos) |
| Direct access to read samples in buffer. | |
Protected Attributes | |
| BUInt | osize |
| The size of the FIFO. | |
| Type * | odata |
| FIFO memory buffer. | |
| volatile BUInt | owritePos |
| The write pointer. | |
| volatile BUInt | oreadPos |
| The read pointer. | |
Detailed Description
class BFifo< Type >
A template first in first out data buffer to store any object types.
This class stores data in a ring buffer. It can store up to (size - 1) items. It has separate read and write pointers. These are thread safe. Note the read and write routines do not bounds check the Fifo. You have to use readAvailable()/writeAvailable() functions to check how much can be read/written before performing the reads or writes.
Constructor & Destructor Documentation
◆ BFifo()
◆ ~BFifo()
Member Function Documentation
◆ clear()
| void BFifo< Type >::clear | ( | ) |
◆ size()
◆ resize()
◆ rebase()
Rebases fifo so read pointer is at zero moving memory as needed.
◆ writeAvailable()
◆ writeAvailableChunk()
How many items that can be written in a chunk.
◆ write() [1/2]
◆ write() [2/2]
Write a set of items. Can only write a maximum of writeAvailableChunk() to save going beyond end of FIFO buffer.
◆ writeData() [1/2]
| Type * BFifo< Type >::writeData | ( | ) |
Returns a pointer to the data.
◆ writeData() [2/2]
Returns a pointer to the data and how many can be written in a chunk.
◆ writeDone()
◆ writeBackup()
Backup, remove num items at end of fifo. Careful, make sure read is not already happening.
◆ readAvailable()
◆ readAvailableChunk()
How many items are available to read in a chunk.
◆ read() [1/2]
| Type BFifo< Type >::read | ( | ) |
Read one item.
◆ read() [2/2]
◆ readData() [1/2]
| Type * BFifo< Type >::readData | ( | ) |
Returns a pointer to the data.
◆ readData() [2/2]
Returns a pointer to the data and how many can be read in a chunk.
◆ readDone()
◆ readPos()
Read item at given offset from current read position.
◆ writePos()
Write item at given offset from current read position.
◆ operator[]()
| Type & BFifo< Type >::operator[] | ( | int | pos | ) |
Direct access to read samples in buffer.
Member Data Documentation
◆ osize
◆ odata
| protected |
FIFO memory buffer.
◆ owritePos
◆ oreadPos
The documentation for this class was generated from the following file:
Generated by
