ObjectPool Class. Specific situation(Fixed size of block) of MemoryPool. More...
#include <ObjectPool.h>
Public Member Functions | |
| ObjectPool (ObjectPoolSizeMode mode=ObjectPoolSizeMode::FixedSize, size_t size=DefaultExpandKBytes) | |
| Constructor Function. | |
| virtual | ~ObjectPool () |
| Destructor Function. | |
| ObjectPool (const ObjectPool &)=delete | |
| Copy Constructor Function. | |
| ObjectPool & | operator= (const ObjectPool &)=delete |
| Copy Assignment Operation. | |
| T * | New () |
| Alloc a memory block to store T. | |
| void | Delete (T *obj) |
| Free a obj of T. | |
| void * | GetPointer () const |
| Get objectPool current memory pointer. | |
| size_t | GetNMemoryBlocks () const |
| Get number of memory blocks allocated to this objectPool. | |
| void * | GetFreeList () const |
| Get FreeList. | |
| size_t | GetSpareBytes () const |
| Get SpareBytes. | |
| T * | ThreadNew () |
| Thread Safe Version of New. | |
| void | ThreadDelete (T *obj) |
| Thread Safe Version of Delete. | |
Static Public Attributes | |
| static constexpr size_t | DefaultExpandKBytes = 128 |
| use 128KB as default expand bytes. | |
Private Attributes | |
| char * | m_pointer |
| objectPool current memory pointer. | |
| scl::vector< void * > | m_Memories |
| This objectPoll allocated memories. | |
| void * | m_FreeList |
| freelist. | |
| size_t | m_SpareBytes |
| Spare bytes of this objectPool. | |
| std::mutex | m_Mutex |
| Mutex for thread safety. | |
| size_t | m_ExpandBytes |
| Expand bytes. | |
ObjectPool Class. Specific situation(Fixed size of block) of MemoryPool.
| T | Specific Object Type. |
Definition at line 30 of file ObjectPool.h.