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>
16 * \class ParametersPlugin_Parameter
18 * \brief Feature for parameter.
20 class ParametersPlugin_Parameter : public ModelAPI_Feature
23 virtual ~ParametersPlugin_Parameter();
26 inline static const std::string& ID()
28 static const std::string MY_PARAMETER_ID("Parameter");
29 return MY_PARAMETER_ID;
31 /// attribute of parameter name
32 inline static const std::string& VARIABLE_ID()
34 static const std::string MY_VARIABLE_ID("variable");
35 return MY_VARIABLE_ID;
37 /// attribute of parameter expression
38 inline static const std::string& EXPRESSION_ID()
40 static const std::string MY_EXPRESSION_ID("expression");
41 return MY_EXPRESSION_ID;
43 /// attribute of parameter expression error
44 inline static const std::string& EXPRESSION_ERROR_ID()
46 static const std::string MY_EXPRESSION_ERROR_ID("ExpressionError");
47 return MY_EXPRESSION_ERROR_ID;
49 /// list of references to the arguments of this expression
50 inline static const std::string& ARGUMENTS_ID()
52 static const std::string MY_ARGUMENTS_ID("arguments");
53 return MY_ARGUMENTS_ID;
56 /// return comment attribute Id
57 inline static const std::string& COMMENT_ID()
59 static const std::string MY_COMMENT_ID("comment");
63 /// Returns the kind of a feature
64 PARAMETERSPLUGIN_EXPORT virtual const std::string& getKind()
66 static std::string MY_KIND = ParametersPlugin_Parameter::ID();
70 /// Pre-execution is not needed for parameter
71 PARAMETERSPLUGIN_EXPORT virtual bool isPreviewNeeded() const;
73 /// Creates a parameter in document
74 PARAMETERSPLUGIN_EXPORT virtual void execute();
76 /// Request for initialization of data model of the feature: adding all attributes
77 PARAMETERSPLUGIN_EXPORT virtual void initAttributes();
79 /// Reimplemented from ModelAPI_Feature::isInHistory(). Returns false.
80 PARAMETERSPLUGIN_EXPORT virtual bool isInHistory();
82 /// Reimplemented from ModelAPI_Feature::isInHistory().
83 PARAMETERSPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
85 /// Use plugin manager for features creation
86 ParametersPlugin_Parameter();
89 /// Evaluates theExpression and returns its value.
90 double evaluate(const std::string& theExpression, std::string& theError);
91 /// Updates name of the parameter
93 /// Updates expression of the parameter
94 bool updateExpression();