vecmem 1.14.0
Loading...
Searching...
No Matches
identity_memory_resource.hpp
1/*
2 * VecMem project, part of the ACTS project (R&D line)
3 *
4 * (c) 2021-2023 CERN for the benefit of the ACTS project
5 *
6 * Mozilla Public License Version 2.0
7 */
8
9// Local include(s).
10#include "vecmem/memory/details/memory_resource_base.hpp"
11#include "vecmem/memory/memory_resource.hpp"
12#include "vecmem/vecmem_core_export.hpp"
13
14// System include(s).
15#include <cstddef>
16
17namespace vecmem {
18
27
28public:
35 identity_memory_resource(memory_resource& upstream);
39
40private:
43
46 virtual void* do_allocate(std::size_t, std::size_t) override final;
49 virtual void do_deallocate(void* p, std::size_t,
50 std::size_t) override final;
53 virtual bool do_is_equal(
54 const memory_resource&) const noexcept override final;
55
57
59 memory_resource& m_upstream;
60
61}; // class identity_memory_resource
62
63} // namespace vecmem
Base class for implementations of the vecmem::memory_resource interface.
Definition memory_resource_base.hpp:25
This memory resource forwards allocation and deallocation requests to the upstream resource.
Definition identity_memory_resource.hpp:26
virtual VECMEM_CORE_EXPORT void do_deallocate(void *p, std::size_t, std::size_t) override final
De-allocate a previously allocated memory block.
Definition identity_memory_resource.cpp:28
virtual VECMEM_CORE_EXPORT void * do_allocate(std::size_t, std::size_t) override final
Allocate memory with the upstream resource.
Definition identity_memory_resource.cpp:19
VECMEM_CORE_EXPORT ~identity_memory_resource()
Destructor.
virtual VECMEM_CORE_EXPORT bool do_is_equal(const memory_resource &) const noexcept override final
Compare the equality of *this memory resource with another.
Definition identity_memory_resource.cpp:37
Main namespace for the vecmem classes/functions.
Definition atomic_ref.hpp:16
std::vector< T, vecmem::polymorphic_allocator< T > > vector
Alias type for vectors with our polymorphic allocator.
Definition vector.hpp:35