Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
LinearOffsetMap.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/* LinearOffsetMap.h (C) 2000-2024 */
9/* */
10/* List of linear offsets. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_UTILS_LINEAROFFSETMAP_H
13#define ARCANE_UTILS_LINEAROFFSETMAP_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18
19#include <map>
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24namespace Arcane
25{
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
38template <typename DataType>
40{
41 public:
42
43 static_assert(std::is_same_v<DataType, Int32> || std::is_same_v<DataType, Int64>);
44
45 public:
46
48 ARCANE_UTILS_EXPORT void add(DataType size, DataType offset);
49
59 ARCANE_UTILS_EXPORT DataType getAndRemoveOffset(DataType size);
60
62 ARCANE_UTILS_EXPORT Int32 size() const;
63
64 private:
65
66 std::multimap<DataType, DataType> m_offset_map;
67};
68
69/*---------------------------------------------------------------------------*/
70/*---------------------------------------------------------------------------*/
71
72} // namespace Arcane
73
74/*---------------------------------------------------------------------------*/
75/*---------------------------------------------------------------------------*/
76
77#endif
Arcane configuration file.
List of linear offsets.
void add(DataType size, DataType offset)
Adds an offset offset of size size.
Int32 size() const
Number of elements in the table.
DataType getAndRemoveOffset(DataType size)
Retrieves a sufficient offset for an element of size size.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int32_t Int32
Signed integer type of 32 bits.