Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
roc::core::IPool Class Referenceabstract

Memory pool interface. More...

#include <ipool.h>

Inheritance diagram for roc::core::IPool:

Public Member Functions

virtual size_t object_size () const =0
 Get size of object allocated by pool. More...
 
virtual ROC_ATTR_NODISCARD bool reserve (size_t n_objects)=0
 Reserve memory for given number of objects. More...
 
virtual void * allocate ()=0
 Allocate memory for an object. More...
 
virtual void deallocate (void *memory)=0
 Return memory to pool. More...
 
template<class T >
void destroy_object (T &object)
 Destroy object and deallocate its memory. More...
 

Detailed Description

Memory pool interface.

Definition at line 23 of file ipool.h.

Member Function Documentation

◆ allocate()

virtual void* roc::core::IPool::allocate ( )
pure virtual

Allocate memory for an object.

Returns
pointer to a maximum aligned uninitialized memory for a new object or NULL if memory can't be allocated.

Implemented in roc::core::SlabPool< T, EmbeddedCapacity >, roc::core::SlabPool< roc::core::Buffer< T > >, roc::core::SlabPool< roc::packet::Packet >, roc::core::SlabPool< Slot >, and roc::core::SlabPool< Node, PreallocatedNodes >.

◆ deallocate()

◆ destroy_object()

template<class T >
void roc::core::IPool::destroy_object ( T &  object)
inline

Destroy object and deallocate its memory.

Definition at line 45 of file ipool.h.

◆ object_size()

virtual size_t roc::core::IPool::object_size ( ) const
pure virtual

◆ reserve()

virtual ROC_ATTR_NODISCARD bool roc::core::IPool::reserve ( size_t  n_objects)
pure virtual

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