Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
CaseOptionBase.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/* CaseOptionBase.h (C) 2000-2025 */
9/* */
10/* Base class for a data set option. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CASEOPTIONBASE_H
13#define ARCANE_CASEOPTIONBASE_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/String.h"
18
19#include "arcane/core/XmlNode.h"
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24namespace Arcane
25{
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
31class ICaseDocument;
33class ICaseMng;
34class ICaseOptionList;
35class ISubDomain;
36class ICaseFunction;
39
40/*---------------------------------------------------------------------------*/
41/*---------------------------------------------------------------------------*/
42
50class ARCANE_CORE_EXPORT CaseOptionBase
51{
52 protected:
53
54 CaseOptionBase(const CaseOptionBuildInfo& cob);
55
56 public:
57
58 virtual ~CaseOptionBase();
59
60 public:
61
63 String trueName() const;
64
66 String name() const;
67
69 String translatedName(const String& lang) const;
70
72 void search(bool is_phase1);
73
75 virtual void print(const String& lang, std::ostream& o) const = 0;
76
78 ICaseMng* caseMng() const;
79
82
84 ITraceMng* traceMng() const;
85
87 ARCCORE_DEPRECATED_2019("Do not use subDomain(). Try to get subDomain from an other way.")
88 ISubDomain* subDomain() const;
89
91 ARCANE_DEPRECATED_REASON("Y2023: use caseMng()->caseDocument() instead.")
93
96
98 void setRootElement(const XmlNode& root_element);
99
101 XmlNode rootElement() const;
102
104 virtual ICaseFunction* function() const = 0;
105
107 Integer minOccurs() const;
108
110 Integer maxOccurs() const;
111
113 bool isOptional() const;
114
122 virtual void updateFromFunction(Real current_time, Integer current_iteration) = 0;
123
131 void addAlternativeNodeName(const String& lang, const String& name);
132
134 void addDefaultValue(const String& category, const String& value);
135
137 virtual void visit(ICaseDocumentVisitor* visitor) const = 0;
138
140 void checkIsInitialized() const { _checkIsInitialized(); }
141
142 protected:
143
145 String _defaultValue() const;
146
147 void _setDefaultValue(const String& def_value);
148
149 protected:
150
151 virtual void _search(bool is_phase1) = 0;
152 void _setIsInitialized();
153 bool _isInitialized() const;
154 void _checkIsInitialized() const;
155 void _checkMinMaxOccurs(Integer nb_occur);
156 String _xpathFullName() const;
157
158 private:
159
161
162 private:
163
164 void _setTranslatedName();
165 void _setCategoryDefaultValue();
171 CaseOptionBase(const CaseOptionBase& from) = delete;
173 CaseOptionBase& operator=(const CaseOptionBase& from) = delete;
174};
175
176/*---------------------------------------------------------------------------*/
177/*---------------------------------------------------------------------------*/
178
179} // End namespace Arcane
180
181/*---------------------------------------------------------------------------*/
182/*---------------------------------------------------------------------------*/
183
184#endif
Implementation of the base class for a data set option.
String name() const
Returns the option name corresponding to the data set language.
String translatedName(const String &lang) const
Name of the option in the language lang. Returns name() if no translation exists.
void addDefaultValue(const String &category, const String &value)
Adds the default value value to the category category.
CaseOptionBase(const CaseOptionBase &from)=delete
Copy constructor.
ICaseDocument * caseDocument() const
Returns the document manager.
virtual void visit(ICaseDocumentVisitor *visitor) const =0
Applies the visitor to this option.
void search(bool is_phase1)
Retrieves the value from the configuration file for the variable.
void checkIsInitialized() const
Throws an exception if the option has not been initialized.
ICaseMng * caseMng() const
Case manager.
ICaseDocumentFragment * caseDocumentFragment() const
Returns the document associated with this option.
void addAlternativeNodeName(const String &lang, const String &name)
Adds a translation for the option name.
void setRootElement(const XmlNode &root_element)
Positions the root element at root_element.
bool isOptional() const
Allows knowing if an option is optional.
Integer maxOccurs() const
Maximum number of occurrences (for a multiple option) (-1 == unbounded).
XmlNode rootElement() const
Returns the root element of the DOM.
virtual ICaseFunction * function() const =0
Returns the function linked to this option or nullptr if none exists.
virtual void updateFromFunction(Real current_time, Integer current_iteration)=0
Updates the option value from a function.
ITraceMng * traceMng() const
Trace manager.
CaseOptionBasePrivate * m_p
Implementation.
ISubDomain * subDomain() const
Sub-domain manager.
String trueName() const
Returns the true name (untranslated) of the option.
ICaseOptionList * parentOptionList() const
Parent OptionList.
Integer minOccurs() const
Minimum number of occurrences (for a multiple option).
virtual void print(const String &lang, std::ostream &o) const =0
Prints the option value in the language lang, to the stream o.
CaseOptionBase & operator=(const CaseOptionBase &from)=delete
Copy assignment operator.
Information for building a dataset option.
Interface of a part of a dataset.
Visitor interface for a dataset option.
Interface of a class managing an XML document of the dataset.
Interface of a dataset function.
Case manager interface.
Definition ICaseMng.h:57
Interface for a data set options list.
Interface of the subdomain manager.
Definition ISubDomain.h:75
Node of a DOM tree.
Definition XmlNode.h:51
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.
double Real
Type representing a real number.