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