1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: ParametersPlugin_Parameter.h
4 // Created: 23 MArch 2015
7 #ifndef PARAMETERSPLUGIN_PARAMETER_H_
8 #define PARAMETERSPLUGIN_PARAMETER_H_
10 #include "ParametersPlugin.h"
11 #include <ModelAPI_Feature.h>
15 class ParametersPlugin_PyInterp;
18 * \class ParametersPlugin_Parameter
20 * \brief Feature for parameter.
22 class ParametersPlugin_Parameter : public ModelAPI_Feature
25 virtual ~ParametersPlugin_Parameter();
28 inline static const std::string& ID()
30 static const std::string MY_PARAMETER_ID("Parameter");
31 return MY_PARAMETER_ID;
33 /// attribute of parameter name
34 inline static const std::string& VARIABLE_ID()
36 static const std::string MY_VARIABLE_ID("variable");
37 return MY_VARIABLE_ID;
39 /// attribute of parameter expression
40 inline static const std::string& EXPRESSION_ID()
42 static const std::string MY_EXPRESSION_ID("expression");
43 return MY_EXPRESSION_ID;
45 /// attribute of parameter expression error
46 inline static const std::string& EXPRESSION_ERROR_ID()
48 static const std::string MY_EXPRESSION_ERROR_ID("ExpressionError");
49 return MY_EXPRESSION_ERROR_ID;
51 /// list of references to the arguments of this expression
52 inline static const std::string& ARGUMENTS_ID()
54 static const std::string MY_ARGUMENTS_ID("arguments");
55 return MY_ARGUMENTS_ID;
58 /// return comment attribute Id
59 inline static const std::string& COMMENT_ID()
61 static const std::string MY_COMMENT_ID("comment");
65 /// Returns the kind of a feature
66 PARAMETERSPLUGIN_EXPORT virtual const std::string& getKind()
68 static std::string MY_KIND = ParametersPlugin_Parameter::ID();
72 /// Pre-execution is not needed for parameter
73 PARAMETERSPLUGIN_EXPORT virtual bool isPreviewNeeded() const;
75 /// Creates a parameter in document
76 PARAMETERSPLUGIN_EXPORT virtual void execute();
78 /// Request for initialization of data model of the feature: adding all attributes
79 PARAMETERSPLUGIN_EXPORT virtual void initAttributes();
81 /// Reimplemented from ModelAPI_Feature::isInHistory(). Returns false.
82 PARAMETERSPLUGIN_EXPORT virtual bool isInHistory();
84 /// Reimplemented from ModelAPI_Feature::isInHistory().
85 PARAMETERSPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
87 /// Use plugin manager for features creation
88 ParametersPlugin_Parameter();
91 /// Evaluates theExpression and returns its value.
92 double evaluate(const std::string& theExpression, std::string& theError);
93 /// Updates name of the parameter
95 /// Updates expression of the parameter
96 bool updateExpression();
99 std::shared_ptr<ParametersPlugin_PyInterp> myInterp;