Salome HOME
0faa1346af1cc6a013a1499e88444aa5ea049016
[modules/shaper.git] / src / ParametersAPI / ParametersAPI_Parameter.cpp
1 // Name   : ParametersAPI_Parameter.cpp
2 // Purpose: 
3 //
4 // History:
5 // 16/06/16 - Sergey POKHODENKO - Creation of the file
6
7 //--------------------------------------------------------------------------------------
8 #include "ParametersAPI_Parameter.h"
9 //--------------------------------------------------------------------------------------
10 #include <ModelHighAPI_Tools.h>
11 //--------------------------------------------------------------------------------------
12 ParametersAPI_Parameter::ParametersAPI_Parameter(
13     const std::shared_ptr<ModelAPI_Feature> & theFeature)
14 : ModelHighAPI_Interface(theFeature)
15 {
16   initialize();
17 }
18
19 ParametersAPI_Parameter::ParametersAPI_Parameter(
20     const std::shared_ptr<ModelAPI_Feature> & theFeature,
21     const std::string & theName,
22     const std::string & theExpression,
23     const std::string & theComment)
24 : ModelHighAPI_Interface(theFeature)
25 {
26   if (initialize()) {
27     fillAttribute(theName, name());
28     fillAttribute(theExpression, expression());
29     fillAttribute(theComment, comment());
30
31     execute();
32   }
33 }
34
35 ParametersAPI_Parameter::~ParametersAPI_Parameter()
36 {
37 }
38
39 //--------------------------------------------------------------------------------------
40 ParameterPtr addParameter(const std::shared_ptr<ModelAPI_Document> & thePart,
41                           const std::string & theName,
42                           const std::string & theExpression,
43                           const std::string & theComment)
44 {
45   // TODO(spo): check that thePart is not empty
46   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ParametersAPI_Parameter::ID());
47   return ParameterPtr(new ParametersAPI_Parameter(aFeature, theName, theExpression, theComment));
48 }