SafetyHook
Loading...
Searching...
No Matches
safetyhook::Allocation Class Referencefinal

A memory allocation. More...

#include <allocator.hpp>

Public Member Functions

 Allocation (const Allocation &)=delete
 
 Allocation (Allocation &&other) noexcept
 
Allocationoperator= (const Allocation &)=delete
 
Allocationoperator= (Allocation &&other) noexcept
 
void free ()
 Frees the allocation.
 
uint8_t * data () const noexcept
 Returns a pointer to the data of the allocation.
 
uintptr_t address () const noexcept
 Returns the address of the allocation.
 
size_t size () const noexcept
 Returns the size of the allocation.
 
 operator bool () const noexcept
 Tests if the allocation is valid.
 

Protected Member Functions

 Allocation (std::shared_ptr< Allocator > allocator, uint8_t *address, size_t size) noexcept
 

Protected Attributes

friend Allocator
 

Detailed Description

A memory allocation.

Member Function Documentation

◆ address()

uintptr_t safetyhook::Allocation::address ( ) const
inlinenodiscardnoexcept

Returns the address of the allocation.

Returns
The address of the allocation.

◆ data()

uint8_t * safetyhook::Allocation::data ( ) const
inlinenodiscardnoexcept

Returns a pointer to the data of the allocation.

Returns
Pointer to the data of the allocation.

◆ free()

void safetyhook::Allocation::free ( )

Frees the allocation.

Note
This is called automatically when the Allocation object is destroyed.

◆ operator bool()

safetyhook::Allocation::operator bool ( ) const
inlineexplicitnoexcept

Tests if the allocation is valid.

Returns
True if the allocation is valid, false otherwise.

◆ size()

size_t safetyhook::Allocation::size ( ) const
inlinenodiscardnoexcept

Returns the size of the allocation.

Returns
The size of the allocation.

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