Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
IMemoryResourceMng.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* IMemoryResourceMng.h (C) 2000-2025 */
9/* */
10/* Memory resource management for CPUs and accelerators. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCCORE_COMMON_IMEMORYRESOURCEMNG_H
13#define ARCCORE_COMMON_IMEMORYRESOURCEMNG_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arccore/common/CommonGlobal.h"
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28/*!
29 * \internal
30 * \brief Memory resource management for CPUs and accelerators.
31 */
32class ARCCORE_COMMON_EXPORT IMemoryResourceMng
33{
34 public:
35
36 virtual ~IMemoryResourceMng() = default;
37
38 public:
39
40 /*!
41 * \brief Memory allocator for resource \a r.
42 *
43 * Throws an exception if no allocator for resource \a v exists.
44 */
46
47 /*!
48 * \brief Memory allocator for resource \a r.
49 *
50 * If no allocator for resource \a v exists, throws an
51 * exception if \a throw_if_not_found is true or returns \a nullptr
52 * if \a throw_if_not_found is false.
53 */
54 virtual IMemoryAllocator* getAllocator(eMemoryResource r, bool throw_if_not_found) = 0;
55
56 /*!
57 * \brief Memory pool for resource \a r.
58 *
59 * Returns the memory pool associated with resource \a v or \a nullptr
60 * if there is none.
61 */
63
64 public:
65
66 //! Internal interface
67 virtual IMemoryResourceMngInternal* _internal() = 0;
68};
69
70/*---------------------------------------------------------------------------*/
71/*---------------------------------------------------------------------------*/
72
73} // End namespace Arcane
74
75/*---------------------------------------------------------------------------*/
76/*---------------------------------------------------------------------------*/
77
78#endif
Interface of a memory pool.
Definition IMemoryPool.h:32
virtual IMemoryAllocator * getAllocator(eMemoryResource r, bool throw_if_not_found)=0
Memory allocator for resource r.
virtual IMemoryResourceMngInternal * _internal()=0
Internal interface.
virtual IMemoryPool * getMemoryPoolOrNull(eMemoryResource r)=0
Memory pool for resource r.
virtual IMemoryAllocator * getAllocator(eMemoryResource r)=0
Memory allocator for resource r.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
eMemoryResource
List of available memory resources.