Salome HOME
Merge branch 'Dev_1.2.0' of newgeom:newgeom.git into Dev_1.2.0
[modules/shaper.git] / src / ParametersPlugin / ParametersPlugin_Parameter.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        ParametersPlugin_Parameter.h
4 // Created:     23 MArch 2015
5 // Author:      sbh
6
7 #ifndef PARAMETERSPLUGIN_PARAMETER_H_
8 #define PARAMETERSPLUGIN_PARAMETER_H_
9
10 #include "ParametersPlugin.h"
11 #include <ModelAPI_Feature.h>
12
13 #include <memory>
14
15 class ParametersPlugin_PyInterp;
16
17 class ParametersPlugin_Parameter : public ModelAPI_Feature
18 {
19  public:
20   virtual ~ParametersPlugin_Parameter();
21
22   /// Extrusion kind
23   inline static const std::string& ID()
24   {
25     static const std::string MY_PARAMETER_ID("Parameter");
26     return MY_PARAMETER_ID;
27   }
28   /// attribute name of references sketch entities list, it should contain a sketch result or
29   /// a pair a sketch result to sketch face
30   inline static const std::string& VARIABLE_ID()
31   {
32     static const std::string MY_VARIABLE_ID("variable");
33     return MY_VARIABLE_ID;
34   }
35
36   /// attribute name of extrusion size
37   inline static const std::string& EXPRESSION_ID()
38   {
39     static const std::string MY_EXPRESSION_ID("expression");
40     return MY_EXPRESSION_ID;
41   }
42
43   /// Returns the kind of a feature
44   PARAMETERSPLUGIN_EXPORT virtual const std::string& getKind()
45   {
46     static std::string MY_KIND = ParametersPlugin_Parameter::ID();
47     return MY_KIND;
48   }
49
50   /// Creates a new part document if needed
51   PARAMETERSPLUGIN_EXPORT virtual void execute();
52
53   /// Request for initialization of data model of the feature: adding all attributes
54   PARAMETERSPLUGIN_EXPORT virtual void initAttributes();
55
56   PARAMETERSPLUGIN_EXPORT virtual bool isInHistory(); //false
57
58   PARAMETERSPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
59
60   /// Use plugin manager for features creation
61   ParametersPlugin_Parameter();
62
63  protected:
64   double evaluate(const std::string& theExpression, std::string& theError);
65
66  private:
67   std::shared_ptr<ParametersPlugin_PyInterp> myInterp;
68 };
69
70 #endif