1 // Copyright (C) 2014-2019 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef PARAMETERSPLUGIN_PARAMETER_H_
21 #define PARAMETERSPLUGIN_PARAMETER_H_
23 #include "ParametersPlugin.h"
24 #include <ModelAPI_Feature.h>
29 * \class ParametersPlugin_Parameter
31 * \brief Feature for parameter.
33 class ParametersPlugin_Parameter : public ModelAPI_Feature
36 virtual ~ParametersPlugin_Parameter();
39 inline static const std::string& ID()
41 static const std::string MY_PARAMETER_ID("Parameter");
42 return MY_PARAMETER_ID;
44 /// attribute of parameter name
45 inline static const std::string& VARIABLE_ID()
47 static const std::string MY_VARIABLE_ID("variable");
48 return MY_VARIABLE_ID;
50 /// attribute of parameter expression
51 inline static const std::string& EXPRESSION_ID()
53 static const std::string MY_EXPRESSION_ID("expression");
54 return MY_EXPRESSION_ID;
56 /// attribute of parameter expression error
57 inline static const std::string& EXPRESSION_ERROR_ID()
59 static const std::string MY_EXPRESSION_ERROR_ID("ExpressionError");
60 return MY_EXPRESSION_ERROR_ID;
62 /// list of references to the arguments of this expression
63 inline static const std::string& ARGUMENTS_ID()
65 static const std::string MY_ARGUMENTS_ID("arguments");
66 return MY_ARGUMENTS_ID;
69 /// return comment attribute Id
70 inline static const std::string& COMMENT_ID()
72 static const std::string MY_COMMENT_ID("comment");
76 /// Returns the kind of a feature
77 PARAMETERSPLUGIN_EXPORT virtual const std::string& getKind()
79 static std::string MY_KIND = ParametersPlugin_Parameter::ID();
83 /// Pre-execution is not needed for parameter
84 PARAMETERSPLUGIN_EXPORT virtual bool isPreviewNeeded() const;
86 /// Creates a parameter in document
87 PARAMETERSPLUGIN_EXPORT virtual void execute();
89 /// Request for initialization of data model of the feature: adding all attributes
90 PARAMETERSPLUGIN_EXPORT virtual void initAttributes();
92 /// Reimplemented from ModelAPI_Feature::isInHistory(). Returns false.
93 PARAMETERSPLUGIN_EXPORT virtual bool isInHistory();
95 /// Reimplemented from ModelAPI_Feature::isInHistory().
96 PARAMETERSPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
98 /// Use plugin manager for features creation
99 ParametersPlugin_Parameter();
102 /// Evaluates theExpression and returns its value.
103 double evaluate(const std::string& theExpression, std::string& theError);
104 /// Updates name of the parameter
106 /// Updates expression of the parameter
107 bool updateExpression();