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 /// Returns the kind of a feature
59 PARAMETERSPLUGIN_EXPORT virtual const std::string& getKind()
61 static std::string MY_KIND = ParametersPlugin_Parameter::ID();
65 /// Pre-execution is not needed for parameter
66 PARAMETERSPLUGIN_EXPORT virtual bool isPreviewNeeded() const;
68 /// Creates a parameter in document
69 PARAMETERSPLUGIN_EXPORT virtual void execute();
71 /// Request for initialization of data model of the feature: adding all attributes
72 PARAMETERSPLUGIN_EXPORT virtual void initAttributes();
74 /// Reimplemented from ModelAPI_Feature::isInHistory(). Returns false.
75 PARAMETERSPLUGIN_EXPORT virtual bool isInHistory();
77 /// Reimplemented from ModelAPI_Feature::isInHistory().
78 PARAMETERSPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
80 /// Use plugin manager for features creation
81 ParametersPlugin_Parameter();
84 /// Evaluates theExpression and returns its value.
85 double evaluate(const std::string& theExpression, std::string& theError);
86 /// Updates name of the parameter
88 /// Updates expression of the parameter
89 void updateExpression();
92 std::shared_ptr<ParametersPlugin_PyInterp> myInterp;