Arcane  v3.14.10.0
Documentation utilisateur
Chargement...
Recherche...
Aucune correspondance
SimpleProperty.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/* SimpleProperty.h (C) 2000-2015 */
9/* */
10/* Implémentation basique d'une propriété. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_SIMPLEPROPERTY_H
13#define ARCANE_SIMPLEPROPERTY_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17
19
20#include "arcane/utils/String.h"
21
22/*---------------------------------------------------------------------------*/
23/*---------------------------------------------------------------------------*/
24
25ARCANE_BEGIN_NAMESPACE
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
30template<class T>
32{
33 public:
34 typedef const T& ConstReferenceType;
35 typedef T& ReferenceType;
36 typedef T ValueType;
37};
38
39/*---------------------------------------------------------------------------*/
40/*---------------------------------------------------------------------------*/
41
42template<>
44{
45 public:
46 typedef const String& ConstReferenceType;
47 typedef String& ReferenceType;
48 typedef String ValueType;
49};
50
51/*---------------------------------------------------------------------------*/
52/*---------------------------------------------------------------------------*/
53/*!
54 * \internal
55 * \brief Implémentation basique d'une propriété en lecture seule.
56 */
57template<class T>
59{
60 public:
61
62 typedef typename SimplePropertyTraitsT<T>::ConstReferenceType ConstReferenceType;
63 typedef typename SimplePropertyTraitsT<T>::ReferenceType ReferenceType;
64 typedef typename SimplePropertyTraitsT<T>::ValueType ValueType;
65
66 public:
67
68 SimpleReadOnlyPropertyT() : m_value(T()) {}
69 SimpleReadOnlyPropertyT(ConstReferenceType v) : m_value(v) {}
70
71 public:
72
73 ConstReferenceType get() const { return m_value; }
74
75 protected:
76
77 ValueType m_value;
78};
79
80/*---------------------------------------------------------------------------*/
81/*---------------------------------------------------------------------------*/
82/*!
83 * \internal
84 * \brief Implémentation basique d'une propriété.
85 */
86template<class T>
89{
90 public:
91
92 typedef typename SimplePropertyTraitsT<T>::ConstReferenceType ConstReferenceType;
93 typedef typename SimplePropertyTraitsT<T>::ReferenceType ReferenceType;
94 typedef typename SimplePropertyTraitsT<T>::ValueType ValueType;
95
96 public:
97
99 SimplePropertyT(ConstReferenceType v) : SimpleReadOnlyPropertyT<T>(v) {}
100
101 public:
102
103 inline ConstReferenceType get() const { return this->m_value; }
104 inline ReferenceType get() { return this->m_value; }
105 inline void put(ConstReferenceType v) { this->m_value = v; }
106};
107
108/*---------------------------------------------------------------------------*/
109/*---------------------------------------------------------------------------*/
110
111ARCANE_END_NAMESPACE
112
113/*---------------------------------------------------------------------------*/
114/*---------------------------------------------------------------------------*/
115
116#endif
117
Fichier de configuration d'Arcane.
Chaîne de caractères unicode.