Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Properties.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 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/* Properties.h (C) 2000-2025 */
9/* */
10/* List of properties. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_PROPERTIES_H
13#define ARCANE_CORE_PROPERTIES_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18#include "arcane/utils/AutoRef.h"
19#include "arcane/core/SharedReference.h"
21
22/*---------------------------------------------------------------------------*/
23/*---------------------------------------------------------------------------*/
24
25namespace Arcane
26{
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
31class PropertiesImpl;
32class IPropertyMng;
33
35: public SharedReference
36{
37};
38
39/*---------------------------------------------------------------------------*/
40/*---------------------------------------------------------------------------*/
41
64class ARCANE_CORE_EXPORT Properties
65{
66 public:
67
70
72 Properties(const Properties& parent_property, const String& name);
73
75 Properties(const Properties& rhs);
77 const Properties& operator=(const Properties& rhs);
79 virtual ~Properties();
80
81 public:
82
84 void setBool(const String& name, bool value);
85
87 void set(const String& name, bool value);
88
90 bool getBool(const String& name) const;
91
93 bool getBoolWithDefault(const String& name, bool default_value) const;
94
96 bool get(const String& name, bool& value) const;
97
99 void setInt32(const String& name, Int32 value);
100
102 void set(const String& name, Int32 value);
103
105 Int32 getInt32(const String& name) const;
106
108 Int32 getInt32WithDefault(const String& name, Int32 default_value) const;
109
111 bool get(const String& name, Int32& value) const;
112
114 void setInt64(const String& name, Int64 value);
115
117 void set(const String& name, Int64 value);
118
120 Int64 getInt64(const String& name) const;
121
123 Int64 getInt64WithDefault(const String& name, Int64 default_value) const;
124
126 bool get(const String& name, Int64& value) const;
127
129 void setInteger(const String& name, Integer value);
130
132 Integer getInteger(const String& name) const;
133
135 Integer getIntegerWithDefault(const String& name, Integer default_value) const;
136
138 void setReal(const String& name, Real value);
139
141 void set(const String& name, Real value);
142
144 Real getReal(const String& name) const;
145
147 Real getRealWithDefault(const String& name, Real default_value) const;
148
150 bool get(const String& name, Real& value) const;
151
153 void setString(const String& name, const String& value);
154
156 void set(const String& name, const String& value);
157
159 String getString(const String& name) const;
160
162 String getStringWithDefault(const String& name, const String& default_value) const;
163
165 bool get(const String& name, String& value) const;
166
168 void set(const String& name, BoolConstArrayView value);
169
171 void get(const String& name, BoolArray& value) const;
172
174 void set(const String& name, Int32ConstArrayView value);
175
177 void get(const String& name, Int32Array& value) const;
178
180 void set(const String& name, Int64ConstArrayView value);
181
183 void get(const String& name, Int64Array& value) const;
184
186 void set(const String& name, RealConstArrayView value);
187
189 void get(const String& name, RealArray& value) const;
190
192 void set(const String& name, StringConstArrayView value);
193
195 void get(const String& name, StringArray& value) const;
196
197 public:
198
200 void print(std::ostream& o) const;
201
203 void serialize(ISerializer* serializer);
204
206 const String& name() const;
207
209 const String& fullName() const;
210
211 IPropertyMng* propertyMng() const;
212
216 void destroy();
217
219 PropertiesImpl* impl() const { return m_p; }
220
222 PropertiesImplBase* baseImpl() const { return m_ref.get(); }
223
224 private:
225
226 PropertiesImpl* m_p;
228
229 private:
230
232};
233
234/*---------------------------------------------------------------------------*/
235/*---------------------------------------------------------------------------*/
236
237} // End namespace Arcane
238
239/*---------------------------------------------------------------------------*/
240/*---------------------------------------------------------------------------*/
241
242#endif
Declarations of Arcane's general types.
Declarations of types used in Arcane.
Encapsulation of a pointer with a reference counter.
Definition AutoRef.h:43
Interface of the property manager.
List of properties.
Definition Properties.h:65
Int64 getInt64(const String &name) const
Value of the property named name.
bool get(const String &name, bool &value) const
Value of the property named name.
PropertiesImplBase * baseImpl() const
Definition Properties.h:222
bool getBoolWithDefault(const String &name, bool default_value) const
Value of the property named name.
const String & name() const
Name of the property.
Int32 getInt32WithDefault(const String &name, Int32 default_value) const
Value of the property named name.
Int32 getInt32(const String &name) const
Value of the property named name.
Integer getInteger(const String &name) const
Value of the property named name.
Integer getIntegerWithDefault(const String &name, Integer default_value) const
Value of the property named name.
bool getBool(const String &name) const
Value of the property named name.
void setInteger(const String &name, Integer value)
Sets an Integer property of name name and value value.
void setInt64(const String &name, Int64 value)
Sets an Int64 property of name name and value value.
void destroy()
Destroys the associated values of properties linked to this reference.
PropertiesImpl * impl() const
Definition Properties.h:219
Real getReal(const String &name) const
Value of the property named name.
void setInt32(const String &name, Int32 value)
Sets an Int32 property of name name and value value.
Int64 getInt64WithDefault(const String &name, Int64 default_value) const
Value of the property named name.
void set(const String &name, bool value)
Sets a boolean property of name name and value value.
String getString(const String &name) const
Value of the property named name.
Real getRealWithDefault(const String &name, Real default_value) const
Value of the property named name.
const Properties & operator=(const Properties &rhs)
Copy assignment operator.
String getStringWithDefault(const String &name, const String &default_value) const
Value of the property named name.
void serialize(ISerializer *serializer)
Performs the serialization of the properties.
Properties(IPropertyMng *pm, const String &name)
Creates or retrieves a list of properties with name name.
void setBool(const String &name, bool value)
Sets a boolean property of name name and value value.
void setString(const String &name, const String &value)
Sets a String property of name name and value value.
const String & fullName() const
Full name of the property.
void print(std::ostream &o) const
Prints the properties and their values to the stream o.
void setReal(const String &name, Real value)
Sets a Real property of name name and value value.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Array< Int64 > Int64Array
Dynamic one-dimensional array of 64-bit integers.
Definition UtilsTypes.h:125
ConstArrayView< String > StringConstArrayView
C equivalent of a 1D array of strings.
Definition UtilsTypes.h:492
Array< String > StringArray
Dynamic one-dimensional array of strings.
Definition UtilsTypes.h:145
Array< bool > BoolArray
Dynamic one-dimensional array of booleans.
Definition UtilsTypes.h:143
std::int64_t Int64
Signed integer type of 64 bits.
Int32 Integer
Type representing an integer.
ConstArrayView< Int32 > Int32ConstArrayView
C equivalent of a 1D array of 32-bit integers.
Definition UtilsTypes.h:482
ConstArrayView< bool > BoolConstArrayView
C equivalent of a 1D array of booleans.
Definition UtilsTypes.h:490
ConstArrayView< Int64 > Int64ConstArrayView
C equivalent of a 1D array of 64-bit integers.
Definition UtilsTypes.h:480
double Real
Type representing a real number.
Array< Int32 > Int32Array
Dynamic one-dimensional array of 32-bit integers.
Definition UtilsTypes.h:127
Array< Real > RealArray
Dynamic one-dimensional array of reals.
Definition UtilsTypes.h:135
std::int32_t Int32
Signed integer type of 32 bits.
ConstArrayView< Real > RealConstArrayView
C equivalent of a 1D array of reals.
Definition UtilsTypes.h:488