Cogs.Core
Public Member Functions | Public Attributes | List of all members
Cogs::ResourceAllocator Struct Reference
Inheritance diagram for Cogs::ResourceAllocator:
Cogs::Memory::Allocator

Public Member Functions

 ResourceAllocator (Allocator *baseAllocator)
 
void * allocate (size_t size, size_t alignment, MemBlockType type=MemBlockType::Block) override
 Allocate raw memory.
 
void deallocate (void *ptr, size_t size, MemBlockType type=MemBlockType::Block) override
 Deallocate the memory block at the given pointer, with the given size.
 
- Public Member Functions inherited from Cogs::Memory::Allocator
virtual void * allocate (size_t size, size_t alignment=0, MemBlockType type=MemBlockType::Block)
 Allocate raw memory.
 
virtual void deallocate (void *ptr, size_t size, MemBlockType type=MemBlockType::Block)
 Deallocate the memory block at the given pointer, with the given size.
 
virtual void changeType (void *ptr, size_t size, MemBlockType oldType, MemBlockType newType)
 
virtual size_t getAllocatedBytes () const
 Return the number of bytes currently allocated by this allocator.
 
virtual size_t getAllocationCount () const
 Return the number of allocations currently allocated by this allocator.
 

Public Attributes

Memory::AllocatorbaseAllocator
 
std::atomic< size_t > memorySize = 0
 

Additional Inherited Members

- Static Public Member Functions inherited from Cogs::Memory::Allocator
static AllocatordefaultAllocator ()
 Gets the system default allocator.
 
static AllocatoroverflowAllocator ()
 
- Protected Attributes inherited from Cogs::Memory::Allocator
Cogs::Atomic< size_t > allocated {0}
 
Cogs::Atomic< size_t > allocations {0}
 

Detailed Description

Definition at line 50 of file GraphicsDeviceD3D11.cpp.

Constructor & Destructor Documentation

◆ ResourceAllocator()

Cogs::ResourceAllocator::ResourceAllocator ( Allocator *  baseAllocator)
inline

Definition at line 51 of file GraphicsDeviceD3D11.cpp.

◆ ~ResourceAllocator()

Cogs::ResourceAllocator::~ResourceAllocator ( )
inline

Definition at line 54 of file GraphicsDeviceD3D11.cpp.

Member Function Documentation

◆ allocate()

void * Cogs::ResourceAllocator::allocate ( size_t  size,
size_t  alignment,
MemBlockType  type = MemBlockType::Block 
)
inlineoverridevirtual

Allocate raw memory.

Parameters
sizeSize in bytes of requested allocation.
alignmentAlignment in bytes.
Returns
Pointer to allocated memory.

Reimplemented from Cogs::Memory::Allocator.

Definition at line 58 of file GraphicsDeviceD3D11.cpp.

◆ deallocate()

void Cogs::ResourceAllocator::deallocate ( void *  ptr,
size_t  size,
MemBlockType  type = MemBlockType::Block 
)
inlineoverridevirtual

Deallocate the memory block at the given pointer, with the given size.

The size parameter may be given to enable extra checking when releasing memory.

Parameters
ptrPointer to previously allocated memory.
sizeSize in bytes of the given allocation.

Reimplemented from Cogs::Memory::Allocator.

Definition at line 64 of file GraphicsDeviceD3D11.cpp.

Member Data Documentation

◆ baseAllocator

Memory::Allocator* Cogs::ResourceAllocator::baseAllocator

Definition at line 69 of file GraphicsDeviceD3D11.cpp.

◆ memorySize

std::atomic<size_t> Cogs::ResourceAllocator::memorySize = 0

Definition at line 70 of file GraphicsDeviceD3D11.cpp.


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