Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
MemoryBuffer.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2023 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/* MemoryBuffer.h (C) 2000-2023 */
9/* */
10/* Buffer mémoire. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13#ifndef ARCANE_IMPL_MEMORYBUFFER_H
14#define ARCANE_IMPL_MEMORYBUFFER_H
15/*---------------------------------------------------------------------------*/
16/*---------------------------------------------------------------------------*/
17
18#include "arcane/utils/Array.h"
19#include "arcane/utils/Ref.h"
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23namespace Arcane
24{
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
32class ARCANE_UTILS_EXPORT MemoryBuffer
33{
34 private:
35
36 explicit MemoryBuffer(IMemoryAllocator* allocator)
37 : m_buffer(allocator)
38 {}
39
40 public:
41
49 {
50 auto* memory = new MemoryBuffer(allocator);
52 return ref_memory;
53 }
54
55 public:
56
63 void resize(Int64 new_size) { m_buffer.resize(new_size); }
64 Span<const std::byte> bytes() const { return m_buffer; }
65 Span<std::byte> bytes() { return m_buffer; }
66 IMemoryAllocator* allocator() const { return m_buffer.allocator(); }
67
68 private:
69
72};
73
74/*---------------------------------------------------------------------------*/
75/*---------------------------------------------------------------------------*/
76
77} // namespace Arcane
78
79/*---------------------------------------------------------------------------*/
80/*---------------------------------------------------------------------------*/
81
82#endif
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
Gestion d'un buffer mémoire.
void resize(Int64 new_size)
Redimensionne la zone mémoire.
UniqueArray< std::byte > m_buffer
Buffer contenant les données.
static Ref< MemoryBuffer > create(IMemoryAllocator *allocator)
Créé une instance de MemoryBuffer.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-