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 //--------------------------------------------------------------------------------------
13 //--------------------------------------------------------------------------------------
14 ModelHighAPI_RefAttr::ModelHighAPI_RefAttr()
18 ModelHighAPI_RefAttr::ModelHighAPI_RefAttr(
19 const std::shared_ptr<ModelAPI_Attribute> & theValue)
24 ModelHighAPI_RefAttr::ModelHighAPI_RefAttr(
25 const std::shared_ptr<ModelAPI_Object> & theValue)
30 ModelHighAPI_RefAttr::~ModelHighAPI_RefAttr()
34 //--------------------------------------------------------------------------------------
35 struct fill_visitor : boost::static_visitor<void>
37 mutable std::shared_ptr<ModelAPI_AttributeRefAttr> myAttribute;
39 fill_visitor(const std::shared_ptr<ModelAPI_AttributeRefAttr> & theAttribute)
40 : myAttribute(theAttribute) {}
42 void operator()(const std::shared_ptr<ModelAPI_Attribute>& theValue) const { myAttribute->setAttr(theValue); }
43 void operator()(const std::shared_ptr<ModelAPI_Object>& theValue) const { myAttribute->setObject(theValue); }
46 void ModelHighAPI_RefAttr::fillAttribute(
47 const std::shared_ptr<ModelAPI_AttributeRefAttr> & theAttribute) const
49 boost::apply_visitor(fill_visitor(theAttribute), myValue);