Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
BuiltInProxy.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/* BuiltInProxy.h (C) 2000-2006 */
9/* */
10/* Proxy d'un type du langage. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_UTILS_BUILTINPROXY_H
13#define ARCANE_UTILS_BUILTINPROXY_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/Numeric.h"
18#include "arcane/utils/MemoryAccessInfo.h"
19
20/*---------------------------------------------------------------------------*/
21/*---------------------------------------------------------------------------*/
22
23ARCANE_BEGIN_NAMESPACE
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
30template<typename Type>
32{
33 public:
34
36
37 public:
38
39
41 : m_value(ref), m_info(info) {}
43 : m_value(f.m_value), m_info(f.m_info) {}
44 const Type& operator=(const ThatClassType& f)
45 { setValue(f.m_value); return m_value; }
46 const Type& operator=(Type v)
47 { setValue(v); return m_value; }
48 //operator Type&()
49 //{ return getValueMutable(); }
50 operator Type() const
51 { return getValue(); }
52
53 public:
54
56 {
57 return setValue(getValue()+b);
58 }
59 void operator++ ()
60 {
61 setValue(getValue()+1);
62 }
63 Type operator++ (int)
64 {
65 Type x = getValue();
66 setValue(x+1);
67 return x;
68 }
69 void operator-- ()
70 {
71 setValue(getValue()-1);
72 }
73 Type operator-- (int)
74 {
75 Type x = getValue();
76 setValue(x-1);
77 return x;
78 }
80 {
81 return setValue(getValue()-b);
82 }
84 {
85 return setValue(getValue()*b);
86 }
88 {
89 return setValue(getValue()/b);
90 }
91
92 public:
93
94 ThatClassType& setValue(const Type& v)
95 {
96 m_value = v;
97 m_info.setWrite();
98 return (*this);
99 }
100 Type getValue() const
101 {
102 m_info.setRead();
103 return m_value;
104 }
105 Type& getValueMutable()
106 {
107 m_info.setReadOrWrite();
108 return m_value;
109 }
110 private:
111
112 Type& m_value;
113 MemoryAccessInfo m_info;
114};
115
116template<typename Type> inline
117bool operator==(const BuiltInProxy<Type>& a,const BuiltInProxy<Type>& b)
118{
119 return a.getValue()==b.getValue();
120}
121template<typename Type> inline
122bool operator==(const BuiltInProxy<Type>& a,const Type& b)
123{
124 return a.getValue()==b;
125}
126template<typename Type> inline
127bool operator==(const Type& a,const BuiltInProxy<Type>& b)
128{
129 return a==b.getValue();
130}
131
132/*---------------------------------------------------------------------------*/
133/*---------------------------------------------------------------------------*/
134
139template<typename Type> inline std::istream&
141{
142 Type v;
143 i >> v;
144 t.setValue(v);
145 return i;
146}
147
148/*---------------------------------------------------------------------------*/
149/*---------------------------------------------------------------------------*/
150
151namespace math
152{
153template<class _Type> inline bool
154isNearlyZero(const BuiltInProxy<_Type>& a)
155{
157}
163template<class _Type> inline bool
165{
167}
168}
169
170/*---------------------------------------------------------------------------*/
171/*---------------------------------------------------------------------------*/
172
173ARCANE_END_NAMESPACE
174
175/*---------------------------------------------------------------------------*/
176/*---------------------------------------------------------------------------*/
177
178#endif
Proxy d'un type du langage.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
Opérations de comparaisons pour un type numérique T.
Definition Numeric.h:45
bool isZero(const BuiltInProxy< _Type > &a)
Teste si une valeur est exactement égale à zéro.
Type
Type of JSON value.
Definition rapidjson.h:665