1 // Copyright (C) 2014-2017 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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef PARAMETERSPLUGIN_PARAMETER_H_
22 #define PARAMETERSPLUGIN_PARAMETER_H_
24 #include "ParametersPlugin.h"
25 #include <ModelAPI_Feature.h>
30 * \class ParametersPlugin_Parameter
32 * \brief Feature for parameter.
34 class ParametersPlugin_Parameter : public ModelAPI_Feature
37 virtual ~ParametersPlugin_Parameter();
40 inline static const std::string& ID()
42 static const std::string MY_PARAMETER_ID("Parameter");
43 return MY_PARAMETER_ID;
45 /// attribute of parameter name
46 inline static const std::string& VARIABLE_ID()
48 static const std::string MY_VARIABLE_ID("variable");
49 return MY_VARIABLE_ID;
51 /// attribute of parameter expression
52 inline static const std::string& EXPRESSION_ID()
54 static const std::string MY_EXPRESSION_ID("expression");
55 return MY_EXPRESSION_ID;
57 /// attribute of parameter expression error
58 inline static const std::string& EXPRESSION_ERROR_ID()
60 static const std::string MY_EXPRESSION_ERROR_ID("ExpressionError");
61 return MY_EXPRESSION_ERROR_ID;
63 /// list of references to the arguments of this expression
64 inline static const std::string& ARGUMENTS_ID()
66 static const std::string MY_ARGUMENTS_ID("arguments");
67 return MY_ARGUMENTS_ID;
70 /// return comment attribute Id
71 inline static const std::string& COMMENT_ID()
73 static const std::string MY_COMMENT_ID("comment");
77 /// Returns the kind of a feature
78 PARAMETERSPLUGIN_EXPORT virtual const std::string& getKind()
80 static std::string MY_KIND = ParametersPlugin_Parameter::ID();
84 /// Pre-execution is not needed for parameter
85 PARAMETERSPLUGIN_EXPORT virtual bool isPreviewNeeded() const;
87 /// Creates a parameter in document
88 PARAMETERSPLUGIN_EXPORT virtual void execute();
90 /// Request for initialization of data model of the feature: adding all attributes
91 PARAMETERSPLUGIN_EXPORT virtual void initAttributes();
93 /// Reimplemented from ModelAPI_Feature::isInHistory(). Returns false.
94 PARAMETERSPLUGIN_EXPORT virtual bool isInHistory();
96 /// Reimplemented from ModelAPI_Feature::isInHistory().
97 PARAMETERSPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
99 /// Use plugin manager for features creation
100 ParametersPlugin_Parameter();
103 /// Evaluates theExpression and returns its value.
104 double evaluate(const std::string& theExpression, std::string& theError);
105 /// Updates name of the parameter
107 /// Updates expression of the parameter
108 bool updateExpression();