Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
ItemUniqueId.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2023 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/* ItemUniqueId.h (C) 2000-2023 */
9/* */
10/* Type d'un identifiant unique pour une entité. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_ITEMUNIQUEID_H
13#define ARCANE_CORE_ITEMUNIQUEID_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/HashFunction.h"
18
19#include "arcane/ArcaneTypes.h"
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24namespace Arcane
25{
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
34class ARCANE_CORE_EXPORT ItemUniqueId
35{
36 public:
37
38 ItemUniqueId() = default;
39 constexpr ARCCORE_HOST_DEVICE explicit ItemUniqueId(Int64 uid)
40 : m_unique_id(uid)
41 {}
42
43 constexpr ARCCORE_HOST_DEVICE operator Int64() const { return m_unique_id; }
44 ARCANE_DEPRECATED operator Int32() const { return asInt32(); }
45 constexpr ARCCORE_HOST_DEVICE Int64 asInt64() const { return m_unique_id; }
46 Int32 asInt32() const;
47 Integer asInteger() const
48 {
49#ifdef ARCANE_64BIT
50 return asInt64();
51#else
52 return asInt32();
53#endif
54 }
55
56 public:
57
58 friend inline bool operator<(ItemUniqueId lhs, ItemUniqueId rhs)
59 {
60 return lhs.asInt64() < rhs.asInt64();
61 }
62 friend inline bool operator<(Int64 lhs, ItemUniqueId rhs)
63 {
64 return lhs < rhs.asInt64();
65 }
66 friend inline bool operator<(ItemUniqueId lhs, Int32 rhs)
67 {
68 return lhs.asInt64() < rhs;
69 }
70 friend inline bool operator<(Int32 lhs, ItemUniqueId rhs)
71 {
72 return lhs < rhs.asInt64();
73 }
74 friend inline bool operator<(ItemUniqueId lhs, Int64 rhs)
75 {
76 return lhs.asInt64() < rhs;
77 }
78
79 friend inline bool operator<=(ItemUniqueId lhs, ItemUniqueId rhs)
80 {
81 return lhs.asInt64() <= rhs.asInt64();
82 }
83 friend inline bool operator<=(Int64 lhs, ItemUniqueId rhs)
84 {
85 return lhs <= rhs.asInt64();
86 }
87 friend inline bool operator<=(ItemUniqueId lhs, Int64 rhs)
88 {
89 return lhs.asInt64() <= rhs;
90 }
91 friend inline bool operator<=(Int32 lhs, ItemUniqueId rhs)
92 {
93 return lhs <= rhs.asInt64();
94 }
95 friend inline bool operator<=(ItemUniqueId lhs, Int32 rhs)
96 {
97 return lhs.asInt64() <= rhs;
98 }
99
100 friend inline bool operator>(ItemUniqueId lhs, ItemUniqueId rhs)
101 {
102 return lhs.asInt64() > rhs.asInt64();
103 }
104 friend inline bool operator>(Int64 lhs, ItemUniqueId rhs)
105 {
106 return lhs > rhs.asInt64();
107 }
108 friend inline bool operator>(ItemUniqueId lhs, Int64 rhs)
109 {
110 return lhs.asInt64() > rhs;
111 }
112 friend inline bool operator>(Int32 lhs, ItemUniqueId rhs)
113 {
114 return lhs > rhs.asInt64();
115 }
116 friend inline bool operator>(ItemUniqueId lhs, Int32 rhs)
117 {
118 return lhs.asInt64() > rhs;
119 }
120
121 friend inline bool operator>=(ItemUniqueId lhs, ItemUniqueId rhs)
122 {
123 return lhs.asInt64() >= rhs.asInt64();
124 }
125 friend inline bool operator>=(Int64 lhs, ItemUniqueId rhs)
126 {
127 return lhs >= rhs.asInt64();
128 }
129 friend inline bool operator>=(ItemUniqueId lhs, Int64 rhs)
130 {
131 return lhs.asInt64() >= rhs;
132 }
133 friend inline bool operator>=(Int32 lhs, ItemUniqueId rhs)
134 {
135 return lhs >= rhs.asInt64();
136 }
137 friend inline bool operator>=(ItemUniqueId lhs, Int32 rhs)
138 {
139 return lhs.asInt64() >= rhs;
140 }
141
142 friend inline bool operator!=(ItemUniqueId lhs, ItemUniqueId rhs)
143 {
144 return lhs.asInt64() != rhs.asInt64();
145 }
146 friend inline bool operator!=(Int64 lhs, ItemUniqueId rhs)
147 {
148 return lhs != rhs.asInt64();
149 }
150 friend inline bool operator!=(ItemUniqueId lhs, Int64 rhs)
151 {
152 return lhs.asInt64() != rhs;
153 }
154 friend inline bool operator!=(Int32 lhs, ItemUniqueId rhs)
155 {
156 return lhs != rhs.asInt64();
157 }
158 friend inline bool operator!=(ItemUniqueId lhs, Int32 rhs)
159 {
160 return lhs.asInt64() != rhs;
161 }
162
163 friend inline bool operator==(ItemUniqueId lhs, ItemUniqueId rhs)
164 {
165 return lhs.asInt64() == rhs.asInt64();
166 }
167 friend inline bool operator==(Int64 lhs, ItemUniqueId rhs)
168 {
169 return lhs == rhs.asInt64();
170 }
171 friend inline bool operator==(ItemUniqueId lhs, Int64 rhs)
172 {
173 return lhs.asInt64() == rhs;
174 }
175 friend inline bool operator==(Int32 lhs, ItemUniqueId rhs)
176 {
177 return lhs == rhs.asInt64();
178 }
179 friend inline bool operator==(ItemUniqueId lhs, Int32 rhs)
180 {
181 return lhs.asInt64() == rhs;
182 }
183
184 friend ARCANE_CORE_EXPORT std::ostream&
185 operator<<(std::ostream& o, const ItemUniqueId&);
186
187 private:
188
189 Int64 m_unique_id = NULL_ITEM_ID;
190};
191
192/*---------------------------------------------------------------------------*/
193/*---------------------------------------------------------------------------*/
194
195/*---------------------------------------------------------------------------*/
196/*---------------------------------------------------------------------------*/
197
202template <>
204{
205 public:
206
208 typedef ItemUniqueId& KeyTypeRef;
210 typedef Int64 HashValueType;
211 typedef TrueType Printable;
212
213 public:
214
215 static Int64 hashFunction(ItemUniqueId key)
216 {
218 }
219};
220
221/*---------------------------------------------------------------------------*/
222/*---------------------------------------------------------------------------*/
223
224/*---------------------------------------------------------------------------*/
225/*---------------------------------------------------------------------------*/
226
227} // namespace Arcane
228
229/*---------------------------------------------------------------------------*/
230/*---------------------------------------------------------------------------*/
231
232#endif
Fonctor pour une fonction de hachage.
Identifiant unique d'une entité.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Structure équivalente à la valeur booléenne vrai.