OpenBarnyard
 
Loading...
Searching...
No Matches
T2Allocator Class Referenceabstract

#include <T2Allocator.h>

Inheritance diagram for T2Allocator:
T2GenericObjectPool T2GlobalAllocator T2DerivedDynamicObjectPool< TClassType > T2DynamicObjectPool< T > T2ObjectPool< T, MaxNumber, ObjectSize, Alignment >

Public Member Functions

virtual void * Malloc (size_t size, size_t alignment)=0
 
virtual void * Malloc (size_t size)=0
 
virtual void Free (void *ptr)=0
 
virtual TBOOL CanAllocate (size_t size) const =0
 
virtual void * TryMalloc (size_t size, size_t alignment)=0
 
virtual void * TryMalloc (size_t size)=0
 
virtual size_t GetUsedSize () const =0
 
virtual size_t GetCapacity () const =0
 
template<class T, class... Args>
T * New (Args &&... args)
 
template<class T>
void Delete (T *ptr)
 

Detailed Description

Definition at line 6 of file T2Allocator.h.

Member Function Documentation

◆ CanAllocate()

virtual TBOOL T2Allocator::CanAllocate ( size_t size) const
pure virtual

Implemented in T2GenericObjectPool, and T2GlobalAllocator.

◆ Delete()

template<class T>
void T2Allocator::Delete ( T * ptr)
inline

Definition at line 27 of file T2Allocator.h.

28 {
29 ptr->~T();
30 Free( ptr );
31 }
virtual void Free(void *ptr)=0

◆ Free()

virtual void T2Allocator::Free ( void * ptr)
pure virtual

Implemented in T2GenericObjectPool, and T2GlobalAllocator.

◆ GetCapacity()

virtual size_t T2Allocator::GetCapacity ( ) const
pure virtual

◆ GetUsedSize()

virtual size_t T2Allocator::GetUsedSize ( ) const
pure virtual

◆ Malloc() [1/2]

virtual void * T2Allocator::Malloc ( size_t size)
pure virtual

Implemented in T2GenericObjectPool, and T2GlobalAllocator.

◆ Malloc() [2/2]

virtual void * T2Allocator::Malloc ( size_t size,
size_t alignment )
pure virtual

Implemented in T2GenericObjectPool, and T2GlobalAllocator.

◆ New()

template<class T, class... Args>
T * T2Allocator::New ( Args &&... args)
inline

Definition at line 19 of file T2Allocator.h.

20 {
21 void* mem = Malloc( sizeof( T ) );
22 T* object = new ( mem ) T( std::forward<Args>( args )... );
23 return object;
24 }
virtual void * Malloc(size_t size, size_t alignment)=0

◆ TryMalloc() [1/2]

virtual void * T2Allocator::TryMalloc ( size_t size)
pure virtual

Implemented in T2GenericObjectPool, and T2GlobalAllocator.

◆ TryMalloc() [2/2]

virtual void * T2Allocator::TryMalloc ( size_t size,
size_t alignment )
pure virtual

Implemented in T2GenericObjectPool, and T2GlobalAllocator.


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