]> SALOME platform Git repositories - modules/shaper.git/blob - src/ParametersAPI/ParametersAPI_Parameter.h
Salome HOME
Merge branch 'master' into cgt/devCEA
[modules/shaper.git] / src / ParametersAPI / ParametersAPI_Parameter.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2 // Name   : ParametersAPI_Parameter.h
3 // Purpose:
4 //
5 // History:
6 // 16/06/16 - Sergey POKHODENKO - Creation of the file
7
8 #ifndef SRC_PARAMETERSAPI_PARAMETERSAPI_PARAMETER_H_
9 #define SRC_PARAMETERSAPI_PARAMETERSAPI_PARAMETER_H_
10
11 //--------------------------------------------------------------------------------------
12 #include "ParametersAPI.h"
13
14 #include <ParametersPlugin_Parameter.h>
15
16 #include <ModelHighAPI_Interface.h>
17 #include <ModelHighAPI_Macro.h>
18 //--------------------------------------------------------------------------------------
19 class ModelHighAPI_Double;
20 //--------------------------------------------------------------------------------------
21 /**\class ParametersAPI_Parameter
22  * \ingroup CPPHighAPI
23  * \brief Interface for Parameter feature
24  */
25 class ParametersAPI_Parameter : public ModelHighAPI_Interface
26 {
27 public:
28   /// Constructor without values
29   PARAMETERSAPI_EXPORT
30   explicit ParametersAPI_Parameter(const std::shared_ptr<ModelAPI_Feature> & theFeature);
31   /// Constructor with values
32   PARAMETERSAPI_EXPORT
33   explicit ParametersAPI_Parameter(const  std::shared_ptr<ModelAPI_Feature> & theFeature,
34                                    const std::string & theName,
35                                    const std::string & theExpression,
36                                    const std::string & theComment = std::string());
37   /// Destructor
38   PARAMETERSAPI_EXPORT
39   virtual ~ParametersAPI_Parameter();
40
41   INTERFACE_3(ParametersPlugin_Parameter::ID(),
42               name, ParametersPlugin_Parameter::VARIABLE_ID(),
43               ModelAPI_AttributeString, /** Name */,
44               expression, ParametersPlugin_Parameter::EXPRESSION_ID(),
45               ModelAPI_AttributeString, /** Expression */,
46               comment, ParametersPlugin_Parameter::COMMENT_ID(),
47               ModelAPI_AttributeString, /** Comment */
48   )
49
50   /// Just sets the numeric value to the parameter (it resets the previous expression)
51   PARAMETERSAPI_EXPORT void setValue(const double theValue);
52   /// Returns the current value of the parameter: the expression result.
53   PARAMETERSAPI_EXPORT double value();
54
55   /// Dump wrapped feature
56   PARAMETERSAPI_EXPORT
57   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
58
59 };
60
61 //! Pointer on Parameter object
62 typedef std::shared_ptr<ParametersAPI_Parameter> ParameterPtr;
63
64 /**\ingroup CPPHighAPI
65  * \brief Create Parameter feature
66  */
67 PARAMETERSAPI_EXPORT
68 ParameterPtr addParameter(const std::shared_ptr<ModelAPI_Document> & thePart,
69                           const std::string & theName,
70                           const std::string & theExpression,
71                           const std::string & theComment = std::string());
72
73 //--------------------------------------------------------------------------------------
74 //--------------------------------------------------------------------------------------
75 #endif /* SRC_PARAMETERSAPI_PARAMETERSAPI_PARAMETER_H_ */