Salome HOME
Add copyright header according to request of CEA from 06.06.2017
[modules/shaper.git] / src / ParametersAPI / ParametersAPI_Parameter.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef SRC_PARAMETERSAPI_PARAMETERSAPI_PARAMETER_H_
22 #define SRC_PARAMETERSAPI_PARAMETERSAPI_PARAMETER_H_
23
24 //--------------------------------------------------------------------------------------
25 #include "ParametersAPI.h"
26
27 #include <ParametersPlugin_Parameter.h>
28
29 #include <ModelHighAPI_Interface.h>
30 #include <ModelHighAPI_Macro.h>
31 //--------------------------------------------------------------------------------------
32 class ModelHighAPI_Double;
33 //--------------------------------------------------------------------------------------
34 /**\class ParametersAPI_Parameter
35  * \ingroup CPPHighAPI
36  * \brief Interface for Parameter feature
37  */
38 class ParametersAPI_Parameter : public ModelHighAPI_Interface
39 {
40 public:
41   /// Constructor without values
42   PARAMETERSAPI_EXPORT
43   explicit ParametersAPI_Parameter(const std::shared_ptr<ModelAPI_Feature> & theFeature);
44   /// Constructor with values
45   PARAMETERSAPI_EXPORT
46   explicit ParametersAPI_Parameter(const  std::shared_ptr<ModelAPI_Feature> & theFeature,
47                                    const std::string & theName,
48                                    const std::string & theExpression,
49                                    const std::string & theComment = std::string());
50   /// Destructor
51   PARAMETERSAPI_EXPORT
52   virtual ~ParametersAPI_Parameter();
53
54   INTERFACE_3(ParametersPlugin_Parameter::ID(),
55               name, ParametersPlugin_Parameter::VARIABLE_ID(),
56               ModelAPI_AttributeString, /** Name */,
57               expression, ParametersPlugin_Parameter::EXPRESSION_ID(),
58               ModelAPI_AttributeString, /** Expression */,
59               comment, ParametersPlugin_Parameter::COMMENT_ID(),
60               ModelAPI_AttributeString, /** Comment */
61   )
62
63   /// Just sets the numeric value to the parameter (it resets the previous expression)
64   PARAMETERSAPI_EXPORT void setValue(const double theValue);
65   /// Returns the current value of the parameter: the expression result.
66   PARAMETERSAPI_EXPORT double value();
67
68   /// Dump wrapped feature
69   PARAMETERSAPI_EXPORT
70   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
71
72 };
73
74 //! Pointer on Parameter object
75 typedef std::shared_ptr<ParametersAPI_Parameter> ParameterPtr;
76
77 /**\ingroup CPPHighAPI
78  * \brief Create Parameter feature
79  */
80 PARAMETERSAPI_EXPORT
81 ParameterPtr addParameter(const std::shared_ptr<ModelAPI_Document> & thePart,
82                           const std::string & theName,
83                           const std::string & theExpression,
84                           const std::string & theComment = std::string());
85
86 //--------------------------------------------------------------------------------------
87 //--------------------------------------------------------------------------------------
88 #endif /* SRC_PARAMETERSAPI_PARAMETERSAPI_PARAMETER_H_ */