Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
roc::core::Buffer< T > Class Template Reference

Fixed-size dynamically-allocated buffer. More...

#include <buffer.h>

Inheritance diagram for roc::core::Buffer< T >:
Collaboration diagram for roc::core::Buffer< T >:

Public Member Functions

 Buffer (IPool &buffer_pool, size_t buffer_size)
 Initialize empty buffer. More...
 
size_t size () const
 Get number of elements in buffer. More...
 
T * data ()
 Get buffer data. More...
 
- Public Member Functions inherited from roc::core::RefCounted< Buffer< T >, PoolAllocation >
 RefCounted ()
 Initialize. More...
 
 RefCounted (const PoolAllocation &policy)
 Initialize. More...
 
int getref () const
 Get reference counter. More...
 
void incref () const
 Increment reference counter. More...
 
void decref () const
 Decrement reference counter. More...
 

Static Public Member Functions

static Buffercontainer_of (void *data)
 Get pointer to buffer from the pointer to its data. More...
 

Additional Inherited Members

- Protected Member Functions inherited from roc::core::PoolAllocation
IPoolpool () const
 Get pool. More...
 
 PoolAllocation (IPool &pool)
 Initialize. More...
 
template<class T >
void destroy (T &object)
 Destroy object and return memory to pool. More...
 

Detailed Description

template<class T>
class roc::core::Buffer< T >

Fixed-size dynamically-allocated buffer.

Template Parameters
Tdefines element type.
Remarks
Buffer size is fixed, but determined at runtime, not compile time. It is defined by the pool that allocates the buffer. User typically works with buffers via Slice, which holds a reference to buffer and points to a variable-size subset of its memory.
See also
BufferFactory, Slice.

Definition at line 35 of file buffer.h.

Constructor & Destructor Documentation

◆ Buffer()

template<class T >
roc::core::Buffer< T >::Buffer ( IPool buffer_pool,
size_t  buffer_size 
)
inline

Initialize empty buffer.

Definition at line 38 of file buffer.h.

Member Function Documentation

◆ container_of()

template<class T >
static Buffer* roc::core::Buffer< T >::container_of ( void *  data)
inlinestatic

Get pointer to buffer from the pointer to its data.

Definition at line 55 of file buffer.h.

◆ data()

template<class T >
T* roc::core::Buffer< T >::data ( )
inline

Get buffer data.

Definition at line 50 of file buffer.h.

◆ size()

template<class T >
size_t roc::core::Buffer< T >::size ( ) const
inline

Get number of elements in buffer.

Definition at line 45 of file buffer.h.


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