Backbone - Singer Tone
 
Loading...
Searching...
No Matches
Backbone::CircularBuffer< T > Class Reference

Generic fixed-size circular buffer with contiguous read and write helpers. More...

Inheritance diagram for Backbone::CircularBuffer< T >:

Public Member Functions

 CircularBuffer ()
 Initializes a new empty CircularBuffer<T> with size 0. Call SetSize(int) before using it.
 
 CircularBuffer (int bufCount)
 Initializes a new CircularBuffer<T> with the given capacity.
 
void Dispose ()
 Releases the buffer by setting its size to 0.
 
void Reset ()
 Resets read/write cursors to the beginning without changing capacity.
 
void SetSize (int newSize)
 Sets the buffer capacity. Resets indices and discards previous data.
 
void Clear ()
 Fills the underlying array with default(T ) values.
 

Private Attributes

int m_bufSize
 
int m_begBufOffset
 
int m_availBuf
 
long m_startPos
 
T[] m_buffer
 

Detailed Description

Generic fixed-size circular buffer with contiguous read and write helpers.

Template Parameters
TElement type stored in the buffer.

Constructor & Destructor Documentation

◆ CircularBuffer() [1/2]

Backbone::CircularBuffer< T >::CircularBuffer ( )

Initializes a new empty CircularBuffer<T> with size 0. Call SetSize(int) before using it.

◆ CircularBuffer() [2/2]

Backbone::CircularBuffer< T >::CircularBuffer ( int bufCount)

Initializes a new CircularBuffer<T> with the given capacity.

Parameters
bufCountNumber of elements in the buffer capacity. Must be >= 0.

Member Function Documentation

◆ Clear()

void Backbone::CircularBuffer< T >::Clear ( )

Fills the underlying array with default(T ) values.

Safe to call when size is 0; it is a no-op.

◆ Dispose()

void Backbone::CircularBuffer< T >::Dispose ( )

Releases the buffer by setting its size to 0.

◆ Reset()

void Backbone::CircularBuffer< T >::Reset ( )

Resets read/write cursors to the beginning without changing capacity.

This does not clear data; it only resets indices and counters.

◆ SetSize()

void Backbone::CircularBuffer< T >::SetSize ( int newSize)

Sets the buffer capacity. Resets indices and discards previous data.

Parameters
newSizeNew capacity in elements. Use 0 to release memory.

Member Data Documentation

◆ m_availBuf

int Backbone::CircularBuffer< T >::m_availBuf
private

◆ m_begBufOffset

int Backbone::CircularBuffer< T >::m_begBufOffset
private

◆ m_buffer

T [] Backbone::CircularBuffer< T >::m_buffer
private

◆ m_bufSize

int Backbone::CircularBuffer< T >::m_bufSize
private

◆ m_startPos

long Backbone::CircularBuffer< T >::m_startPos
private

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