IceShard
1
A personal game engine project, with development focused on 2D/2.5D games.
Toggle main menu visibility
Loading...
Searching...
No Matches
memsys
public
ice
mem_allocator_proxy.hxx
Go to the documentation of this file.
1
3
4
#pragma once
5
#include <
ice/mem_allocator.hxx
>
6
7
namespace
ice
8
{
9
10
struct
ProxyAllocator
final :
public
ice::Allocator
11
{
12
inline
ProxyAllocator
(
13
ice::Allocator
&
backing_allocator
,
14
std::source_location = std::source_location::current()
15
)
noexcept
;
16
17
inline
ProxyAllocator
(
18
ice::Allocator
&
backing_allocator
,
19
std::string_view name,
20
std::source_location = std::source_location::current()
21
)
noexcept
;
22
23
inline
auto
backing_allocator
()
noexcept
->
ice::Allocator
&;
24
25
protected
:
26
inline
auto
do_allocate
(
ice::AllocRequest
request)
noexcept
->
ice::AllocResult
override
;
27
inline
void
do_deallocate
(
void
* pointer)
noexcept
override
;
28
29
private
:
30
ice::Allocator
& _backing_alloc;
31
};
32
33
inline
ProxyAllocator::ProxyAllocator
(
34
ice::Allocator
&
backing_allocator
,
35
std::source_location src_loc
36
) noexcept
37
:
ice::Allocator
{ src_loc,
backing_allocator
}
38
, _backing_alloc{ backing_allocator }
39
{
40
}
41
42
inline
ProxyAllocator::ProxyAllocator
(
43
ice::Allocator
&
backing_allocator
,
44
std::string_view name,
45
std::source_location src_loc
46
) noexcept
47
:
ice::Allocator
{ src_loc,
backing_allocator
, name }
48
, _backing_alloc{ backing_allocator }
49
{
50
}
51
52
inline
auto
ProxyAllocator::backing_allocator
() noexcept ->
ice
::
Allocator
&
53
{
54
return
_backing_alloc;
55
}
56
57
inline
auto
ProxyAllocator::do_allocate
(
ice::AllocRequest
request)
noexcept
->
ice::AllocResult
58
{
59
return
_backing_alloc.allocate(request);
60
}
61
62
inline
void
ProxyAllocator::do_deallocate
(
void
* pointer)
noexcept
63
{
64
_backing_alloc.deallocate(pointer);
65
}
66
67
}
// namespace ice
mem_allocator.hxx
ice
SPDX-License-Identifier: MIT.
Definition
array.hxx:12
ice::Allocator
ice::AllocatorBase< ice::build::is_debug||ice::build::is_develop > Allocator
Definition
mem_types.hxx:25
ice::AllocRequest
Definition
mem.hxx:16
ice::AllocResult
Definition
mem.hxx:44
ice::ProxyAllocator::do_allocate
auto do_allocate(ice::AllocRequest request) noexcept -> ice::AllocResult override
Definition
mem_allocator_proxy.hxx:57
ice::ProxyAllocator::do_deallocate
void do_deallocate(void *pointer) noexcept override
Definition
mem_allocator_proxy.hxx:62
ice::ProxyAllocator::ProxyAllocator
ProxyAllocator(ice::Allocator &backing_allocator, std::source_location=std::source_location::current()) noexcept
Definition
mem_allocator_proxy.hxx:33
ice::ProxyAllocator::backing_allocator
auto backing_allocator() noexcept -> ice::Allocator &
Definition
mem_allocator_proxy.hxx:52
Generated by
1.18.0