14#include "arccore/serialize/BasicSerializer.h"
16#include "arccore/base/ArgumentException.h"
17#include "arccore/base/FatalErrorException.h"
19#include "arccore/serialize/internal/BasicSerializerInternal.h"
49:
public BasicSerializer::Impl
52 static constexpr int IDX_TAG = 0;
54 static constexpr Int64 SERIALIZE_TAG = 0x7a9b3cd0;
56 static constexpr int IDX_VERSION = 1;
58 static constexpr int IDX_RESERVED1 = 2;
61 static constexpr int IDX_TOTAL_SIZE = 3;
63 static constexpr int IDX_NB_BYTE = 4;
64 static constexpr int IDX_NB_FLOAT16 = 5;
65 static constexpr int IDX_NB_FLOAT32 = 6;
66 static constexpr int IDX_NB_FLOAT64 = 7;
67 static constexpr int IDX_NB_FLOAT128 = 8;
68 static constexpr int IDX_NB_INT16 = 9;
69 static constexpr int IDX_NB_INT32 = 10;
70 static constexpr int IDX_NB_INT64 = 11;
71 static constexpr int IDX_NB_INT128 = 12;
72 static constexpr int IDX_NB_INT8 = 13;
73 static constexpr int IDX_NB_BFLOAT16 = 14;
76 static constexpr int IDX_POS_BYTE = 32;
77 static constexpr int IDX_POS_FLOAT16 = 33;
78 static constexpr int IDX_POS_FLOAT32 = 34;
79 static constexpr int IDX_POS_FLOAT64 = 35;
80 static constexpr int IDX_POS_FLOAT128 = 36;
81 static constexpr int IDX_POS_INT16 = 37;
82 static constexpr int IDX_POS_INT32 = 38;
83 static constexpr int IDX_POS_INT64 = 39;
84 static constexpr int IDX_POS_INT128 = 40;
85 static constexpr int IDX_POS_INT8 = 41;
86 static constexpr int IDX_POS_BFLOAT16 = 42;
88 static constexpr Integer NB_SIZE_ELEM = 128;
101 Int64 m_original_size = 0;
102 Int64 m_padded_size = 0;
139 Span<Int32> getInt32Buffer()
override {
return m_int32_view; }
140 Span<Int64> getInt64Buffer()
override {
return m_int64_view; }
141 Span<Byte> getByteBuffer()
override {
return m_byte_view; }
142 Span<Int8> getInt8Buffer()
override {
return m_int8_view; }
143 Span<Float16> getFloat16Buffer()
override {
return m_float16_view; }
144 Span<BFloat16> getBFloat16Buffer()
override {
return m_bfloat16_view; }
145 Span<Float32> getFloat32Buffer()
override {
return m_float32_view; }
146 Span<Float128> getFloat128Buffer()
override {
return m_float128_view; }
147 Span<Int128> getInt128Buffer()
override {
return m_int128_view; }
149 void allocateBuffer(Int64 nb_real, Int64 nb_int16, Int64 nb_int32,
150 Int64 nb_int64, Int64 nb_byte)
override
153 Int64 nb_float16 = 0;
154 Int64 nb_bfloat16 = 0;
155 Int64 nb_float32 = 0;
156 Int64 nb_float128 = 0;
158 allocateBuffer(nb_real, nb_int16, nb_int32, nb_int64, nb_byte, nb_int8,
159 nb_float16, nb_bfloat16, nb_float32, nb_float128, nb_int128);
162 void allocateBuffer(Int64 nb_real, Int64 nb_int16, Int64 nb_int32,
163 Int64 nb_int64, Int64 nb_byte, Int64 nb_int8, Int64 nb_float16,
164 Int64 nb_bfloat16, Int64 nb_float32, Int64 nb_float128, Int64 nb_int128)
override
166 SizeInfo size_info = getPaddingSize(NB_SIZE_ELEM,
sizeof(Int64));
167 Int64 total = size_info.m_padded_size;
169 Int64 real_position = total;
170 SizeInfo padded_real_size = getPaddingSize(nb_real,
sizeof(
Real));
171 total += padded_real_size.m_padded_size;
173 Int64 int16_position = total;
174 SizeInfo padded_int16_size = getPaddingSize(nb_int16,
sizeof(Int16));
175 total += padded_int16_size.m_padded_size;
177 Int64 int32_position = total;
178 SizeInfo padded_int32_size = getPaddingSize(nb_int32,
sizeof(Int32));
179 total += padded_int32_size.m_padded_size;
181 Int64 int64_position = total;
182 SizeInfo padded_int64_size = getPaddingSize(nb_int64,
sizeof(Int64));
183 total += padded_int64_size.m_padded_size;
185 Int64 byte_position = total;
186 SizeInfo padded_byte_size = getPaddingSize(nb_byte,
sizeof(
Byte));
187 total += padded_byte_size.m_padded_size;
189 Int64 int8_position = total;
190 SizeInfo padded_int8_size = getPaddingSize(nb_int8,
sizeof(
Int8));
191 total += padded_int8_size.m_padded_size;
193 Int64 float16_position = total;
194 SizeInfo padded_float16_size = getPaddingSize(nb_float16,
sizeof(Float16));
195 total += padded_float16_size.m_padded_size;
197 Int64 bfloat16_position = total;
198 SizeInfo padded_bfloat16_size = getPaddingSize(nb_bfloat16,
sizeof(BFloat16));
199 total += padded_bfloat16_size.m_padded_size;
201 Int64 float32_position = total;
202 SizeInfo padded_float32_size = getPaddingSize(nb_float32,
sizeof(
Float32));
203 total += padded_float32_size.m_padded_size;
205 Int64 float128_position = total;
206 SizeInfo padded_float128_size = getPaddingSize(nb_float128,
sizeof(Float128));
207 total += padded_float128_size.m_padded_size;
209 Int64 int128_position = total;
210 SizeInfo padded_int128_size = getPaddingSize(nb_int128,
sizeof(Int128));
211 total += padded_int128_size.m_padded_size;
275 void copy(Impl* rhs)
override
292 Span<Byte> globalBuffer()
override
297 Span<const Byte> globalBuffer()
const override
307 void preallocate(Int64 size)
override
313 void releaseBuffer()
override
318 void setFromSizes()
override
321 if (tag_id != SERIALIZE_TAG)
322 ARCCORE_FATAL(
"Bad tag id '{0}' for serializer (expected={1})."
323 "The data are not from a BasicSerializer. SizeView={2}",
327 ARCCORE_FATAL(
"Bad version '{0}' for serializer. Only version 1 is allowed", version_id);
348 Int64 bfloat16_position =
m_sizes_view[IDX_POS_BFLOAT16];
350 Int64 float128_position =
m_sizes_view[IDX_POS_FLOAT128];
378 Int64 totalSize()
const override
383 void printSizes(std::ostream& o)
const override
386 Int64 total_size = totalSize();
388 o <<
" bytes " << bytes.
size()
389 <<
" total_size " << total_size
390 <<
" float64 " << sbuf_sizes[IDX_NB_FLOAT64]
391 <<
" int64 " << sbuf_sizes[IDX_NB_INT64]
392 <<
" int32 " << sbuf_sizes[IDX_NB_INT32]
393 <<
" int16 " << sbuf_sizes[IDX_NB_INT16]
394 <<
" byte " << sbuf_sizes[IDX_NB_BYTE]
395 <<
" int8 " << sbuf_sizes[IDX_NB_INT8]
396 <<
" float16 " << sbuf_sizes[IDX_NB_FLOAT16]
397 <<
" bfloat16 " << sbuf_sizes[IDX_NB_BFLOAT16]
398 <<
" float32 " << sbuf_sizes[IDX_NB_FLOAT32]
399 <<
" float128 " << sbuf_sizes[IDX_NB_FLOAT128]
400 <<
" int128 " << sbuf_sizes[IDX_NB_INT128]
401 <<
" ptr=" << (
void*)bytes.data();
406 SizeInfo getPaddingSize(Int64 nb_elem, Int64 elem_size)
409 ARCCORE_FATAL(
"Bad number of element '{0}' (should be >=0)", nb_elem);
411 ARCCORE_FATAL(
"Bad elem_size '{0}'", elem_size);
412 Int64 s = nb_elem * elem_size;
413 Int64 pad = s % ALIGN_SIZE;
416 Int64 new_size = s + (ALIGN_SIZE - pad);
417 if ((new_size % ALIGN_SIZE) != 0)
418 ARCCORE_FATAL(
"Bad padding {0}", new_size);
420 return { s, new_size };
431 Int64 begin = position + size_info.m_original_size;
432 Int64 end = position + size_info.m_padded_size;
441 for (
Int64 i = 0, s = buf.
size(); i < s; ++i)
445 void _checkAlignment()
460 void _checkAddr(
void* ptr)
462 Int64 addr = (
Int64)ptr;
463 if ((addr % ALIGN_SIZE) != 0) {
465 ARCCORE_FATAL(
"Bad alignment addr={0} - {1}", addr, (addr % ALIGN_SIZE));
469 void _printAlignment()
487 void _printAddr(
void* ptr,
const String& name)
489 Int64 addr = (
Int64)ptr;
490 std::cout <<
"Align type=" << name <<
" addr=" << addr <<
" offset=" << (addr % ALIGN_SIZE) <<
'\n';
493 void _allocBuffer(Int64 size)
499 Int64 padding = addr % ALIGN_SIZE;
502 position = ALIGN_SIZE - padding;
505 Int64 new_size = (size + ALIGN_SIZE) - (size % ALIGN_SIZE);
509 auto padding_view =
m_buffer.
span().subspan(position + size, new_size - size);
520BasicSerializer::Impl2::
523, m_read_mode(ReadReplace)
524, m_p(new BasicSerializerNewImpl())
531BasicSerializer::Impl2::
540void BasicSerializer::Impl2::
541reserve(eDataType dt, Int64 n, Int64 nb_put)
543 ARCCORE_ASSERT((m_mode == ModeReserve), (
"Bad mode"));
546 m_real.m_reserved_size += n;
549 m_int64.m_reserved_size += n;
552 m_int32.m_reserved_size += n;
555 m_int16.m_reserved_size += n;
558 m_byte.m_reserved_size += n;
561 m_int8.m_reserved_size += n;
564 m_float16.m_reserved_size += n;
567 m_bfloat16.m_reserved_size += n;
570 m_float32.m_reserved_size += n;
573 m_float128.m_reserved_size += n;
576 m_int128.m_reserved_size += n;
579 ARCCORE_THROW(ArgumentException,
"bad datatype v={0}", (
int)dt);
581 if (m_is_serialize_typeinfo)
583 m_byte.m_reserved_size += nb_put;
589void BasicSerializer::Impl2::
592 ARCCORE_ASSERT((m_mode == ModeReserve), (
"Bad mode"));
595 m_real.m_reserved_size += n;
598 m_int64.m_reserved_size += n;
601 m_int32.m_reserved_size += n;
604 m_int16.m_reserved_size += n;
607 m_byte.m_reserved_size += n;
610 m_int8.m_reserved_size += n;
613 m_float16.m_reserved_size += n;
615 case eBasicDataType::BFloat16:
616 m_bfloat16.m_reserved_size += n;
619 m_float32.m_reserved_size += n;
622 m_float128.m_reserved_size += n;
625 m_int128.m_reserved_size += n;
628 ARCCORE_THROW(ArgumentException,
"Bad basic datatype v={0}", (
int)bdt);
630 if (m_is_serialize_typeinfo)
632 m_byte.m_reserved_size += nb_put;
638void BasicSerializer::Impl2::
641 if (m_is_serialize_typeinfo) {
643 m_byte.put(Span<const Byte>(&b, 1));
650void BasicSerializer::Impl2::
653 if (!m_is_serialize_typeinfo)
656 m_byte.get(Span<Byte>(&b, 1));
658 if (t != expected_type)
659 ARCCORE_FATAL(
"Bad serialized type t='{0}' int={1}' expected='{2}'", t, (
int)t, expected_type);
665void BasicSerializer::Impl2::
668 m_p->allocateBuffer(m_real.m_reserved_size, m_int16.m_reserved_size, m_int32.m_reserved_size,
669 m_int64.m_reserved_size, m_byte.m_reserved_size, m_int8.m_reserved_size,
670 m_float16.m_reserved_size, m_bfloat16.m_reserved_size, m_float32.m_reserved_size,
671 m_float128.m_reserved_size, m_int128.m_reserved_size);
678void BasicSerializer::Impl2::
688void BasicSerializer::Impl2::
691 m_real.m_buffer = m_p->getRealBuffer();
692 m_real.m_current_position = 0;
694 m_int64.m_buffer = m_p->getInt64Buffer();
695 m_int64.m_current_position = 0;
697 m_int32.m_buffer = m_p->getInt32Buffer();
698 m_int32.m_current_position = 0;
700 m_int16.m_buffer = m_p->getInt16Buffer();
701 m_int16.m_current_position = 0;
703 m_byte.m_buffer = m_p->getByteBuffer();
704 m_byte.m_current_position = 0;
706 m_int8.m_buffer = m_p->getInt8Buffer();
707 m_int8.m_current_position = 0;
709 m_float16.m_buffer = m_p->getFloat16Buffer();
710 m_float16.m_current_position = 0;
712 m_bfloat16.m_buffer = m_p->getBFloat16Buffer();
713 m_bfloat16.m_current_position = 0;
715 m_float32.m_buffer = m_p->getFloat32Buffer();
716 m_float32.m_current_position = 0;
718 m_float128.m_buffer = m_p->getFloat128Buffer();
719 m_float128.m_current_position = 0;
721 m_int128.m_buffer = m_p->getInt128Buffer();
722 m_int128.m_current_position = 0;
728void BasicSerializer::Impl2::
729allocateBuffer(Int64 nb_real, Int64 nb_int16, Int64 nb_int32,
730 Int64 nb_int64, Int64 nb_byte)
733 Int64 nb_float16 = 0;
734 Int64 nb_bfloat16 = 0;
735 Int64 nb_float32 = 0;
736 Int64 nb_float128 = 0;
738 allocateBuffer(nb_real, nb_int16, nb_int32, nb_int64, nb_byte, nb_int8,
739 nb_float16, nb_bfloat16, nb_float32, nb_float128, nb_int128);
745void BasicSerializer::Impl2::
746allocateBuffer(Int64 nb_real, Int64 nb_int16, Int64 nb_int32,
747 Int64 nb_int64, Int64 nb_byte, Int64 nb_int8, Int64 nb_float16,
748 Int64 nb_bfloat16, Int64 nb_float32, Int64 nb_float128, Int64 nb_int128)
750 m_real.m_reserved_size = nb_real;
751 m_int64.m_reserved_size = nb_int64;
752 m_int32.m_reserved_size = nb_int32;
753 m_int16.m_reserved_size = nb_int16;
754 m_byte.m_reserved_size = nb_byte;
755 m_int8.m_reserved_size = nb_int8;
756 m_float16.m_reserved_size = nb_float16;
757 m_bfloat16.m_reserved_size = nb_bfloat16;
758 m_float32.m_reserved_size = nb_float32;
759 m_float128.m_reserved_size = nb_float128;
760 m_int128.m_reserved_size = nb_int128;
767void BasicSerializer::Impl2::
768copy(
const BasicSerializer& rhs)
770 auto rhs_p = rhs._p();
771 Span<Real> real_b = rhs_p->getRealBuffer();
772 Span<Int64> int64_b = rhs_p->getInt64Buffer();
773 Span<Int32> int32_b = rhs_p->getInt32Buffer();
774 Span<Int16> int16_b = rhs_p->getInt16Buffer();
775 Span<Byte> byte_b = rhs_p->getByteBuffer();
776 Span<Int8> int8_b = rhs_p->getInt8Buffer();
777 Span<Float16> float16_b = rhs_p->getFloat16Buffer();
778 Span<BFloat16> bfloat16_b = rhs_p->getBFloat16Buffer();
779 Span<Float32> float32_b = rhs_p->getFloat32Buffer();
780 Span<Float128> float128_b = rhs_p->getFloat128Buffer();
781 Span<Int128> int128_b = rhs_p->getInt128Buffer();
782 allocateBuffer(real_b.size(), int16_b.size(), int32_b.size(), int64_b.size(), byte_b.size(),
783 int8_b.size(), float16_b.size(), bfloat16_b.size(),
784 float32_b.size(), float128_b.size(), int128_b.size());
791void BasicSerializer::Impl2::
792setMode(eMode new_mode)
795 m_real.m_current_position = 0;
796 m_int64.m_current_position = 0;
797 m_int32.m_current_position = 0;
798 m_int16.m_current_position = 0;
799 m_byte.m_current_position = 0;
800 m_int8.m_current_position = 0;
801 m_float16.m_current_position = 0;
802 m_bfloat16.m_current_position = 0;
803 m_float32.m_current_position = 0;
804 m_float128.m_current_position = 0;
805 m_int128.m_current_position = 0;
827BasicSerializer(
const BasicSerializer& sb)
845BasicSerializer::Impl* BasicSerializer::
855Span<Real> BasicSerializer::realBuffer()
857 return m_p2->m_real.m_buffer;
859Span<Int64> BasicSerializer::int64Buffer()
861 return m_p2->m_int64.m_buffer;
863Span<Int32> BasicSerializer::int32Buffer()
865 return m_p2->m_int32.m_buffer;
867Span<Int16> BasicSerializer::int16Buffer()
869 return m_p2->m_int16.m_buffer;
871Span<Byte> BasicSerializer::byteBuffer()
873 return m_p2->m_byte.m_buffer;
882 m_p2->reserve(dt, n, 1);
891 m_p2->reserve(dt, n, 1);
900 m_p2->reserve(dt, n, n);
909 m_p2->reserve(dt, n, n);
1008 ARCCORE_ASSERT((m_p2->m_mode ==
ModePut), (
"Bad mode"));
1010 m_p2->m_real.put(values);
1019 ARCCORE_ASSERT((m_p2->m_mode ==
ModePut), (
"Bad mode"));
1021 m_p2->m_int64.put(values);
1030 ARCCORE_ASSERT((m_p2->m_mode ==
ModePut), (
"Bad mode"));
1032 m_p2->m_int32.put(values);
1041 ARCCORE_ASSERT((m_p2->m_mode ==
ModePut), (
"Bad mode"));
1043 m_p2->m_int16.put(values);
1052 ARCCORE_ASSERT((m_p2->m_mode ==
ModePut), (
"Bad mode"));
1054 m_p2->m_byte.put(values);
1063 ARCCORE_ASSERT((m_p2->m_mode ==
ModePut), (
"Bad mode"));
1065 m_p2->m_int8.put(values);
1074 ARCCORE_ASSERT((m_p2->m_mode ==
ModePut), (
"Bad mode"));
1076 m_p2->m_float16.put(values);
1085 ARCCORE_ASSERT((m_p2->m_mode ==
ModePut), (
"Bad mode"));
1086 m_p2->putType(eBasicDataType::BFloat16);
1087 m_p2->m_bfloat16.put(values);
1096 ARCCORE_ASSERT((m_p2->m_mode ==
ModePut), (
"Bad mode"));
1098 m_p2->m_float32.put(values);
1107 ARCCORE_ASSERT((m_p2->m_mode ==
ModePut), (
"Bad mode"));
1109 m_p2->m_float128.put(values);
1118 ARCCORE_ASSERT((m_p2->m_mode ==
ModePut), (
"Bad mode"));
1120 m_p2->m_int128.put(values);
1129 ARCCORE_ASSERT((m_p2->m_mode ==
ModePut), (
"Bad mode"));
1221 ARCCORE_ASSERT((m_p2->m_mode ==
ModeGet), (
"Bad mode"));
1223 m_p2->m_real.get(values);
1232 ARCCORE_ASSERT((m_p2->m_mode ==
ModeGet), (
"Bad mode"));
1234 m_p2->m_int64.get(values);
1243 ARCCORE_ASSERT((m_p2->m_mode ==
ModeGet), (
"Bad mode"));
1245 m_p2->m_int32.get(values);
1254 ARCCORE_ASSERT((m_p2->m_mode ==
ModeGet), (
"Bad mode"));
1256 m_p2->m_int16.get(values);
1265 ARCCORE_ASSERT((m_p2->m_mode ==
ModeGet), (
"Bad mode"));
1267 m_p2->m_byte.get(values);
1276 ARCCORE_ASSERT((m_p2->m_mode ==
ModeGet), (
"Bad mode"));
1278 m_p2->m_int8.get(values);
1287 ARCCORE_ASSERT((m_p2->m_mode ==
ModeGet), (
"Bad mode"));
1289 m_p2->m_float16.get(values);
1298 ARCCORE_ASSERT((m_p2->m_mode ==
ModeGet), (
"Bad mode"));
1299 m_p2->getAndCheckType(eBasicDataType::BFloat16);
1300 m_p2->m_bfloat16.get(values);
1309 ARCCORE_ASSERT((m_p2->m_mode ==
ModeGet), (
"Bad mode"));
1311 m_p2->m_float32.get(values);
1320 ARCCORE_ASSERT((m_p2->m_mode ==
ModeGet), (
"Bad mode"));
1322 m_p2->m_float128.get(values);
1331 ARCCORE_ASSERT((m_p2->m_mode ==
ModeGet), (
"Bad mode"));
1333 m_p2->m_int128.get(values);
1424 ARCCORE_ASSERT((m_p2->m_mode ==
ModeGet), (
"Bad mode"));
1437 m_p2->allocateBuffer();
1446 return m_p2->m_mode;
1455 m_p2->setMode(new_mode);
1464 return m_p2->m_read_mode;
1473 m_p2->m_read_mode = new_read_mode;
1483 m_p2->allocateBuffer(nb_real, nb_int16, nb_int32, nb_int64, nb_byte, 0, 0, 0, 0, 0, 0);
1490copy(
const BasicSerializer& rhs)
1503 ARCCORE_FATAL(
"Can only copy from 'BasicSerializer'");
1513 return _p()->globalBuffer();
1519Span<const Byte> BasicSerializer::
1522 return _p()->globalBuffer();
1529copyAndGetSizesBuffer()
1531 return _p()->copyAndGetSizesBuffer();
1540 return _p()->sizesBuffer();
1546void BasicSerializer::
1547preallocate(Int64 size)
1549 return _p()->preallocate(size);
1555void BasicSerializer::
1558 _p()->releaseBuffer();
1564void BasicSerializer::
1567 m_p2->setFromSizes();
1573Int64 BasicSerializer::
1576 return _p()->totalSize();
1582void BasicSerializer::
1583printSizes(std::ostream& o)
const
1585 _p()->printSizes(o);
1596 preallocate(nb_byte);
1597 globalBuffer().
copy(buf);
1607 m_p2->setSerializeTypeInfo(v);
1613bool BasicSerializer::
1614isSerializeTypeInfo()
const
1616 return m_p2->isSerializeTypeInfo();
void dispose()
Libère la mémoire utilisée par le tableau.
void fill(const T &o) noexcept
Remplit le tableau avec la valeur o.
constexpr Integer size() const noexcept
Retourne la taille du tableau.
Classe de base des vecteurs 1D de données.
Span< const T > span() const
Vue immutable sur ce tableau.
void resize(Int64 s)
Change le nombre d'éléments du tableau à s.
Implémentation d'un buffer de sérialisation contigu en mémoire.
Span< Float128 > m_float128_view
Vue les Float128.
UniqueArray< Byte > m_buffer
Tableau contenant les données sérialisées.
Span< Int32 > m_int32_view
Vue sur les entiers 32 bits.
Span< Int16 > m_int16_view
Vue sur les entiers 16 bits.
void _fillPadding(Int64 position, SizeInfo size_info)
Remplit avec une valeur fixe les zones correspondantes au padding. Cela permet d'éviter d'avoir des v...
Int64 m_size_copy_buffer[NB_SIZE_ELEM]
Copie des tailles utilisée pour l'envoie en plusieurs fois.
Span< Byte > m_byte_view
Vue les octets.
Span< Byte > m_buffer_view
Vue alignée sur ALIGN_SIZE du m_buffer.
Span< Float32 > m_float32_view
Vue les Float32.
Span< Int8 > m_int8_view
Vue les Int8.
Span< BFloat16 > m_bfloat16_view
Vue les BFloat16.
Span< Float16 > m_float16_view
Vue les Float16.
Span< Int64 > m_int64_view
Vue sur les entiers 64 bits.
Int64ArrayView m_sizes_view
Vue pour les tailles (doit être un multiple de ALIGN_SIZE);.
Span< Int128 > m_int128_view
Vue les Int128.
Span< Real > m_real_view
Vue sur les reels;.
void allocateBuffer() override
Alloue la mémoire du sérialiseur.
Int64 getInt64() override
Récupère une taille.
void getArray(Array< Real > &values) override
Redimensionne et remplit values.
void setReadMode(eReadMode new_read_mode) override
Positionne le mode de lecture.
void copy(const ISerializer *from) override
Copie les données de from dans cette instance.
void initFromBuffer(Span< const Byte > buf)
Initialise le sérialiseur en lecture à partir des données buf.
void putSpan(Span< const Int8 > values) override
Ajoute le tableau values.
void put(Span< const Real > values) override
Ajoute le tableau values.
void setMode(eMode new_mode) override
Positionne le fonctionnement actuel.
void setSerializeTypeInfo(bool v)
Indique si on sérialise le type de donnée pour garantir la cohérence.
void putInt64(Int64 value) override
Ajoute l'entier value.
void reserveArray(Span< const Real > values) override
Réserve pour sauver le nombre d'éléments et les values éléments.
static ARCCORE_CONSTEXPR Integer paddingSize()
Taille du padding et de l'alignement.
void getSpan(Span< Real > values) override
Récupère le tableau values.
eMode mode() const override
Mode de fonctionnement actuel.
void get(RealArrayView values) override
Récupère le tableau values.
void reserveSpan(eDataType dt, Int64 n) override
Réserve de la mémoire pour n valeurs de dt.
eReadMode readMode() const override
Mode de lecture.
void putArray(Span< const Real > values) override
Sauve le nombre d'éléments et les values éléments.
void reserve(eBasicDataType dt, Int64 n) override
Réserve de la mémoire pour n objets de type dt.
Interface d'un sérialiseur.
eMode
Mode de fonctionnement du sérialiseur.
@ ModePut
Le sérialiseur attend des reserve()
@ ModeGet
Le sérialiseur attend des get()
void reserveInt64(Int64 n)
Réserve pour n Int64.
eReadMode
Mode de lecture du sérialiseur.
constexpr __host__ __device__ SizeType size() const noexcept
Retourne la taille du tableau.
constexpr __host__ __device__ pointer data() const noexcept
Pointeur sur le début de la vue.
__host__ __device__ void copy(const U ©_array)
Recopie le tableau copy_array dans l'instance.
Vue d'un tableau d'éléments de type T.
constexpr __host__ __device__ Span< T, DynExtent > subspan(Int64 abegin, Int64 asize) const
Sous-vue à partir de l'élément abegin et contenant asize éléments.
Chaîne de caractères unicode.
Span< const Byte > bytes() const
Retourne la conversion de l'instance dans l'encodage UTF-8.
Int64 length() const
Retourne la longueur de la chaîne.
Vecteur 1D de données avec sémantique par valeur (style STL).
@ DT_Float32
Donnée de type 'Float32'.
@ DT_Int128
Donnée de type entier sur 128 bits.
@ DT_Int16
Donnée de type entier 16 bits.
@ DT_Int8
Donnée de type entier sur 8 bits.
@ DT_Int32
Donnée de type entier 32 bits.
@ DT_Float16
Donnée de type 'Float16'.
@ DT_Int64
Donnée de type entier 64 bits.
@ DT_BFloat16
Donnée de type 'BFloat16'.
@ DT_Real
Donnée de type réel.
@ DT_Byte
Donnée de type octet.
@ DT_Float128
Donnée de type flottant sur 128 bits.
Espace de nom de Arccore.
double Real
Type représentant un réel.
Int32 Integer
Type représentant un entier.
float Float32
Type flottant IEEE-753 simple précision.
ArrayView< Int64 > Int64ArrayView
Equivalent C d'un tableau à une dimension d'entiers 64 bits.
eBasicDataType
Type d'une donnée de base.
@ Float32
Donnée de type Float32.
@ Float16
Donnée de type Float16.
@ Int128
Donnée de type entier 128 bits.
@ Int16
Donnée de type entier 16 bits.
@ Int8
< Donnée de type BFloat16
@ Byte
Donnée de type octet.
@ Int32
Donnée de type entier 32 bits.
@ Float64
Donnée de type Float64.
@ Float128
Donnée de type Float128.
@ Int64
Donnée de type entier 64 bits.
std::int64_t Int64
Type entier signé sur 64 bits.
ConstArrayView< Byte > ByteConstArrayView
Equivalent C d'un tableau à une dimension de caractères.
ConstArrayView< Int64 > Int64ConstArrayView
Equivalent C d'un tableau à une dimension d'entiers 64 bits.
std::int8_t Int8
Type entier signé sur 8 bits.
unsigned char Byte
Type d'un octet.
Informations sur la taille allouée avec et sans padding.