1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: FeaturesAPI_Reference.cpp
4 // Created: 04 August 2016
5 // Author: Mikhail Ponikarov
7 //--------------------------------------------------------------------------------------
8 #include "ModelHighAPI_Reference.h"
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()
19 ModelHighAPI_Reference::ModelHighAPI_Reference(
20 const std::shared_ptr<ModelAPI_Object> & theValue)
24 ModelHighAPI_Reference::ModelHighAPI_Reference(
25 const std::shared_ptr<ModelHighAPI_Interface> & theValue)
26 : myObject(std::shared_ptr<ModelAPI_Object>(theValue->defaultResult()))
28 // the result is not constructed yet, forcibly do it
30 theValue->execute(true);
31 myObject = std::shared_ptr<ModelAPI_Object>(theValue->defaultResult());
35 ModelHighAPI_Reference::~ModelHighAPI_Reference()
39 //--------------------------------------------------------------------------------------
40 void ModelHighAPI_Reference::fillAttribute(
41 const std::shared_ptr<ModelAPI_AttributeReference> & theAttribute) const
43 theAttribute->setValue(myObject);
46 //--------------------------------------------------------------------------------------
47 void ModelHighAPI_Reference::appendToList(
48 const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute) const
50 theAttribute->append(myObject);
53 //--------------------------------------------------------------------------------------
54 std::shared_ptr<ModelAPI_Feature> ModelHighAPI_Reference::feature() const
56 return ModelAPI_Feature::feature(myObject);