Arcane  v3.14.10.0
Documentation utilisateur
Chargement...
Recherche...
Aucune correspondance
DataTypeContainer.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2022 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/* DataTypeContainer.h (C) 2000-2022 */
9/* */
10/* Conteneur contenant une instance d'une classe par type de donnée. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_UTILS_DATATYPECONTAINER_H
13#define ARCANE_UTILS_DATATYPECONTAINER_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27/*!
28 * \brief Conteneur contenant une instance d'une classe par type de donnée.
29 *
30 * La classe template \a Traits doit contenir un type \a InstanceType qui
31 * indique pour chaque type du language le type de l'instance du conteneur.
32 * Par exemple
33 *
34 * \code
35 * template<typename DataType>
36 * class Instancer
37 * {
38 * public:
39 * typedef UniqueArray<DataType> InstanceType;
40 * };
41 * \endcode
42 *
43 * La méthode instance() permet de récupérer une référence sur l'instance
44 * à partir de son type.
45 */
46template <template <typename DataType> class Traits>
48{
49 public:
50
51 typename Traits<char>::InstanceType& instance(char*) { return m_char; }
52 typename Traits<signed char>::InstanceType& instance(signed char*) { return m_signed_char; }
53 typename Traits<unsigned char>::InstanceType& instance(unsigned char*) { return m_unsigned_char; }
54 typename Traits<short>::InstanceType& instance(short*) { return m_short; }
55 typename Traits<unsigned short>::InstanceType& instance(unsigned short*) { return m_unsigned_short; }
56 typename Traits<int>::InstanceType& instance(int*) { return m_int; }
57 typename Traits<unsigned int>::InstanceType& instance(unsigned int*) { return m_unsigned_int; }
58 typename Traits<long>::InstanceType& instance(long*) { return m_long; }
59 typename Traits<unsigned long>::InstanceType& instance(unsigned long*) { return m_unsigned_long; }
60 typename Traits<long long>::InstanceType& instance(long long*) { return m_long_long; }
61 typename Traits<unsigned long long>::InstanceType& instance(unsigned long long*) { return m_unsigned_long_long; }
62 typename Traits<float>::InstanceType& instance(float*) { return m_float; }
63 typename Traits<double>::InstanceType& instance(double*) { return m_double; }
64 typename Traits<long double>::InstanceType& instance(long double*) { return m_long_double; }
65
66 public:
67
68 typename Traits<char>::InstanceType m_char;
69 typename Traits<signed char>::InstanceType m_signed_char;
70 typename Traits<unsigned char>::InstanceType m_unsigned_char;
71 typename Traits<short>::InstanceType m_short;
72 typename Traits<unsigned short>::InstanceType m_unsigned_short;
73 typename Traits<int>::InstanceType m_int;
74 typename Traits<unsigned int>::InstanceType m_unsigned_int;
75 typename Traits<long>::InstanceType m_long;
76 typename Traits<unsigned long>::InstanceType m_unsigned_long;
77 typename Traits<long long>::InstanceType m_long_long;
78 typename Traits<unsigned long long>::InstanceType m_unsigned_long_long;
79 typename Traits<float>::InstanceType m_float;
80 typename Traits<double>::InstanceType m_double;
81 typename Traits<long double>::InstanceType m_long_double;
82};
83
84/*---------------------------------------------------------------------------*/
85/*---------------------------------------------------------------------------*/
86/*!
87 * \brief Conteneur contenant une instance d'une classe par type de donnée %Arcane.
88 */
89template <template <typename DataType> class Traits>
91: public BuiltInDataTypeContainer<Traits>
92{
93 public:
94
96 using Base::instance;
97
98 public:
99
100 typename Traits<APReal>::InstanceType& instance(APReal*) { return m_apreal; }
101 typename Traits<Real2>::InstanceType& instance(Real2*) { return m_real2; }
102 typename Traits<Real3>::InstanceType& instance(Real3*) { return m_real3; }
103 typename Traits<Real2x2>::InstanceType& instance(Real2x2*) { return m_real2x2; }
104 typename Traits<Real3x3>::InstanceType& instance(Real3x3*) { return m_real3x3; }
105 typename Traits<HPReal>::InstanceType& instance(HPReal*) { return m_hpreal; }
106
107 public:
108
109 typename Traits<APReal>::InstanceType m_apreal;
110 typename Traits<Real2>::InstanceType m_real2;
111 typename Traits<Real3>::InstanceType m_real3;
112 typename Traits<Real2x2>::InstanceType m_real2x2;
113 typename Traits<Real3x3>::InstanceType m_real3x3;
114 typename Traits<HPReal>::InstanceType m_hpreal;
115};
116
117/*---------------------------------------------------------------------------*/
118/*---------------------------------------------------------------------------*/
119
120} // namespace Arcane
121
122/*---------------------------------------------------------------------------*/
123/*---------------------------------------------------------------------------*/
124
125#endif
Fichier de configuration d'Arcane.
Conteneur contenant une instance d'une classe par type de donnée Arcane.
Conteneur contenant une instance d'une classe par type de donnée.
Classe implémentant un réel Haute Précision.
Definition HPReal.h:161
Classe gérant un vecteur de réel de dimension 2.
Definition Real2.h:121
Classe gérant une matrice de réel de dimension 2x2.
Definition Real2x2.h:53
Classe gérant un vecteur de réel de dimension 3.
Definition Real3.h:132
Classe gérant une matrice de réel de dimension 3x3.
Definition Real3x3.h:66
Emulation de réel en précision arbitraire.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-