Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
BuiltInDataTypeContainer.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2024 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/* BuiltInTypeContainer.h (C) 2000-2024 */
9/* */
10/* Conteneur contenant une instance d'une classe par type de donnée. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCCORE_BASE_BUILTINDATATYPECONTAINER_H
13#define ARCCORE_BASE_BUILTINDATATYPECONTAINER_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arccore/base/ArccoreGlobal.h"
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arccore
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
47template <template <typename DataType> class Traits>
49{
50 public:
51
52 using CharInstanceType = typename Traits<char>::InstanceType;
53 using SignedCharInstanceType = typename Traits<signed char>::InstanceType;
54 using UnsignedCharInstanceType = typename Traits<unsigned char>::InstanceType;
55 using ShortInstanceType = typename Traits<short>::InstanceType;
56 using UnsignedShortInstanceType = typename Traits<unsigned short>::InstanceType;
57 using IntInstanceType = typename Traits<int>::InstanceType;
58 using UnsignedIntInstanceType = typename Traits<unsigned int>::InstanceType;
59 using LongInstanceType = typename Traits<long>::InstanceType;
60 using UnsignedLongInstanceType = typename Traits<unsigned long>::InstanceType;
61 using LongLongInstanceType = typename Traits<long long>::InstanceType;
62 using UnsignedLongLongInstanceType = typename Traits<unsigned long long>::InstanceType;
63 using FloatInstanceType = typename Traits<float>::InstanceType;
64 using DoubleInstanceType = typename Traits<double>::InstanceType;
65 using LongDoubleInstanceType = typename Traits<long double>::InstanceType;
66 using BFloat16InstanceType = typename Traits<BFloat16>::InstanceType;
67 using Float16InstanceType = typename Traits<Float16>::InstanceType;
68
69 public:
70
71 CharInstanceType& instance(char*) { return m_char; }
72 SignedCharInstanceType& instance(signed char*) { return m_signed_char; }
73 UnsignedCharInstanceType& instance(unsigned char*) { return m_unsigned_char; }
74 ShortInstanceType& instance(short*) { return m_short; }
75 UnsignedShortInstanceType& instance(unsigned short*) { return m_unsigned_short; }
76 IntInstanceType& instance(int*) { return m_int; }
77 UnsignedIntInstanceType& instance(unsigned int*) { return m_unsigned_int; }
78 LongInstanceType& instance(long*) { return m_long; }
79 UnsignedLongInstanceType& instance(unsigned long*) { return m_unsigned_long; }
80 LongLongInstanceType& instance(long long*) { return m_long_long; }
81 UnsignedLongLongInstanceType& instance(unsigned long long*) { return m_unsigned_long_long; }
82 FloatInstanceType& instance(float*) { return m_float; }
83 DoubleInstanceType& instance(double*) { return m_double; }
84 LongDoubleInstanceType& instance(long double*) { return m_long_double; }
85 BFloat16InstanceType& instance(BFloat16*) { return m_bfloat16; }
86 Float16InstanceType& instance(Float16*) { return m_float16; }
87
88 public:
89
91 template <typename Lambda>
92 void apply(const Lambda& func)
93 {
94 func(m_char);
95 func(m_signed_char);
96 func(m_unsigned_char);
97 func(m_short);
98 func(m_unsigned_short);
99 func(m_int);
100 func(m_unsigned_int);
101 func(m_long);
102 func(m_unsigned_long);
103 func(m_long_long);
104 func(m_unsigned_long_long);
105 func(m_float);
106 func(m_double);
107 func(m_long_double);
108 func(m_bfloat16);
109 func(m_float16);
110 }
111
112 private:
113
114 CharInstanceType m_char = {};
115 SignedCharInstanceType m_signed_char = {};
116 UnsignedCharInstanceType m_unsigned_char = {};
117 ShortInstanceType m_short = {};
118 UnsignedShortInstanceType m_unsigned_short = {};
119 IntInstanceType m_int = {};
120 UnsignedIntInstanceType m_unsigned_int = {};
121 LongInstanceType m_long = {};
122 UnsignedLongInstanceType m_unsigned_long = {};
123 LongLongInstanceType m_long_long = {};
124 UnsignedLongLongInstanceType m_unsigned_long_long = {};
125 FloatInstanceType m_float = {};
126 DoubleInstanceType m_double = {};
127 LongDoubleInstanceType m_long_double = {};
128 BFloat16InstanceType m_bfloat16 = {};
129 Float16InstanceType m_float16 = {};
130};
131
132/*---------------------------------------------------------------------------*/
133/*---------------------------------------------------------------------------*/
134
135} // namespace Arccore
136
137/*---------------------------------------------------------------------------*/
138/*---------------------------------------------------------------------------*/
139
140#endif
Conteneur contenant une instance d'une classe par type de donnée.
void apply(const Lambda &func)
Applique la fonction lambda func à tous les conteneurs.
Type flottant demi-précision.
Espace de nom de Arccore.
Definition ArcaneTypes.h:24