API Documentation
PtrPool.h
1 // Pool.h
3 //
5 
6 namespace nkMemory
7 {
13  template <typename T>
14  class PtrPool final
15  {
16  public :
17 
24  PtrPool (UniquePtr<Allocator<T>> allocator = makeUnique<DefaultAllocator<T>>(), UniquePtr<Deallocator<T>> deallocator = makeUnique<DefaultDeallocator<T>>()) noexcept ;
28  PtrPool (const PtrPool&) noexcept = delete ;
32  PtrPool (PtrPool&&) noexcept = default ;
36  ~PtrPool () ;
37 
41  unsigned long long getPoolSize () const ;
45  unsigned long long getFreeItemsCount () const ;
49  unsigned long long getFlyingItemsCount () const ;
50 
56  T* getObject () ;
62  void releaseObject (T* object) ;
63 
64  public :
65 
66  // Operators
70  PtrPool& operator= (const PtrPool&) noexcept = delete ;
74  PtrPool& operator= (PtrPool&&) noexcept = default ;
75  } ;
76 }
nkMemory::PtrPool::PtrPool
PtrPool(UniquePtr< Allocator< T >> allocator=makeUnique< DefaultAllocator< T >>(), UniquePtr< Deallocator< T >> deallocator=makeUnique< DefaultDeallocator< T >>()) noexcept
nkMemory::PtrPool::getPoolSize
unsigned long long getPoolSize() const
nkMemory::PtrPool::getFreeItemsCount
unsigned long long getFreeItemsCount() const
nkMemory::PtrPool::getFlyingItemsCount
unsigned long long getFlyingItemsCount() const
nkMemory::PtrPool::getObject
T * getObject()
nkMemory::Allocator
Interface representing an allocator, supposed to allocate an object when requested.
Definition: Allocator.h:15
nkMemory::DefaultDeallocator
A utility default deallocator using a simple call to delete.
Definition: DefaultDeallocator.h:13
nkMemory::DefaultAllocator
A utility default allocator allocating an object through a simple call to new.
Definition: DefaultAllocator.h:13
nkMemory::UniquePtr
Smart pointer owning the object instance it encapsulates.
Definition: UniquePtr.h:17
nkMemory::Deallocator
Interface used for deallocating memory.
Definition: Deallocator.h:13
nkMemory::PtrPool::releaseObject
void releaseObject(T *object)
nkMemory::PtrPool
A pool of objects, allocated in the heap and tracked by their pointers.
Definition: PtrPool.h:15
nkMemory
Encompasses all API of component NilkinsMemory.
Definition: Allocator.h:7