Arcane
4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
IHashDatabase.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
/* IHashDatabase.h (C) 2000-2023 */
9
/* */
10
/* Interface of a hash database. */
11
/*---------------------------------------------------------------------------*/
12
#ifndef ARCANE_STD_INTERNAL_IHASHDATABASE_H
13
#define ARCANE_STD_INTERNAL_IHASHDATABASE_H
14
/*---------------------------------------------------------------------------*/
15
/*---------------------------------------------------------------------------*/
16
17
#include "arcane/utils/ArrayView.h"
18
#include "arcane/utils/Ref.h"
19
20
#include "arcane/utils/String.h"
21
22
/*---------------------------------------------------------------------------*/
23
/*---------------------------------------------------------------------------*/
24
25
namespace
Arcane
26
{
27
28
/*---------------------------------------------------------------------------*/
29
/*---------------------------------------------------------------------------*/
30
31
class
HashDatabaseReadArgs
32
{
33
public
:
34
35
HashDatabaseReadArgs() =
default
;
36
37
HashDatabaseReadArgs(
const
String
& hash_value,
Span<std::byte>
v)
38
: m_hash_value(hash_value)
39
, m_values(v)
40
{}
41
42
public
:
43
44
void
setKey(
const
String
& v) { m_key = v; }
45
const
String
& key()
const
{
return
m_key; }
46
47
void
setValues(
const
Span<std::byte>
& v) { m_values = v; }
48
Span<std::byte>
values()
const
{
return
m_values; }
49
50
const
String
& hashValueAsString()
const
{
return
m_hash_value; }
51
void
setHashValueAsString(
const
String
& v) { m_hash_value = v; }
52
53
private
:
54
55
String
m_key;
56
String
m_hash_value;
57
Span<std::byte>
m_values;
58
};
59
60
/*---------------------------------------------------------------------------*/
61
/*---------------------------------------------------------------------------*/
62
63
class
HashDatabaseWriteArgs
64
{
65
public
:
66
67
HashDatabaseWriteArgs() =
default
;
68
69
HashDatabaseWriteArgs(
Span<const std::byte>
v,
const
String
& hash_value)
70
: m_values(v)
71
, m_hash_value(hash_value)
72
{}
73
74
public
:
75
76
void
setKey(
const
String
& v) { m_key = v; }
77
const
String
& key()
const
{
return
m_key; }
78
79
void
setValues(
const
Span<const std::byte>
& v) { m_values = v; }
80
Span<const std::byte>
values()
const
{
return
m_values; }
81
82
void
setHashValue(
const
String
& v) { m_hash_value = v; }
83
const
String
& hashValue()
const
{
return
m_hash_value; }
84
85
private
:
86
87
String
m_key;
88
Span<const std::byte>
m_values;
89
String
m_hash_value;
90
};
91
92
/*---------------------------------------------------------------------------*/
93
/*---------------------------------------------------------------------------*/
94
95
class
HashDatabaseWriteResult
96
{
97
public
:
98
99
const
String
& hashValueAsString()
const
{
return
m_hash_value; }
100
void
setHashValueAsString(
const
String
& v) { m_hash_value = v; }
101
102
private
:
103
104
String
m_hash_value;
105
};
106
107
/*---------------------------------------------------------------------------*/
108
/*---------------------------------------------------------------------------*/
109
110
class
IHashDatabase
111
{
112
public
:
113
114
virtual
~IHashDatabase
() =
default
;
115
116
public
:
117
118
virtual
void
writeValues(
const
HashDatabaseWriteArgs
& args,
HashDatabaseWriteResult
& result) = 0;
119
virtual
void
readValues(
const
HashDatabaseReadArgs
& args) = 0;
120
};
121
122
/*---------------------------------------------------------------------------*/
123
/*---------------------------------------------------------------------------*/
124
125
extern
"C++"
Ref<IHashDatabase>
126
createFileHashDatabase(
ITraceMng
* tm,
const
String
& directory);
127
128
extern
"C++"
Ref<IHashDatabase>
129
createRedisHashDatabase(
ITraceMng
* tm,
const
String
& machine_ip,
Int32
port);
130
131
/*---------------------------------------------------------------------------*/
132
/*---------------------------------------------------------------------------*/
133
134
}
// namespace Arcane
135
136
/*---------------------------------------------------------------------------*/
137
/*---------------------------------------------------------------------------*/
138
139
#endif
Arcane::HashDatabaseReadArgs
Definition
IHashDatabase.h:32
Arcane::HashDatabaseWriteArgs
Definition
IHashDatabase.h:64
Arcane::HashDatabaseWriteResult
Definition
IHashDatabase.h:96
Arcane::IHashDatabase
Definition
IHashDatabase.h:111
Arcane::ITraceMng
Trace manager interface.
Definition
arccore/src/trace/arccore/trace/ITraceMng.h:175
Arcane::Ref
Reference to an instance.
Definition
arccore/src/base/arccore/base/Ref.h:325
Arcane::Span
View of an array of elements of type T.
Definition
Span.h:635
Arcane::String
Unicode character string.
Definition
arccore/src/base/arccore/base/String.h:70
Arcane
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Definition
arcane/src/arcane/accelerator/AcceleratorGlobal.h:37
Arcane::Int32
std::int32_t Int32
Signed integer type of 32 bits.
Definition
ArccoreGlobal.h:233
arcane
std
internal
IHashDatabase.h
Generated on
for Arcane by
1.16.1