16#include "arcane/utils/ArgumentException.h"
17#include "arcane/utils/NotSupportedException.h"
18#include "arcane/utils/TraceInfo.h"
19#include "arcane/utils/IHashAlgorithm.h"
20#include "arcane/utils/NotImplementedException.h"
21#include "arcane/utils/Array.h"
22#include "arcane/utils/ArrayShape.h"
24#include "arcane/core/datatype/DataAllocationInfo.h"
25#include "arcane/core/datatype/DataStorageTypeInfo.h"
26#include "arcane/core/datatype/DataStorageBuildInfo.h"
27#include "arcane/core/datatype/DataTypeTraits.h"
29#include "arcane/impl/SerializedData.h"
30#include "arcane/impl/DataStorageFactory.h"
32#include "arcane/core/ISerializer.h"
33#include "arcane/core/IDataVisitor.h"
35#include "arcane/core/internal/IDataInternal.h"
58 typedef StringScalarData ThatClass;
68 explicit Internal(StringScalarData* p)
76 m_p->computeHash(hash_info);
81 StringScalarData* m_p =
nullptr;
90 explicit StringScalarData(
const DataStorageBuildInfo& dsbi);
91 StringScalarData(
const StringScalarData& rhs)
93 , m_trace(rhs.m_trace)
95 , m_allocation_info(rhs.m_allocation_info)
113 StringScalarData*
cloneTrue()
override {
return new ThatClass(*
this); }
117 DataInterfaceType* d =
new ThatClass(*
this);
122 DataInterfaceType* d =
new ThatClass(m_trace);
143 visitor->applyVisitor(
this);
147 visitor->applyDataVisitor(
this);
171: m_trace(dsbi.traceMng())
179DataStorageTypeInfo StringScalarData::
180staticStorageTypeInfo()
183 Int32 nb_basic_type = 0;
186 return DataStorageTypeInfo(bdt, nb_basic_type,
dimension, multi_tag);
195 return staticStorageTypeInfo();
204 ARCANE_UNUSED(use_basic_type);
207 Int64 nb_element = 1;
209 Int64 nb_base_element = len;
211 extents.
add(nb_element);
214 nb_base_element,
false, extents);
215 sd->setConstBytes(base_values);
258 ARCANE_UNUSED(operation);
261 if (mode == ISerializer::ModeReserve) {
288 ARCANE_UNUSED(operation);
317 hash_info.setVersion(2);
327 const DataInterfaceType* true_data =
dynamic_cast<const DataInterfaceType*
>(data);
339 DataInterfaceType* true_data =
dynamic_cast<DataInterfaceType*
>(data);
351 visitor->applyVisitor(
this);
#define ARCCORE_DEFINE_REFERENCE_COUNTED_INCLASS_METHODS()
Macro to define methods managing counters of references.
Exception when an argument is invalid.
void add(ConstReferenceType val)
Adds element val to the end of the array.
constexpr Integer size() const noexcept
Number of elements in the array.
Information on data allocation.
Information for calculating data hash.
Information to construct an instance of 'IData'.
static void registerDataFactory(IDataFactoryMng *dfm)
Registers a factory for the data DataType in dfm.
Type information for a data container.
Interface of the visitor pattern for a 2D array data item.
Interface of the visitor pattern for an array data item.
Interface of the data factory manager.
Interface of an operation on a data.
Interface of the visitor pattern for a data item.
Interface of a data item.
virtual void updateHash(Span< const std::byte > input)=0
Adds the array input to the calculated hash.
Interface of a hashing algorithm.
virtual void computeHash64(Span< const Byte > input, ByteArray &output)
Calculates the hash value for the array input.
Interface of a scalar data item of type T.
virtual DataType & value()=0
Data value.
Interface of the visitor pattern for a scalar data item.
Interface of a serialized data.
virtual eDataType baseDataType() const =0
Data type.
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 Int64 nbBaseElement() const =0
Number of base elements.
virtual Span< const Byte > constBytes() const =0
Serialized values.
virtual void reserve(eBasicDataType dt, Int64 n)=0
Reserves memory for n objects of type dt.
eMode
Serializer operating mode.
@ ModePut
The serializer expects reserve().
@ ModeGet
The serializer expects get().
virtual void put(Span< const Real > values)=0
Add the array values.
virtual eReadMode readMode() const =0
Read mode.
virtual eMode mode() const =0
Current operating mode.
@ ReadReplace
Replace current elements with those read.
@ ReadAdd
Add those read to the current elements.
virtual void get(ArrayView< Real > values)=0
Retrieve the array values.
Exception when an operation is not supported.
Reference to an instance.
Thread-safe implementation of a reference counter.
constexpr __host__ __device__ SizeType size() const noexcept
Returns the size of the array.
View of an array of elements of type T.
void computeHash(DataHashInfo &hash_info) override
Calculates the hash of the data.
Scalar data of a unicode string.
DataStorageTypeInfo storageTypeInfo() const override
Information about the data container type.
IDataInternal * _commonInternal() override
StringScalarData * cloneTrue() override
Clone the data.
DataAllocationInfo allocationInfo() const override
Allocation information.
Ref< IData > cloneEmptyRef() override
Clone the data but without elements.
void visitArray(IArrayDataVisitor *visitor) override
Apply the visitor to the data.
eDataType dataType() const override
Data type.
DataType & value() override
Data value.
void resize(Integer) override
Resize the data.
void serialize(ISerializer *sbuf, IDataOperation *operation) override
Serializes the data by applying the operation.
Ref< DataInterfaceType > cloneTrueRef() override
Clone the data.
Ref< ISerializedData > createSerializedDataRef(bool use_basic_type) const override
Serialize the data.
void assignSerializedData(const ISerializedData *sdata) override
Assign the serialized values sdata to the data.
Integer multiTag() const override
Multi-tag. 0 if not multiple, 1 if multiple, 2 if multiple for MultiArray variables (obsolete).
void setAllocationInfo(const DataAllocationInfo &v) override
Sets the allocation information.
void visit(IScalarDataVisitor *visitor) override
Applies the visitor to the data.
void allocateBufferForSerializedData(ISerializedData *sdata) override
Allocate memory to read the serialized values sdata.
void setShape(const ArrayShape &) override
Sets the array shape.
IData * cloneEmpty() override
Clone the data but without elements. The created instance must be destroyed by the 'delete' operator.
void visitScalar(IScalarDataVisitor *visitor) override
Apply the visitor to the data.
IData * clone() override
Clone the data. The created instance must be destroyed by the 'delete' operator.
void computeHash(IHashAlgorithm *algo, ByteArray &output) const override
Compute a hash key on this data.
ArrayShape shape() const override
Array shape for a 1D or 2D data item.
void visitArray2(IArray2DataVisitor *visitor) override
Apply the visitor to the data.
void swapValues(IData *data) override
Swap the values of data with those of the instance.
Ref< IData > cloneRef() override
Clone the data.
void visit(IDataVisitor *visitor) override
Applies the visitor to the data.
const DataType & value() const override
Data value.
Integer dimension() const override
Dimension. 0 for a scalar, 1 for a mono-dim array, 2 for a bi-dim array.
void fillDefault() override
Fills the data with its default value.
void copy(const IData *data) override
Copy the data data into the current instance.
StringScalarData * cloneTrueEmpty() override
Clone the data but without elements.
void setName(const String &name) override
Sets the name of the data (internal).
Ref< DataInterfaceType > cloneTrueEmptyRef() override
Clone the data but without elements.
Unicode character string.
Span< const Byte > bytes() const
Returns the conversion of the instance into UTF-8 encoding.
-- 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.
UniqueArray< Int64 > Int64UniqueArray
Dynamic 1D array of 64-bit integers.
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.
ConstArrayView< Int32 > Int32ConstArrayView
C equivalent of a 1D array of 32-bit integers.
eBasicDataType
Type of a basic data item.
Impl::SpanTypeFromSize< conststd::byte, SizeType >::SpanType asBytes(const SpanImpl< DataType, SizeType, Extent > &s)
Converts the view into an array of non-modifiable bytes.
ConstArrayView< Byte > ByteConstArrayView
C equivalent of a 1D array of characters.
auto makeRef(InstanceType *t) -> Ref< InstanceType >
Creates a reference on a pointer.