mxnet
Classes | Public Member Functions | Static Public Member Functions | List of all members
mxnet::common::ObjectPool< T > Class Template Reference

Object pool for fast allocation and deallocation. More...

#include <object_pool.h>

Collaboration diagram for mxnet::common::ObjectPool< T >:
Collaboration graph

Public Member Functions

 ~ObjectPool ()
 Destructor. More...
 
template<typename... Args>
T * New (Args &&...args)
 Create new object. More...
 
void Delete (T *ptr)
 Delete an existing object. More...
 

Static Public Member Functions

static ObjectPoolGet ()
 Get singleton instance of pool. More...
 
static std::shared_ptr< ObjectPool_GetSharedRef ()
 Get a shared ptr of the singleton instance of pool. More...
 

Detailed Description

template<typename T>
class mxnet::common::ObjectPool< T >

Object pool for fast allocation and deallocation.

Constructor & Destructor Documentation

template<typename T >
mxnet::common::ObjectPool< T >::~ObjectPool ( )

Destructor.

Member Function Documentation

template<typename T >
std::shared_ptr< ObjectPool< T > > mxnet::common::ObjectPool< T >::_GetSharedRef ( )
static

Get a shared ptr of the singleton instance of pool.

Returns
Shared pointer to the Object Pool.
template<typename T >
void mxnet::common::ObjectPool< T >::Delete ( T *  ptr)

Delete an existing object.

Parameters
ptrThe pointer to delete.

Make sure the pointer to delete is allocated from this pool.

template<typename T >
ObjectPool< T > * mxnet::common::ObjectPool< T >::Get ( )
static

Get singleton instance of pool.

Returns
Object Pool.
template<typename T >
template<typename... Args>
T * mxnet::common::ObjectPool< T >::New ( Args &&...  args)

Create new object.

Returns
Pointer to the new object.

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