SHAPER  9.12.0
ParametersAPI_Parameter.h
1 // Copyright (C) 2014-2023 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 SRC_PARAMETERSAPI_PARAMETERSAPI_PARAMETER_H_
21 #define SRC_PARAMETERSAPI_PARAMETERSAPI_PARAMETER_H_
22 
23 //--------------------------------------------------------------------------------------
24 #include "ParametersAPI.h"
25 
26 #include <ParametersPlugin_Parameter.h>
27 
28 #include <ModelHighAPI_Interface.h>
29 #include <ModelHighAPI_Macro.h>
30 //--------------------------------------------------------------------------------------
32 //--------------------------------------------------------------------------------------
38 {
39 public:
41  PARAMETERSAPI_EXPORT
42  explicit ParametersAPI_Parameter(const std::shared_ptr<ModelAPI_Feature> & theFeature);
44  PARAMETERSAPI_EXPORT
45  explicit ParametersAPI_Parameter(const std::shared_ptr<ModelAPI_Feature> & theFeature,
46  const std::string & theName,
47  const std::string & theExpression,
48  const std::wstring & theComment = std::wstring());
50  PARAMETERSAPI_EXPORT
51  virtual ~ParametersAPI_Parameter();
52 
53  INTERFACE_3(ParametersPlugin_Parameter::ID(),
60  )
61 
62 
63  PARAMETERSAPI_EXPORT void setValue(const double theValue);
65  PARAMETERSAPI_EXPORT double value();
66 
68  PARAMETERSAPI_EXPORT
69  virtual void dump(ModelHighAPI_Dumper& theDumper) const;
70 
71 };
72 
74 typedef std::shared_ptr<ParametersAPI_Parameter> ParameterPtr;
75 
79 PARAMETERSAPI_EXPORT
80 ParameterPtr addParameter(const std::shared_ptr<ModelAPI_Document> & thePart,
81  const std::string & theName,
82  const std::string & theExpression,
83  const std::wstring & theComment = std::wstring());
84 
88 PARAMETERSAPI_EXPORT
89 void removeParameter(const std::shared_ptr<ModelAPI_Document> & thePart,
90  const ParameterPtr & theParameter);
91 
92 //--------------------------------------------------------------------------------------
93 //--------------------------------------------------------------------------------------
94 #endif /* SRC_PARAMETERSAPI_PARAMETERSAPI_PARAMETER_H_ */
API for the attribute that contains std (null terminated) string.
Definition: ModelAPI_AttributeString.h:33
Document for internal data structure of any object storage.
Definition: ModelAPI_Document.h:52
Class for filling ModelAPI_AttributeDouble.
Definition: ModelHighAPI_Double.h:37
Dump engine for the model.
Definition: ModelHighAPI_Dumper.h:81
Base class for feature interfaces.
Definition: ModelHighAPI_Interface.h:42
Interface for Parameter feature.
Definition: ParametersAPI_Parameter.h:38
virtual ~ParametersAPI_Parameter()
Destructor.
Definition: ParametersAPI_Parameter.cpp:67
virtual std::shared_ptr< ModelAPI_AttributeString > name() const
Name.
Definition: ParametersAPI_Parameter.h:60
ParametersAPI_Parameter(const std::shared_ptr< ModelAPI_Feature > &theFeature)
Constructor without values.
Definition: ParametersAPI_Parameter.cpp:27
virtual void dump(ModelHighAPI_Dumper &theDumper) const
Dump wrapped feature.
Definition: ParametersAPI_Parameter.cpp:71
void setValue(const double theValue)
Just sets the numeric value to the parameter (it resets the previous expression)
Definition: ParametersAPI_Parameter.cpp:51
double value()
Returns the current value of the parameter: the expression result.
Definition: ParametersAPI_Parameter.cpp:60
virtual std::shared_ptr< ModelAPI_AttributeString > comment() const
Comment.
Definition: ParametersAPI_Parameter.h:60
virtual std::shared_ptr< ModelAPI_AttributeString > expression() const
Expression.
Definition: ParametersAPI_Parameter.h:60
static const std::string & ID()
Feature kind.
Definition: ParametersPlugin_Parameter.h:39
static const std::string & COMMENT_ID()
return comment attribute Id
Definition: ParametersPlugin_Parameter.h:70
static const std::string & EXPRESSION_ID()
attribute of parameter expression
Definition: ParametersPlugin_Parameter.h:51
static const std::string & VARIABLE_ID()
attribute of parameter name
Definition: ParametersPlugin_Parameter.h:45
ParameterPtr addParameter(const std::shared_ptr< ModelAPI_Document > &thePart, const std::string &theName, const std::string &theExpression, const std::wstring &theComment=std::wstring())
Create Parameter feature.
Definition: ParametersAPI_Parameter.cpp:87
void removeParameter(const std::shared_ptr< ModelAPI_Document > &thePart, const ParameterPtr &theParameter)
Remove Parameter feature and substitute it by the value in referred features.
Definition: ParametersAPI_Parameter.cpp:105