Salome HOME
Correctly manage the invalid expressions
[modules/shaper.git] / src / Model / Model_AttributeDouble.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        Model_AttributeDouble.h
4 // Created:     2 Apr 2014
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef Model_AttributeDouble_H_
8 #define Model_AttributeDouble_H_
9
10 #include "Model.h"
11 #include "ModelAPI_AttributeDouble.h"
12 #include <TDataStd_Real.hxx>
13 #include <TDF_Label.hxx>
14
15 #include <TDataStd_Name.hxx>
16
17 /**\class Model_AttributeDouble
18  * \ingroup DataModel
19  * \brief Attribute that contains real value with double precision.
20  */
21
22 class Model_AttributeDouble : public ModelAPI_AttributeDouble
23 {
24   Handle_TDataStd_Real myReal;  ///< double is Real attribute
25   Handle_TDataStd_Name myText;  ///< Text representation of the attribute (may differ for parametres)
26  public:
27   /// Defines the double value
28   MODEL_EXPORT virtual void setValue(const double theValue);
29
30   /// Returns the double value
31   MODEL_EXPORT virtual double value();
32
33   /// Defines the double value
34   MODEL_EXPORT virtual void setText(const std::string& theText);
35
36   /// Returns the double value
37   MODEL_EXPORT virtual std::string text();
38
39   /// Allows to set expression (text) as invalid (by the parameters listener)
40   MODEL_EXPORT virtual void setExpressionInvalid(const bool theFlag);
41
42   /// Returns true if text is invalid
43   MODEL_EXPORT virtual bool expressionInvalid();
44
45  protected:
46   /// Initializes attibutes
47   Model_AttributeDouble(TDF_Label& theLabel);
48
49   friend class Model_Data;
50 };
51
52 #endif