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 /// Defines the double value
68 MODEL_EXPORT virtual void setValue(const double theValue);
70 /// Returns the double value
71 MODEL_EXPORT virtual double value();
73 /// Allows to set expression (text) as invalid (by the parameters listener)
74 MODEL_EXPORT virtual void setInvalid(const bool theFlag);
76 /// Returns true if text is invalid
77 MODEL_EXPORT virtual bool isInvalid();
80 /// Initializes attributes
81 Model_ExpressionDouble(TDF_Label& theLabel);
83 friend class Model_Data;
86 Handle_TDataStd_Real myReal; ///< double is Real attribute
90 /**\class Model_ExpressionInteger
92 * \brief Implementation of ModelAPI_ExpressionInteger.
94 class Model_ExpressionInteger :
95 public Model_Expression, // implementation inheritance
96 public ModelAPI_ExpressionInteger
99 /// Defines the integer value
100 MODEL_EXPORT virtual void setValue(const int theValue);
102 /// Returns the integer value
103 MODEL_EXPORT virtual int value();
105 /// Allows to set expression (text) as invalid (by the parameters listener)
106 MODEL_EXPORT virtual void setInvalid(const bool theFlag);
108 /// Returns true if text is invalid
109 MODEL_EXPORT virtual bool isInvalid();
112 /// Initializes attributes
113 Model_ExpressionInteger(TDF_Label& theLabel);
115 friend class Model_Data;
118 Handle_TDataStd_Integer myInteger;
121 #endif // Model_Expression_H_