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_Name.hxx>
16 #include <TDataStd_Real.hxx>
18 #include <TDF_Label.hxx>
20 /**\class Model_Expression
22 * \brief Implementation of ModelAPI_Expression.
24 class Model_Expression : public ModelAPI_Expression
26 Handle_TDataStd_Real myReal; ///< double is Real attribute
27 Handle_TDataStd_Name myText; ///< Text representation of the attribute (may differ for parameters)
28 Handle_TDataStd_Comment myError; ///< Error of expression of the text attribute
29 Handle_TDataStd_ExtStringList myUsedParameters; ///< Parameters used in expression
31 /// Defines the double value
32 MODEL_EXPORT virtual void setValue(const double theValue);
34 /// Returns the double value
35 MODEL_EXPORT virtual double value();
37 /// Sets the text of this Expression
38 MODEL_EXPORT virtual void setText(const std::string& theText);
40 /// Returns the text of this Expression
41 MODEL_EXPORT virtual std::string text() const;
43 /// Allows to set expression (text) as invalid (by the parameters listener)
44 MODEL_EXPORT virtual void setInvalid(const bool theFlag);
46 /// Returns true if text is invalid
47 MODEL_EXPORT virtual bool isInvalid();
49 /// Allows to set expression (text) error (by the parameters listener)
50 MODEL_EXPORT virtual void setError(const std::string& theError);
52 /// Returns an expression error
53 MODEL_EXPORT virtual std::string error();
55 /// Defines the used parameters (by the parameters listener)
56 MODEL_EXPORT virtual void setUsedParameters(const std::set<std::string>& theUsedParameters);
58 /// Returns the used parameters
59 MODEL_EXPORT virtual std::set<std::string> usedParameters() const;
62 /// Initializes attributes
63 Model_Expression(TDF_Label& theLabel);
65 friend class Model_Data;