Murl Engine API  Version 2024.1
Murl::Pool< DataType > Class Template Reference

A pool template class. More...

#include <murl_pool.h>

Detailed Description

template<class DataType>
class Murl::Pool< DataType >

A pool template class.

Public Types

using ValueType = DataType
 The template parameter value type.
 

Public Member Functions

 ~Pool ()
 The destructor.
 
DataType * Acquire ()
 Acquire an item. More...
 
void Release (DataType *item)
 Release an acquired item. More...
 
void Release (const Array< DataType * > &items)
 Release an array of acquired items. More...
 

Protected Attributes

Array< DataType * > mFreeItems
 The pool array.
 
UInt32 mTotalNumberOfItems
 The number of created items.
 

Member Function Documentation

◆ Acquire()

template<class DataType >
DataType* Murl::Pool< DataType >::Acquire ( )
inline

Acquire an item.

Get an item from the pool or allocate a new one.

Returns
The item.

◆ Release() [1/2]

template<class DataType >
void Murl::Pool< DataType >::Release ( DataType *  item)
inline

Release an acquired item.

Put the item to the pool.

Parameters
itemThe acquired item to put into the pool.

◆ Release() [2/2]

template<class DataType >
void Murl::Pool< DataType >::Release ( const Array< DataType * > &  items)
inline

Release an array of acquired items.

Put the items to the pool.

Parameters
itemsThe acquired items to put into the pool.

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