1 // Name : ModelHighAPI_RefAttr.cpp
5 // 08/06/16 - Sergey POKHODENKO - Creation of the file
7 //--------------------------------------------------------------------------------------
8 #include "ModelHighAPI_RefAttr.h"
10 #include <ModelAPI_AttributeRefAttr.h>
11 #include <ModelAPI_AttributeRefAttrList.h>
12 #include <ModelAPI_Feature.h>
13 #include <ModelAPI_Result.h>
14 #include "ModelHighAPI_Interface.h"
15 //--------------------------------------------------------------------------------------
16 ModelHighAPI_RefAttr::ModelHighAPI_RefAttr()
17 : myVariantType(VT_ATTRIBUTE)
21 ModelHighAPI_RefAttr::ModelHighAPI_RefAttr(
22 const std::shared_ptr<ModelAPI_Attribute> & theValue)
23 : myVariantType(VT_ATTRIBUTE)
24 , myAttribute(theValue)
28 ModelHighAPI_RefAttr::ModelHighAPI_RefAttr(
29 const std::shared_ptr<ModelAPI_Object> & theValue)
30 : myVariantType(VT_OBJECT)
35 ModelHighAPI_RefAttr::ModelHighAPI_RefAttr(
36 const std::shared_ptr<ModelHighAPI_Interface> & theValue)
37 : myVariantType(VT_OBJECT)
38 , myObject(std::shared_ptr<ModelAPI_Object>(theValue->defaultResult()))
42 ModelHighAPI_RefAttr::~ModelHighAPI_RefAttr()
46 //--------------------------------------------------------------------------------------
47 void ModelHighAPI_RefAttr::fillAttribute(
48 const std::shared_ptr<ModelAPI_AttributeRefAttr> & theAttribute) const
50 switch(myVariantType) {
51 case VT_ATTRIBUTE: theAttribute->setAttr(myAttribute); return;
52 case VT_OBJECT: theAttribute->setObject(myObject); return;
56 //--------------------------------------------------------------------------------------
57 void ModelHighAPI_RefAttr::appendToList(
58 const std::shared_ptr<ModelAPI_AttributeRefAttrList> & theAttribute) const
60 switch(myVariantType) {
61 case VT_ATTRIBUTE: theAttribute->append(myAttribute); return;
62 case VT_OBJECT: theAttribute->append(myObject); return;