Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
roc::core::Buffer Class Reference

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

#include <buffer.h>

Inheritance diagram for roc::core::Buffer:
Collaboration diagram for roc::core::Buffer:

Public Member Functions

 Buffer (IPool &buffer_pool, size_t buffer_size)
 Initialize empty buffer. More...
 
size_t size () const
 Get buffer size in bytes. More...
 
uint8_t * data ()
 Get buffer data. More...
 
- Public Member Functions inherited from roc::core::RefCounted< Buffer, 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

Fixed-size dynamically-allocated byte buffer.

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 shared pointer to buffer and points to a variable-size subset of its memory.
See also
BufferFactory, Slice.

Definition at line 40 of file buffer.h.

Constructor & Destructor Documentation

◆ Buffer()

roc::core::Buffer::Buffer ( IPool buffer_pool,
size_t  buffer_size 
)

Initialize empty buffer.

Member Function Documentation

◆ container_of()

static Buffer* roc::core::Buffer::container_of ( void *  data)
inlinestatic

Get pointer to buffer from the pointer to its data.

Definition at line 56 of file buffer.h.

◆ data()

uint8_t* roc::core::Buffer::data ( )
inline

Get buffer data.

Definition at line 51 of file buffer.h.

◆ size()

size_t roc::core::Buffer::size ( ) const
inline

Get buffer size in bytes.

Definition at line 46 of file buffer.h.


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