VST 3 SDK  VST 3.7
SDK for developing VST plug-in
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Groups Pages
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 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 ( size_t  initialNumberOfItems = 0)
inlinenoexcept

Default constructor.

Parameters
initialNumberOfItemsinitial ring buffer size

Member Function Documentation

size_t size ( ) const
inlinenoexcept

size

Returns
number of elements the buffer can hold
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
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
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
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 ©2022 Steinberg Media Technologies GmbH. All Rights Reserved. This documentation is under this license.