]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModelHighAPI/ModelHighAPI_Reference.cpp
Salome HOME
Remove default values from properties requests
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI_Reference.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        FeaturesAPI_Reference.cpp
4 // Created:     04 August 2016
5 // Author:      Mikhail Ponikarov
6
7 //--------------------------------------------------------------------------------------
8 #include "ModelHighAPI_Reference.h"
9
10 #include <ModelAPI_AttributeReference.h>
11 #include <ModelAPI_AttributeRefList.h>
12 #include <ModelAPI_Feature.h>
13 #include <ModelAPI_Result.h>
14 #include "ModelHighAPI_Interface.h"
15 //--------------------------------------------------------------------------------------
16 ModelHighAPI_Reference::ModelHighAPI_Reference()
17 {}
18
19 ModelHighAPI_Reference::ModelHighAPI_Reference(
20     const std::shared_ptr<ModelAPI_Object> & theValue)
21 : myObject(theValue)
22 {}
23
24 ModelHighAPI_Reference::ModelHighAPI_Reference(
25     const std::shared_ptr<ModelHighAPI_Interface> & theValue)
26 : myObject(std::shared_ptr<ModelAPI_Object>(theValue->defaultResult()))
27 {
28   // the result is not constructed yet, forcibly do it
29   if (!myObject) {
30     theValue->execute(true);
31     myObject = std::shared_ptr<ModelAPI_Object>(theValue->defaultResult());
32   }
33 }
34
35 ModelHighAPI_Reference::~ModelHighAPI_Reference()
36 {
37 }
38
39 //--------------------------------------------------------------------------------------
40 void ModelHighAPI_Reference::fillAttribute(
41     const std::shared_ptr<ModelAPI_AttributeReference> & theAttribute) const
42 {
43   theAttribute->setValue(myObject);
44 }
45
46 //--------------------------------------------------------------------------------------
47 void ModelHighAPI_Reference::appendToList(
48     const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute) const
49 {
50   theAttribute->append(myObject);
51 }
52
53 //--------------------------------------------------------------------------------------
54 std::shared_ptr<ModelAPI_Feature> ModelHighAPI_Reference::feature() const
55 {
56   return ModelAPI_Feature::feature(myObject);
57 }