Sese Framework  2.3.0
A cross-platform framework
Loading...
Searching...
No Matches
sese::ObjectPool< T > Class Template Reference

Object pool. More...

#include <ObjectPool.h>

Inheritance diagram for sese::ObjectPool< T >:
sese::Noncopyable

Public Types

using Ptr = std::shared_ptr<ObjectPool<T>>
 
using ObjectPtr = std::shared_ptr<T>
 

Public Member Functions

 ~ObjectPool () override
 
auto borrow () noexcept
 
- Public Member Functions inherited from sese::Noncopyable
 Noncopyable ()=default
 
virtual ~Noncopyable ()=default
 
 Noncopyable (const Noncopyable &)=delete
 
Noncopyableoperator= (const Noncopyable &)=delete
 

Static Public Member Functions

static ObjectPool::Ptr create () noexcept
 

Private Member Functions

 ObjectPool ()=default
 

Static Private Member Functions

static void recycleCallback (const std::weak_ptr< ObjectPool > &wk_pool, T *to_recycle) noexcept
 

Private Attributes

std::mutex mutex
 
std::queue< T * > queue
 

Detailed Description

template<typename T>
class sese::ObjectPool< T >

Object pool.

Template Parameters
TReusable object type

Member Typedef Documentation

◆ ObjectPtr

template<typename T >
using sese::ObjectPool< T >::ObjectPtr = std::shared_ptr<T>

◆ Ptr

template<typename T >
using sese::ObjectPool< T >::Ptr = std::shared_ptr<ObjectPool<T>>

Constructor & Destructor Documentation

◆ ~ObjectPool()

template<typename T >
sese::ObjectPool< T >::~ObjectPool ( )
inlineoverride

◆ ObjectPool()

template<typename T >
sese::ObjectPool< T >::ObjectPool ( )
privatedefault

Member Function Documentation

◆ borrow()

template<typename T >
auto sese::ObjectPool< T >::borrow ( )
inlinenoexcept

◆ create()

template<typename T >
static ObjectPool::Ptr sese::ObjectPool< T >::create ( )
inlinestaticnoexcept

◆ recycleCallback()

template<typename T >
static void sese::ObjectPool< T >::recycleCallback ( const std::weak_ptr< ObjectPool< T > > & wk_pool,
T * to_recycle )
inlinestaticprivatenoexcept

Member Data Documentation

◆ mutex

template<typename T >
std::mutex sese::ObjectPool< T >::mutex
private

◆ queue

template<typename T >
std::queue<T *> sese::ObjectPool< T >::queue
private

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