1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModelAPI_Expression.h
5 // Author: Sergey POKHODENKO
7 #ifndef ModelAPI_Expression_H_
8 #define ModelAPI_Expression_H_
15 /**\class ModelAPI_Expression
17 * \brief Expression for calculated values.
19 class ModelAPI_Expression
22 bool myIsInitialized; ///< is some value assigned to this attribute
25 /// To virtually destroy the fields of successors
26 MODELAPI_EXPORT virtual ~ModelAPI_Expression();
28 /// Returns true if attribute was initialized by some value
29 MODELAPI_EXPORT virtual bool isInitialized();
31 /// Makes attribute initialized
32 MODELAPI_EXPORT virtual void setInitialized();
34 /// Defines the double value
35 MODELAPI_EXPORT virtual void setValue(const double theValue) = 0;
37 /// Returns the double value
38 MODELAPI_EXPORT virtual double value() = 0;
40 /// Sets the text of this Expression
41 MODELAPI_EXPORT virtual void setText(const std::string& theText) = 0;
43 /// Returns the text of this Expression
44 MODELAPI_EXPORT virtual std::string text() const = 0;
46 /// Allows to set expression (text) as invalid (by the parameters listener)
47 MODELAPI_EXPORT virtual void setInvalid(const bool theFlag) = 0;
49 /// Returns true if text is invalid
50 MODELAPI_EXPORT virtual bool isInvalid() = 0;
52 /// Allows to set expression (text) error (by the parameters listener)
53 MODELAPI_EXPORT virtual void setError(const std::string& theError) = 0;
55 /// Returns an expression error
56 MODELAPI_EXPORT virtual std::string error() = 0;
58 /// Defines the used parameters (by the parameters listener)
59 MODELAPI_EXPORT virtual void setUsedParameters(const std::set<std::string>& theUsedParameters) = 0;
61 /// Returns the used parameters
62 MODELAPI_EXPORT virtual std::set<std::string> usedParameters() const = 0;
65 /// Objects are created for features automatically
66 MODELAPI_EXPORT ModelAPI_Expression();
68 friend class Model_Data;
71 //! Pointer on Expression object
72 typedef std::shared_ptr<ModelAPI_Expression> ExpressionPtr;