Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
ObjectPool< T, EnableDebug > Class Template Reference

Thread-safe, realtime-safe object pool. More...

#include <src/utils/object_pool.h>

Public Member Functions

 ObjectPool (size_t initial_capacity=64)
 
T * acquire ()
 
void release (T *object)
 
void reserve (size_t size)
 
auto get_num_in_use () const
 
auto get_capacity () const
 
auto get_size () const
 

Detailed Description

template<typename T, bool EnableDebug = false>
class ObjectPool< T, EnableDebug >

Thread-safe, realtime-safe object pool.

Template Parameters
TThe type of objects to be pooled. Must be default-constructible.

Definition at line 17 of file object_pool.h.

Constructor & Destructor Documentation

◆ ObjectPool()

template<typename T, bool EnableDebug = false>
ObjectPool< T, EnableDebug >::ObjectPool ( size_t initial_capacity = 64)
inline

Definition at line 24 of file object_pool.h.

Member Function Documentation

◆ acquire()

template<typename T, bool EnableDebug = false>
T * ObjectPool< T, EnableDebug >::acquire ( )
inline

Definition at line 26 of file object_pool.h.

◆ get_capacity()

template<typename T, bool EnableDebug = false>
auto ObjectPool< T, EnableDebug >::get_capacity ( ) const
inline

Definition at line 65 of file object_pool.h.

◆ get_num_in_use()

template<typename T, bool EnableDebug = false>
auto ObjectPool< T, EnableDebug >::get_num_in_use ( ) const
inline

Definition at line 64 of file object_pool.h.

◆ get_size()

template<typename T, bool EnableDebug = false>
auto ObjectPool< T, EnableDebug >::get_size ( ) const
inline

Definition at line 66 of file object_pool.h.

◆ release()

template<typename T, bool EnableDebug = false>
void ObjectPool< T, EnableDebug >::release ( T * object)
inline

Definition at line 46 of file object_pool.h.

◆ reserve()

template<typename T, bool EnableDebug = false>
void ObjectPool< T, EnableDebug >::reserve ( size_t size)
inline

Definition at line 55 of file object_pool.h.


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