Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
BasicReaderWriterDatabase.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/* BasicReaderWriterDatabase.h (C) 2000-2023 */
9/* */
10/* Database for the 'BasicReaderWriter' service. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_STD_BASICREADERWRITERDATABASE_H
13#define ARCANE_STD_BASICREADERWRITERDATABASE_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18#include "arcane/utils/String.h"
19#include "arcane/utils/TraceAccessor.h"
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24// TODO: Once we are certain that this file is not used outside of
25// Arcane, we can merge these classes with their implementation
26
27namespace Arcane
28{
29class IDataCompressor;
30class IHashAlgorithm;
31} // namespace Arcane
32
33namespace Arcane::impl
34{
35
36/*---------------------------------------------------------------------------*/
37/*---------------------------------------------------------------------------*/
38
48class KeyValueTextWriter
49: public TraceAccessor
50{
51 class Impl;
52
53 public:
54
55 KeyValueTextWriter(ITraceMng* tm, const String& filename, Int32 version);
56 KeyValueTextWriter(const KeyValueTextWriter& rhs) = delete;
57 ~KeyValueTextWriter();
58 KeyValueTextWriter& operator=(const KeyValueTextWriter& rhs) = delete;
59
60 public:
61
62 void setExtents(const String& key_name, SmallSpan<const Int64> extents);
63 void write(const String& key, Span<const std::byte> values);
64 Int64 fileOffset();
65
66 public:
67
68 String fileName() const;
69 void setDataCompressor(Ref<IDataCompressor> dc);
70 Ref<IDataCompressor> dataCompressor() const;
71 void setHashAlgorithm(Ref<IHashAlgorithm> v);
72 Ref<IHashAlgorithm> hashAlgorithm() const;
73
74 private:
75
76 Impl* m_p;
77};
78
79/*---------------------------------------------------------------------------*/
80/*---------------------------------------------------------------------------*/
81
86class KeyValueTextReader
87: public TraceAccessor
88{
89 class Impl;
90
91 public:
92
93 KeyValueTextReader(ITraceMng* tm, const String& filename, Int32 version);
94 KeyValueTextReader(const KeyValueTextReader& rhs) = delete;
95 ~KeyValueTextReader();
96 KeyValueTextReader& operator=(const KeyValueTextReader& rhs) = delete;
97
98 public:
99
100 void setFileOffset(Int64 v);
101 void getExtents(const String& key_name, SmallSpan<Int64> extents);
102 void readIntegers(const String& key, Span<Integer> values);
103 void read(const String& key, Span<std::byte> values);
104
105 public:
106
107 String fileName() const;
108 void setDataCompressor(Ref<IDataCompressor> ds);
109 Ref<IDataCompressor> dataCompressor() const;
110 void setHashAlgorithm(Ref<IHashAlgorithm> v);
111 Ref<IHashAlgorithm> hashAlgorithm() const;
112
113 private:
114
115 Impl* m_p;
116};
117
118/*---------------------------------------------------------------------------*/
119/*---------------------------------------------------------------------------*/
120
121} // End namespace Arcane::impl
122
123/*---------------------------------------------------------------------------*/
124/*---------------------------------------------------------------------------*/
125
126#endif
Declarations of types used in Arcane.
Interface of a service for compressing/decompressing data.
Interface of a hashing algorithm.
Reference to an instance.
View of an array of elements of type T.
Definition Span.h:805
View of an array of elements of type T.
Definition Span.h:635
TraceAccessor(ITraceMng *m)
Constructs an accessor via the trace manager m.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int64_t Int64
Signed integer type of 64 bits.
std::int32_t Int32
Signed integer type of 32 bits.