1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: Model_Expression.h
5 // Author: Sergey POKHODENKO
7 #ifndef Model_Expression_H_
8 #define Model_Expression_H_
11 #include "ModelAPI_Expression.h"
13 #include <TDataStd_Comment.hxx>
14 #include <TDataStd_ExtStringList.hxx>
15 #include <TDataStd_Integer.hxx>
16 #include <TDataStd_Name.hxx>
17 #include <TDataStd_Real.hxx>
19 #include <TDF_Label.hxx>
21 /**\class Model_Expression
23 * \brief Implementation of ModelAPI_Expression.
25 class Model_Expression : public virtual ModelAPI_Expression
28 /// Sets the text of this Expression
29 MODEL_EXPORT virtual void setText(const std::string& theText);
31 /// Returns the text of this Expression
32 MODEL_EXPORT virtual std::string text() const;
34 /// Allows to set expression (text) error (by the parameters listener)
35 MODEL_EXPORT virtual void setError(const std::string& theError);
37 /// Returns an expression error
38 MODEL_EXPORT virtual std::string error();
40 /// Defines the used parameters (by the parameters listener)
41 MODEL_EXPORT virtual void setUsedParameters(const std::set<std::string>& theUsedParameters);
43 /// Returns the used parameters
44 MODEL_EXPORT virtual std::set<std::string> usedParameters() const;
47 /// Initializes attributes
48 Model_Expression(TDF_Label& theLabel);
50 Handle_TDataStd_Name myText; ///< Text representation of the attribute (may differ for parameters)
51 Handle_TDataStd_Comment myError; ///< Error of expression of the text attribute
52 Handle_TDataStd_ExtStringList myUsedParameters; ///< Parameters used in expression
54 friend class Model_Data;
58 /**\class Model_ExpressionDouble
60 * \brief Implementation of ModelAPI_ExpressionDouble.
62 class Model_ExpressionDouble :
63 public Model_Expression, // implementation inheritance
64 public ModelAPI_ExpressionDouble
67 /// Sets the text of this Expression
68 MODEL_EXPORT virtual void setText(const std::string& theText) {
69 Model_Expression::setText(theText);
72 /// Returns the text of this Expression
73 MODEL_EXPORT virtual std::string text() const {
74 return Model_Expression::text();
77 /// Allows to set expression (text) error (by the parameters listener)
78 MODEL_EXPORT virtual void setError(const std::string& theError) {
79 Model_Expression::setError(theError);
82 /// Returns an expression error
83 MODEL_EXPORT virtual std::string error() {
84 return Model_Expression::error();
87 /// Defines the used parameters (by the parameters listener)
88 MODEL_EXPORT virtual void setUsedParameters(const std::set<std::string>& theUsedParameters) {
89 Model_Expression::setUsedParameters(theUsedParameters);
92 /// Returns the used parameters
93 MODEL_EXPORT virtual std::set<std::string> usedParameters() const {
94 return Model_Expression::usedParameters();
97 /// Defines the double value
98 MODEL_EXPORT virtual void setValue(const double theValue);
100 /// Returns the double value
101 MODEL_EXPORT virtual double value();
103 /// Allows to set expression (text) as invalid (by the parameters listener)
104 MODEL_EXPORT virtual void setInvalid(const bool theFlag);
106 /// Returns true if text is invalid
107 MODEL_EXPORT virtual bool isInvalid();
110 /// Initializes attributes
111 Model_ExpressionDouble(TDF_Label& theLabel);
113 friend class Model_Data;
116 Handle_TDataStd_Real myReal; ///< double is Real attribute
120 /**\class Model_ExpressionInteger
122 * \brief Implementation of ModelAPI_ExpressionInteger.
124 class Model_ExpressionInteger :
125 public Model_Expression, // implementation inheritance
126 public ModelAPI_ExpressionInteger
129 /// Sets the text of this Expression
130 MODEL_EXPORT virtual void setText(const std::string& theText) {
131 Model_Expression::setText(theText);
134 /// Returns the text of this Expression
135 MODEL_EXPORT virtual std::string text() const {
136 return Model_Expression::text();
139 /// Allows to set expression (text) error (by the parameters listener)
140 MODEL_EXPORT virtual void setError(const std::string& theError) {
141 Model_Expression::setError(theError);
144 /// Returns an expression error
145 MODEL_EXPORT virtual std::string error() {
146 return Model_Expression::error();
149 /// Defines the used parameters (by the parameters listener)
150 MODEL_EXPORT virtual void setUsedParameters(const std::set<std::string>& theUsedParameters) {
151 Model_Expression::setUsedParameters(theUsedParameters);
154 /// Returns the used parameters
155 MODEL_EXPORT virtual std::set<std::string> usedParameters() const {
156 return Model_Expression::usedParameters();
159 /// Defines the integer value
160 MODEL_EXPORT virtual void setValue(const int theValue);
162 /// Returns the integer value
163 MODEL_EXPORT virtual int value();
165 /// Allows to set expression (text) as invalid (by the parameters listener)
166 MODEL_EXPORT virtual void setInvalid(const bool theFlag);
168 /// Returns true if text is invalid
169 MODEL_EXPORT virtual bool isInvalid();
172 /// Initializes attributes
173 Model_ExpressionInteger(TDF_Label& theLabel);
175 friend class Model_Data;
178 Handle_TDataStd_Integer myInteger;
181 #endif // Model_Expression_H_