|
Base Module
VST 3.6.5
SDK for developing VST Plug-in
|
RingBuffer template. More...
#include <tringbuffer.h>
Public Member Functions | |
| TRingBuffer (int32 n=0) | |
| Default constructor. More... | |
| TRingBuffer (T *data, int32 n) | |
| construct a RingBuffer with n data objects More... | |
| virtual | ~TRingBuffer () |
| Destructor. More... | |
| bool | setBuffer (T *data, int32 n) |
| fills the buffer with n data objects More... | |
| bool | resize (int32 n) |
| resize buffer to size n More... | |
| bool | isEmpty () const |
| tells if the buffer is empty More... | |
| int32 | countFree () const |
| returns the number of free slots in the buffer More... | |
| int32 | countFilled () const |
| returns the number of items in the buffer More... | |
| int32 | size () const |
| returns the number of slots in the buffer More... | |
| template<int32 count> | |
| int32 | write (const T *data) |
| write count items to buffer More... | |
| int32 | write (const T *data, int32 count) |
| write count items to buffer More... | |
| bool | write (const T &data) |
| write one item to buffer More... | |
| int32 | read (T *data, int32 count) |
| read count items from buffer More... | |
| bool | read (T &data) |
| read one item from buffer More... | |
| const T & | peek () const |
| look at current item in buffer More... | |
| int32 | peek (T *data, int32 count) const |
| look at count items in buffer More... | |
| void | flush () |
| remove all items from buffer More... | |
| int32 | trash (int32 count) |
| remove count items from buffer More... | |
RingBuffer template.
A RingBuffer is a data structure that uses a fixed-size buffer with circular connections.
| TRingBuffer | ( | int32 | n = 0 | ) |
Default constructor.
RingBuffer constructor.
| [in] | n | : initial size of the buffer |
| TRingBuffer | ( | T * | data, |
| int32 | n | ||
| ) |
construct a RingBuffer with n data objects
RingBuffer constructor with specified data pointer.
| [in] | data | : pointer to data objects to be held in the buffer |
| [in] | n | : initial size of the buffer |
|
virtual |
Destructor.
RingBuffer destructor.
| bool setBuffer | ( | T * | data, |
| int32 | n | ||
| ) |
fills the buffer with n data objects
Sets the RingBuffer to specified data pointer and given size n.
| [in] | data | : pointer to data objects to be held in the buffer |
| [in] | n | : size of the buffer |
| bool resize | ( | int32 | n | ) |
resize buffer to size n
Resize buffer to size n, if the buffer is the owner of the data.
| [in] | n | : number of requested slots in the buffer |
| bool isEmpty | ( | ) | const |
tells if the buffer is empty
Tells if the buffer is empty.
| int32 countFree | ( | ) | const |
returns the number of free slots in the buffer
Returns the number of free slots in the buffer.
|
inline |
returns the number of items in the buffer
Returns the number of items in the buffer.
|
inline |
returns the number of slots in the buffer
Returns the number of slots in the buffer.
| int32 write | ( | const T * | data | ) |
write count items to buffer
| [in] | data | : pointer to the data structure |
| int32 write | ( | const T * | data, |
| int32 | count | ||
| ) |
write count items to buffer
Write count items to buffer.
| [in] | data | : pointer to the data structure |
| [in] | count | : number of items to be written |
| bool write | ( | const T & | data | ) |
write one item to buffer
Write one item to buffer.
| [in] | data | : reference to the data structure |
| int32 read | ( | T * | data, |
| int32 | count | ||
| ) |
read count items from buffer
| [in,out] | data | : pointer to the data structure |
| [in] | count | : number of requested items |
| bool read | ( | T & | data | ) |
read one item from buffer
Read one item from buffer.
| [in,out] | data | : reference to the data structure |
| const T & peek | ( | ) | const |
look at current item in buffer
look at current item in buffer without changing the read position
| int32 peek | ( | T * | data, |
| int32 | count | ||
| ) | const |
look at count items in buffer
look at count items in buffer without changing the read position
| [in,out] | data | : pointer to the data structure |
| [in] | count | : number of requested items |
| void flush | ( | ) |
remove all items from buffer
Remove all items from buffer.
| int32 trash | ( | int32 | count | ) |
remove count items from buffer
Remove count items from buffer.
| [in] | count | : number of items to be removed |