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 SRC_PARAMETERSAPI_PARAMETERSAPI_PARAMETER_H_
21 #define SRC_PARAMETERSAPI_PARAMETERSAPI_PARAMETER_H_
23 //--------------------------------------------------------------------------------------
24 #include "ParametersAPI.h"
26 #include <ParametersPlugin_Parameter.h>
28 #include <ModelHighAPI_Interface.h>
29 #include <ModelHighAPI_Macro.h>
30 //--------------------------------------------------------------------------------------
31 class ModelHighAPI_Double;
32 //--------------------------------------------------------------------------------------
33 /**\class ParametersAPI_Parameter
35 * \brief Interface for Parameter feature
37 class ParametersAPI_Parameter : public ModelHighAPI_Interface
40 /// Constructor without values
42 explicit ParametersAPI_Parameter(const std::shared_ptr<ModelAPI_Feature> & theFeature);
43 /// Constructor with values
45 explicit ParametersAPI_Parameter(const std::shared_ptr<ModelAPI_Feature> & theFeature,
46 const std::string & theName,
47 const std::string & theExpression,
48 const std::string & theComment = std::string());
51 virtual ~ParametersAPI_Parameter();
53 INTERFACE_3(ParametersPlugin_Parameter::ID(),
54 name, ParametersPlugin_Parameter::VARIABLE_ID(),
55 ModelAPI_AttributeString, /** Name */,
56 expression, ParametersPlugin_Parameter::EXPRESSION_ID(),
57 ModelAPI_AttributeString, /** Expression */,
58 comment, ParametersPlugin_Parameter::COMMENT_ID(),
59 ModelAPI_AttributeString, /** Comment */
62 /// Just sets the numeric value to the parameter (it resets the previous expression)
63 PARAMETERSAPI_EXPORT void setValue(const double theValue);
64 /// Returns the current value of the parameter: the expression result.
65 PARAMETERSAPI_EXPORT double value();
67 /// Dump wrapped feature
69 virtual void dump(ModelHighAPI_Dumper& theDumper) const;
73 //! Pointer on Parameter object
74 typedef std::shared_ptr<ParametersAPI_Parameter> ParameterPtr;
76 /**\ingroup CPPHighAPI
77 * \brief Create Parameter feature
80 ParameterPtr addParameter(const std::shared_ptr<ModelAPI_Document> & thePart,
81 const std::string & theName,
82 const std::string & theExpression,
83 const std::string & theComment = std::string());
85 /**\ingroup CPPHighAPI
86 * \brief Remove Parameter feature and substitute it by the value in referred features
89 void removeParameter(const std::shared_ptr<ModelAPI_Document> & thePart,
90 const ParameterPtr & theParameter);
92 //--------------------------------------------------------------------------------------
93 //--------------------------------------------------------------------------------------
94 #endif /* SRC_PARAMETERSAPI_PARAMETERSAPI_PARAMETER_H_ */