SHAPER 9.16.0
ParametersPlugin_Parameter.h
1// Copyright (C) 2014-2026 CEA, EDF
2//
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.
7//
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.
12//
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
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#ifndef PARAMETERSPLUGIN_PARAMETER_H_
21#define PARAMETERSPLUGIN_PARAMETER_H_
22
23#include "ParametersPlugin.h"
24#include <ModelAPI_Feature.h>
25
26#include <memory>
27
34{
35 public:
37
39 inline static const std::string& ID()
40 {
41 static const std::string MY_PARAMETER_ID("Parameter");
42 return MY_PARAMETER_ID;
43 }
45 inline static const std::string& VARIABLE_ID()
46 {
47 static const std::string MY_VARIABLE_ID("variable");
48 return MY_VARIABLE_ID;
49 }
51 inline static const std::string& EXPRESSION_ID()
52 {
53 static const std::string MY_EXPRESSION_ID("expression");
54 return MY_EXPRESSION_ID;
55 }
57 inline static const std::string& EXPRESSION_ERROR_ID()
58 {
59 static const std::string MY_EXPRESSION_ERROR_ID("ExpressionError");
60 return MY_EXPRESSION_ERROR_ID;
61 }
63 inline static const std::string& ARGUMENTS_ID()
64 {
65 static const std::string MY_ARGUMENTS_ID("arguments");
66 return MY_ARGUMENTS_ID;
67 }
68
70 inline static const std::string& COMMENT_ID()
71 {
72 static const std::string MY_COMMENT_ID("comment");
73 return MY_COMMENT_ID;
74 }
75
77 PARAMETERSPLUGIN_EXPORT virtual const std::string& getKind()
78 {
79 static std::string MY_KIND = ParametersPlugin_Parameter::ID();
80 return MY_KIND;
81 }
82
84 PARAMETERSPLUGIN_EXPORT virtual bool isPreviewNeeded() const;
85
87 PARAMETERSPLUGIN_EXPORT virtual void execute();
88
90 PARAMETERSPLUGIN_EXPORT virtual void initAttributes();
91
93 PARAMETERSPLUGIN_EXPORT virtual bool isInHistory();
94
96 PARAMETERSPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
97
100
101 protected:
103 double evaluate(const std::wstring& theExpression, std::string& theError);
105 void updateName();
107 bool updateExpression();
108};
109
110#endif
Feature function that represents the particular functionality of this operation.
Definition: ModelAPI_Feature.h:41
Feature for parameter.
Definition: ParametersPlugin_Parameter.h:34
virtual void attributeChanged(const std::string &theID)
Reimplemented from ModelAPI_Feature::isInHistory().
Definition: ParametersPlugin_Parameter.cpp:68
static const std::string & EXPRESSION_ERROR_ID()
attribute of parameter expression error
Definition: ParametersPlugin_Parameter.h:57
virtual void initAttributes()
Request for initialization of data model of the feature: adding all attributes.
Definition: ParametersPlugin_Parameter.cpp:46
virtual void execute()
Creates a parameter in document.
Definition: ParametersPlugin_Parameter.cpp:139
double evaluate(const std::wstring &theExpression, std::string &theError)
Evaluates theExpression and returns its value.
Definition: ParametersPlugin_Parameter.cpp:146
static const std::string & ID()
Feature kind.
Definition: ParametersPlugin_Parameter.h:39
static const std::string & VARIABLE_ID()
attribute of parameter name
Definition: ParametersPlugin_Parameter.h:45
static const std::string & COMMENT_ID()
return comment attribute Id
Definition: ParametersPlugin_Parameter.h:70
static const std::string & ARGUMENTS_ID()
list of references to the arguments of this expression
Definition: ParametersPlugin_Parameter.h:63
static const std::string & EXPRESSION_ID()
attribute of parameter expression
Definition: ParametersPlugin_Parameter.h:51
virtual bool isInHistory()
Reimplemented from ModelAPI_Feature::isInHistory(). Returns false.
Definition: ParametersPlugin_Parameter.cpp:63
bool updateExpression()
Updates expression of the parameter.
Definition: ParametersPlugin_Parameter.cpp:118
virtual bool isPreviewNeeded() const
Pre-execution is not needed for parameter.
Definition: ParametersPlugin_Parameter.cpp:183
virtual const std::string & getKind()
Returns the kind of a feature.
Definition: ParametersPlugin_Parameter.h:77
ParametersPlugin_Parameter()
Use plugin manager for features creation.
Definition: ParametersPlugin_Parameter.cpp:38
void updateName()
Updates name of the parameter.
Definition: ParametersPlugin_Parameter.cpp:76