Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
ISerializedData.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/* ISerializedData.h (C) 2000-2025 */
9/* */
10/* Interface of a serialized data. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_ISERIALIZEDDATA_H
13#define ARCANE_CORE_ISERIALIZEDDATA_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
62class ARCANE_CORE_EXPORT ISerializedData
63{
65
66 public:
67
69 virtual ~ISerializedData() = default;
70
71 public:
72
74 virtual eDataType baseDataType() const = 0;
75
77 virtual Integer nbDimension() const = 0;
78
80 virtual Int64 nbElement() const = 0;
81
83 virtual Int64 nbBaseElement() const = 0;
84
86 virtual bool isMultiSize() const = 0;
87
89 virtual Int64 memorySize() const = 0;
90
92 virtual Int64ConstArrayView extents() const = 0;
93
95 virtual ArrayShape shape() const = 0;
96
98 virtual Span<const Byte> constBytes() const = 0;
99
107
114
121
128 virtual void allocateMemory(Int64 size) = 0;
129
130 public:
131
135 virtual void serialize(ISerializer* buffer) = 0;
136
140 virtual void serialize(ISerializer* buffer) const = 0;
141
142 public:
143
150 virtual void computeHash(IHashAlgorithm* algo, ByteArray& output) const = 0;
151
152 public:
153
158 ARCANE_DEPRECATED_2018_R("Use method 'writableBytes()' or 'constBytes()' instead")
159 virtual ByteConstArrayView buffer() const = 0;
160
165 ARCANE_DEPRECATED_2018_R("Use method 'writableBytes()' or 'constBytes()' instead")
166 virtual ByteArrayView buffer() = 0;
167
169 ARCCORE_DEPRECATED_2021("Use method 'writableBytes()' or 'constBytes()' instead")
170 virtual Span<const Byte> bytes() const = 0;
171
179 ARCCORE_DEPRECATED_2021("Use method 'setWritableBytes()' instead")
180 virtual void setBuffer(ByteArrayView buffer) = 0;
181
189 ARCCORE_DEPRECATED_2021("Use method 'setConstBytes()' instead")
190 virtual void setBuffer(ByteConstArrayView buffer) = 0;
191
198 ARCCORE_DEPRECATED_2021("Use method 'setWritableBytes()' instead")
199 virtual void setBytes(Span<Byte> bytes) = 0;
200
207 ARCCORE_DEPRECATED_2021("Use method 'setConstBytes()' instead")
208 virtual void setBytes(Span<const Byte> bytes) = 0;
209
216 ARCCORE_DEPRECATED_2021("Use method 'writableBytes()' or 'constBytes()' instead")
217 virtual Span<Byte> bytes() = 0;
218};
219
220/*---------------------------------------------------------------------------*/
221/*---------------------------------------------------------------------------*/
222
232extern "C++" ARCANE_CORE_EXPORT
234arcaneCreateSerializedDataRef(eDataType data_type, Int64 memory_size,
235 Integer nb_dim, Int64 nb_element, Int64 nb_base_element,
236 bool is_multi_size, Int64ConstArrayView dimensions);
237
238/*---------------------------------------------------------------------------*/
239/*---------------------------------------------------------------------------*/
240
250extern "C++" ARCANE_CORE_EXPORT
252arcaneCreateSerializedDataRef(eDataType data_type, Int64 memory_size,
253 Integer nb_dim, Int64 nb_element, Int64 nb_base_element,
254 bool is_multi_size, Int64ConstArrayView dimensions,
255 const ArrayShape& shape);
256
257/*---------------------------------------------------------------------------*/
258/*---------------------------------------------------------------------------*/
259
266extern "C++" ARCANE_CORE_EXPORT
269
270/*---------------------------------------------------------------------------*/
271/*---------------------------------------------------------------------------*/
272
273} // End namespace Arcane
274
275/*---------------------------------------------------------------------------*/
276/*---------------------------------------------------------------------------*/
277
278#endif
Declarations of Arcane's general types.
#define ARCCORE_DECLARE_REFERENCE_COUNTED_INCLASS_METHODS()
Macro to declare the virtual methods managing reference counters.
Array shape.
Definition ArrayShape.h:42
Interface of a hashing algorithm.
Interface of a serialized data.
virtual eDataType baseDataType() const =0
Data type.
virtual ArrayShape shape() const =0
Shape of the array associated with the data.
virtual Integer nbDimension() const =0
Dimension. 0 for a scalar, 1 for a 1D array, ...
virtual Int64 memorySize() const =0
Indicates the number of bytes that must be allocated to store or read the data.
virtual void allocateMemory(Int64 size)=0
Allocates an array to hold the serialized elements.
virtual void setWritableBytes(Span< Byte > bytes)=0
Positions the serialized values.
virtual void setConstBytes(Span< const Byte > bytes)=0
Positions the serialized values for reading.
virtual void serialize(ISerializer *buffer) const =0
Serialize the data for reading.
virtual void serialize(ISerializer *buffer)=0
Serialize the data for reading or writing.
ARCANE_DEPRECATED_2018_R("Use method 'writableBytes()' or 'constBytes()' instead") virtual ByteConstArrayView buffer() const =0
Serialized values.
virtual void computeHash(IHashAlgorithm *algo, ByteArray &output) const =0
Compute a hash key on this data.
virtual Span< Byte > writableBytes()=0
View of the serialized values.
virtual ~ISerializedData()=default
Frees resources.
virtual Span< const Byte > bytes() const =0
Serialized values.
virtual Int64 nbBaseElement() const =0
Number of base elements.
virtual Int64ConstArrayView extents() const =0
Array containing the number of elements for each dimension.
virtual Int64 nbElement() const =0
Number of elements.
virtual void setBytes(Span< Byte > bytes)=0
Positions the serialized values.
virtual void setBuffer(ByteArrayView buffer)=0
Positions the serialized values.
virtual Span< const Byte > constBytes() const =0
Serialized values.
virtual bool isMultiSize() const =0
Indicates if it is a multi-size array. (only relevant if nbDimension()>1).
Reference to an instance.
View of an array of elements of type T.
Definition Span.h:635
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Ref< ISerializedData > arcaneCreateSerializedDataRef(eDataType data_type, Int64 memory_size, Integer nb_dim, Int64 nb_element, Int64 nb_base_element, bool is_multi_size, Int64ConstArrayView dimensions)
Creates serialized data.
ArrayView< Byte > ByteArrayView
C equivalent of a 1D array of characters.
Definition UtilsTypes.h:447
std::int64_t Int64
Signed integer type of 64 bits.
Int32 Integer
Type representing an integer.
Array< Byte > ByteArray
Dynamic one-dimensional array of characters.
Definition UtilsTypes.h:121
ConstArrayView< Int64 > Int64ConstArrayView
C equivalent of a 1D array of 64-bit integers.
Definition UtilsTypes.h:480
Ref< ISerializedData > arcaneCreateEmptySerializedDataRef()
Creates serialized data.
ConstArrayView< Byte > ByteConstArrayView
C equivalent of a 1D array of characters.
Definition UtilsTypes.h:476
unsigned char Byte
Type of a byte.
Definition BaseTypes.h:43
eDataType
Data type.
Definition DataTypes.h:41