Gainput  v1.0.0
Public Member Functions | List of all members
gainput::TrackingAllocator Class Reference

An allocator that tracks an allocations that were done. More...

#include <GainputAllocator.h>

Inheritance diagram for gainput::TrackingAllocator:
gainput::Allocator

Public Member Functions

 TrackingAllocator (Allocator &backingAllocator, Allocator &internalAllocator=GetDefaultAllocator())
 
void * Allocate (size_t size, size_t align=DefaultAlign)
 Allocates a number of bytes and returns a pointer to the allocated memory. More...
 
void Deallocate (void *ptr)
 Deallocates the given memory. More...
 
size_t GetAllocateCount () const
 
size_t GetDeallocateCount () const
 
size_t GetAllocatedMemory () const
 
- Public Member Functions inherited from gainput::Allocator
template<class T >
T * New ()
 An operator new-like function that allocates memory and calls T's constructor. More...
 
template<class T , class P0 >
T * New (P0 &p0)
 An operator new-like function that allocates memory and calls T's constructor with one parameter. More...
 
template<class T , class P0 >
T * New (const P0 &p0)
 An operator new-like function that allocates memory and calls T's constructor with one parameter. More...
 
template<class T , class P0 , class P1 >
T * New (P0 &p0, P1 &p1)
 An operator new-like function that allocates memory and calls T's constructor with two parameters. More...
 
template<class T , class P0 , class P1 >
T * New (const P0 &p0, P1 &p1)
 An operator new-like function that allocates memory and calls T's constructor with two parameters. More...
 
template<class T , class P0 , class P1 >
T * New (P0 &p0, const P1 &p1)
 An operator new-like function that allocates memory and calls T's constructor with two parameters. More...
 
template<class T , class P0 , class P1 , class P2 >
T * New (P0 &p0, const P1 &p1, const P2 &p2)
 An operator new-like function that allocates memory and calls T's constructor with the given parameters. More...
 
template<class T , class P0 , class P1 , class P2 >
T * New (P0 &p0, const P1 &p1, P2 &p2)
 An operator new-like function that allocates memory and calls T's constructor with the given parameters. More...
 
template<class T , class P0 , class P1 , class P2 , class P3 >
T * New (P0 &p0, P1 &p1, P2 &p2, P3 &p3)
 An operator new-like function that allocates memory and calls T's constructor with the given parameters. More...
 
template<class T , class P0 , class P1 , class P2 , class P3 >
T * New (P0 &p0, const P1 &p1, P2 &p2, P3 &p3)
 An operator new-like function that allocates memory and calls T's constructor with the given parameters. More...
 
template<class T , class P0 , class P1 , class P2 , class P3 , class P4 >
T * New (P0 &p0, P1 &p1, P2 &p2, P3 &p3, P4 &p4)
 An operator new-like function that allocates memory and calls T's constructor with the given parameters. More...
 
template<class T , class P0 , class P1 , class P2 , class P3 , class P4 >
T * New (P0 &p0, const P1 &p1, P2 &p2, P3 &p3, P4 &p4)
 An operator new-like function that allocates memory and calls T's constructor with the given parameters. More...
 
template<class T >
void Delete (T *ptr)
 An operator delete-like function that calls ptr's constructor and deallocates the memory. More...
 

Additional Inherited Members

- Public Types inherited from gainput::Allocator
enum  { DefaultAlign = 0 }
 

Detailed Description

An allocator that tracks an allocations that were done.

Any allocation/deallocation calls are simply forwarded to malloc and free. Any requested alignment is ignored.

Examples:
/samples/gesture/gesturesample.cpp.

Member Function Documentation

◆ Allocate()

void* gainput::TrackingAllocator::Allocate ( size_t  size,
size_t  align = DefaultAlign 
)
virtual

Allocates a number of bytes and returns a pointer to the allocated memory.

Parameters
sizeThe number of bytes to allocate.
Returns
A memory block encompassing at least size bytes.

Implements gainput::Allocator.

◆ Deallocate()

void gainput::TrackingAllocator::Deallocate ( void *  ptr)
virtual

Deallocates the given memory.

Parameters
ptrThe memory block to deallocate.

Implements gainput::Allocator.


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