Salome HOME
2c140b63b11865a2ee5000e738549ce057657be4
[modules/shaper.git] / src / ModelAPI / ModelAPI_Expression.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModelAPI_Expression.h
4 // Created:     5 Aug 2015
5 // Author:      Sergey POKHODENKO
6
7 #ifndef ModelAPI_Expression_H_
8 #define ModelAPI_Expression_H_
9
10 #include "ModelAPI.h"
11 #include <memory>
12 #include <set>
13 #include <string>
14
15 /**\class ModelAPI_Expression
16  * \ingroup DataModel
17  * \brief Expression for calculated values.
18  */
19 class ModelAPI_Expression
20 {
21  protected:
22   bool myIsInitialized; ///< is some value assigned to this attribute
23
24  public:
25   /// To virtually destroy the fields of successors
26   MODELAPI_EXPORT virtual ~ModelAPI_Expression();
27
28   /// Returns true if attribute was initialized by some value
29   MODELAPI_EXPORT virtual bool isInitialized();
30
31   /// Makes attribute initialized
32   MODELAPI_EXPORT virtual void setInitialized();
33
34   /// Defines the double value
35   MODELAPI_EXPORT virtual void setValue(const double theValue) = 0;
36
37   /// Returns the double value
38   MODELAPI_EXPORT virtual double value() = 0;
39
40   /// Sets the text of this Expression
41   MODELAPI_EXPORT virtual void setText(const std::string& theText) = 0;
42
43   /// Returns the text of this Expression
44   MODELAPI_EXPORT virtual std::string text() const = 0;
45
46   /// Allows to set expression (text) as invalid (by the parameters listener)
47   MODELAPI_EXPORT virtual void setInvalid(const bool theFlag) = 0;
48
49   /// Returns true if text is invalid
50   MODELAPI_EXPORT virtual bool isInvalid() = 0;
51
52   /// Allows to set expression (text) error (by the parameters listener)
53   MODELAPI_EXPORT virtual void setError(const std::string& theError) = 0;
54
55   /// Returns an expression error
56   MODELAPI_EXPORT virtual std::string error() = 0;
57
58   /// Defines the used parameters (by the parameters listener)
59   MODELAPI_EXPORT virtual void setUsedParameters(const std::set<std::string>& theUsedParameters) = 0;
60
61   /// Returns the used parameters
62   MODELAPI_EXPORT virtual std::set<std::string> usedParameters() const = 0;
63
64  protected:
65   /// Objects are created for features automatically
66   MODELAPI_EXPORT ModelAPI_Expression();
67
68   friend class Model_Data;
69 };
70
71 //! Pointer on Expression object
72 typedef std::shared_ptr<ModelAPI_Expression> ExpressionPtr;
73
74 #endif