VST 3 SDK VST 3.7
SDK for developing VST plug-in
Loading...
Searching...
No Matches
RingBuffer< ItemT > Class Template Reference

Ringbuffer. More...

#include <ringbuffer.h>

Public Member Functions

 RingBuffer (size_t initialNumberOfItems=0) noexcept
 Default constructor.
 
size_t size () const noexcept
 size
 
void resize (size_t newNumberOfItems) noexcept
 resize
 
bool push (ItemT &&item) noexcept
 push a new item into the ringbuffer
 
bool push (const ItemT &item) noexcept
 push a new item into the ringbuffer
 
bool push (const std::initializer_list< ItemT > &items) noexcept
 push multiple items at once into the ringbuffer
 
bool pop (ItemT &item) noexcept
 pop an item out of the ringbuffer
 

Detailed Description

template<typename ItemT>
class Steinberg::OneReaderOneWriter::RingBuffer< ItemT >

Ringbuffer.

A ringbuffer supporting one reader and one writer thread

Constructor & Destructor Documentation

◆ RingBuffer()

template<typename ItemT>
RingBuffer ( size_t initialNumberOfItems = 0)
inlinenoexcept

Default constructor.

Parameters
initialNumberOfItemsinitial ring buffer size

Member Function Documentation

◆ size()

template<typename ItemT>
size_t size ( ) const
inlinenoexcept

size

Returns
number of elements the buffer can hold

◆ resize()

template<typename ItemT>
void resize ( size_t newNumberOfItems)
inlinenoexcept

resize

note that you have to make sure that no other thread is reading or writing while calling this method

Parameters
newNumberOfItemsresize buffer

◆ push() [1/3]

template<typename ItemT>
bool push ( ItemT && item)
inlinenoexcept

push a new item into the ringbuffer

Parameters
itemto push
Returns
true on success or false if buffer is full

◆ push() [2/3]

template<typename ItemT>
bool push ( const ItemT & item)
inlinenoexcept

push a new item into the ringbuffer

Parameters
itemto push
Returns
true on success or false if buffer is full

◆ push() [3/3]

template<typename ItemT>
bool push ( const std::initializer_list< ItemT > & items)
inlinenoexcept

push multiple items at once into the ringbuffer

if there are insufficient free slots in the ring buffer, no item will be pushed. furthermore, it is guaranteed that the newly added items can only be popped from the buffer after all items have been added.

Parameters
itemslist of items to push
Returns
true on success or false if there's not enough free space in the buffer

◆ pop()

template<typename ItemT>
bool pop ( ItemT & item)
inlinenoexcept

pop an item out of the ringbuffer

Parameters
item
Returns
true on success or false if buffer is empty
Empty

Copyright © Steinberg Media Technologies GmbH. All Rights Reserved. This documentation is under this license.