Arcane  v3.16.0.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
BasicSerializerInternal.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2025 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/* BasicSerializerInternal.h (C) 2000-2025 */
9/* */
10/* Partie interne de 'BasicSerializer'. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCCORE_SERIALIZE_BASICSERIALIZERINTERNAL_H
13#define ARCCORE_SERIALIZE_BASICSERIALIZERINTERNAL_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arccore/serialize/BasicSerializer.h"
19
20/*---------------------------------------------------------------------------*/
21/*---------------------------------------------------------------------------*/
22
23namespace Arcane
24{
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
29class ARCCORE_SERIALIZE_EXPORT BasicSerializer::Impl
30{
31 public:
32
33 virtual ~Impl() {}
34
35 public:
36
37 virtual Span<Real> getRealBuffer() = 0;
38 virtual Span<Int16> getInt16Buffer() = 0;
39 virtual Span<Int32> getInt32Buffer() = 0;
40 virtual Span<Int64> getInt64Buffer() = 0;
41 virtual Span<Byte> getByteBuffer() = 0;
42 virtual Span<Int8> getInt8Buffer() = 0;
43 virtual Span<Float16> getFloat16Buffer() = 0;
44 virtual Span<BFloat16> getBFloat16Buffer() = 0;
45 virtual Span<Float32> getFloat32Buffer() = 0;
46 virtual Span<Float128> getFloat128Buffer() = 0;
47 virtual Span<Int128> getInt128Buffer() = 0;
48
49 virtual void allocateBuffer(Int64 nb_real, Int64 nb_int16, Int64 nb_int32,
50 Int64 nb_int64, Int64 nb_byte, Int64 nb_int8, Int64 nb_float16,
51 Int64 nb_bfloat16, Int64 nb_float32, Int64 nb_float128, Int64 nb_int128) = 0;
52 virtual void copy(Impl* rhs) = 0;
53 virtual Span<Byte> globalBuffer() = 0;
54 virtual Span<const Byte> globalBuffer() const = 0;
55 virtual ConstArrayView<Int64> sizesBuffer() const = 0;
56 virtual ConstArrayView<Byte> copyAndGetSizesBuffer() = 0;
57 virtual void preallocate(Int64 size) = 0;
58 virtual void releaseBuffer() = 0;
59 virtual void setFromSizes() = 0;
60 virtual Int64 totalSize() const = 0;
61 virtual void printSizes(std::ostream& o) const = 0;
62
63 public:
64
65 ARCCORE_DEPRECATED_REASON("Y2023: use overload with float16/float32")
66 virtual void allocateBuffer(Int64 nb_real, Int64 nb_int16, Int64 nb_int32,
67 Int64 nb_int64, Int64 nb_byte) = 0;
68};
69
70/*---------------------------------------------------------------------------*/
71/*---------------------------------------------------------------------------*/
72
73class ARCCORE_SERIALIZE_EXPORT BasicSerializer::Impl2
74{
75 public:
76
77 Impl2();
78 ~Impl2();
79
80 public:
81
82 Span<const Real> realBytes() const { return m_real.m_buffer; }
83 Span<const Int64> int64Bytes() const { return m_int64.m_buffer; }
84 Span<const Int32> int32Bytes() const { return m_int32.m_buffer; }
85 Span<const Int16> int16Bytes() const { return m_int16.m_buffer; }
86 Span<const Byte> byteBytes() const { return m_byte.m_buffer; }
87 Span<const Int8> int8Bytes() const { return m_int8.m_buffer; }
88 Span<const Float16> float16Bytes() const { return m_float16.m_buffer; }
89 Span<const BFloat16> bfloat16Bytes() const { return m_bfloat16.m_buffer; }
90 Span<const Float32> float32Bytes() const { return m_float32.m_buffer; }
91 Span<const Float128> float128Bytes() const { return m_float128.m_buffer; }
92 Span<const Int128> int128Bytes() const { return m_int128.m_buffer; }
93
94 public:
95
96 ARCCORE_DEPRECATED_REASON("Y2024: Use reserve(eBasicDataType) instead")
97 void reserve(eDataType dt, Int64 n, Int64 nb_put);
98 void reserve(eBasicDataType dt, Int64 n, Int64 nb_put);
99 void putType(eBasicDataType t);
100 void getAndCheckType(eBasicDataType expected_type);
101 void allocateBuffer();
102 void allocateBuffer(Int64 nb_real, Int64 nb_int16, Int64 nb_int32,
103 Int64 nb_int64, Int64 nb_byte, Int64 nb_int8, Int64 nb_float16,
104 Int64 nb_bfloat16, Int64 nb_float32, Int64 nb_float128, Int64 nb_int128);
105 void copy(const BasicSerializer& rhs);
106 void setMode(eMode new_mode);
107 void setFromSizes();
108
109 public:
110
111 ARCCORE_DEPRECATED_REASON("Y2023: use overload with float16/float32")
112 void allocateBuffer(Int64 nb_real, Int64 nb_int16, Int64 nb_int32,
113 Int64 nb_int64, Int64 nb_byte);
114
115 public:
116
117 void setSerializeTypeInfo(bool v) { m_is_serialize_typeinfo = v; }
118 bool isSerializeTypeInfo() const { return m_is_serialize_typeinfo; }
119
120 public:
121
122 eMode m_mode;
123 eReadMode m_read_mode;
125 bool m_is_serialize_typeinfo = false;
137
138 private:
139
140 void _setViews();
141};
142
143/*---------------------------------------------------------------------------*/
144/*---------------------------------------------------------------------------*/
145
146} // End namespace Arccore
147
148/*---------------------------------------------------------------------------*/
149/*---------------------------------------------------------------------------*/
150
151#endif
Fichier contenant les définitions des types de données basiques gérés par Arccore.
Tampon pour sérialiser un type de donnée DataType.
Vue constante d'un tableau de type T.
eMode
Mode de fonctionnement du sérialiseur.
Vue d'un tableau d'éléments de type T.
Definition Span.h:513
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
std::int64_t Int64
Type entier signé sur 64 bits.
eBasicDataType
Type d'une donnée de base.