diff --git a/src/ifcparse/IfcBaseClass.h b/src/ifcparse/IfcBaseClass.h index 9ecab3e669..5cab8289c3 100644 --- a/src/ifcparse/IfcBaseClass.h +++ b/src/ifcparse/IfcBaseClass.h @@ -105,10 +105,19 @@ public: virtual const IfcParse::declaration& declaration() const = 0; template - void set_attribute_value(size_t i, const T& t); + typename std::enable_if< + (!(std::is_pointer::value && std::is_base_of::type>::value) || std::is_same_v>), + void>::type + set_attribute_value(size_t i, const T& t); template - void set_attribute_value(const std::string& name, const T& t); + typename std::enable_if< + (!(std::is_pointer::value&& std::is_base_of::type>::value) || std::is_same_v>), + void>::type + set_attribute_value(const std::string& name, const T& t); + + void set_attribute_value(size_t i, IfcUtil::IfcBaseClass* p); + void set_attribute_value(const std::string& name, IfcUtil::IfcBaseClass* p); void unset_attribute_value(size_t i); diff --git a/src/ifcparse/IfcParse.cpp b/src/ifcparse/IfcParse.cpp index b5bb0b47b5..671fac713c 100644 --- a/src/ifcparse/IfcParse.cpp +++ b/src/ifcparse/IfcParse.cpp @@ -1233,7 +1233,10 @@ class apply_individual_instance_visitor { }; template -void IfcUtil::IfcBaseClass::set_attribute_value(size_t i, const T& t) { +typename std::enable_if< + (!(std::is_pointer::value&& std::is_base_of::type>::value) || std::is_same_v>), + void>::type +IfcUtil::IfcBaseClass::set_attribute_value(size_t i, const T& t) { if constexpr (std::is_same_v, double>) { if (!std::isfinite(t)) { throw IfcParse::IfcException("Only finite values are allowed"); @@ -1314,7 +1317,10 @@ void IfcUtil::IfcBaseClass::set_attribute_value(size_t i, const T& t) { } template -void IfcUtil::IfcBaseClass::set_attribute_value(const std::string& s, const T& t) { +typename std::enable_if< + (!(std::is_pointer::value&& std::is_base_of::type>::value) || std::is_same_v>), + void>::type +IfcUtil::IfcBaseClass::set_attribute_value(const std::string& s, const T& t) { set_attribute_value(declaration().as_entity()->attribute_index(s), t); } @@ -2738,6 +2744,12 @@ IfcUtil::IfcBaseClass::IfcBaseClass(IfcEntityInstanceData&& data) */ } +void IfcUtil::IfcBaseClass::set_attribute_value(size_t i, IfcUtil::IfcBaseClass* p) { + set_attribute_value(i, p); +} +void IfcUtil::IfcBaseClass::set_attribute_value(const std::string& name, IfcUtil::IfcBaseClass* p) { + set_attribute_value(name, p); +} template void IFC_PARSE_API IfcUtil::IfcBaseClass::set_attribute_value(size_t index, const Blank& value); template void IFC_PARSE_API IfcUtil::IfcBaseClass::set_attribute_value(size_t index, const Derived& value); @@ -2748,7 +2760,7 @@ template void IFC_PARSE_API IfcUtil::IfcBaseClass::set_attribute_value(s template void IFC_PARSE_API IfcUtil::IfcBaseClass::set_attribute_value(size_t index, const std::string& value); template void IFC_PARSE_API IfcUtil::IfcBaseClass::set_attribute_value>(size_t index, const boost::dynamic_bitset<>& value); template void IFC_PARSE_API IfcUtil::IfcBaseClass::set_attribute_value(size_t index, const EnumerationReference& value); -template void IFC_PARSE_API IfcUtil::IfcBaseClass::set_attribute_value(size_t index, IfcUtil::IfcBaseClass* const& value); +// template void IFC_PARSE_API IfcUtil::IfcBaseClass::set_attribute_value(size_t index, IfcUtil::IfcBaseClass* const& value); template void IFC_PARSE_API IfcUtil::IfcBaseClass::set_attribute_value>(size_t index, const std::vector& value); template void IFC_PARSE_API IfcUtil::IfcBaseClass::set_attribute_value>(size_t index, const std::vector& value); template void IFC_PARSE_API IfcUtil::IfcBaseClass::set_attribute_value>(size_t index, const std::vector& value); @@ -2767,7 +2779,7 @@ template void IFC_PARSE_API IfcUtil::IfcBaseClass::set_attribute_value(c template void IFC_PARSE_API IfcUtil::IfcBaseClass::set_attribute_value(const std::string& name, const std::string& value); template void IFC_PARSE_API IfcUtil::IfcBaseClass::set_attribute_value>(const std::string& name, const boost::dynamic_bitset<>& value); template void IFC_PARSE_API IfcUtil::IfcBaseClass::set_attribute_value(const std::string& name, const EnumerationReference& value); -template void IFC_PARSE_API IfcUtil::IfcBaseClass::set_attribute_value(const std::string& name, IfcUtil::IfcBaseClass* const& value); +// template void IFC_PARSE_API IfcUtil::IfcBaseClass::set_attribute_value(const std::string& name, IfcUtil::IfcBaseClass* const& value); template void IFC_PARSE_API IfcUtil::IfcBaseClass::set_attribute_value>(const std::string& name, const std::vector& value); template void IFC_PARSE_API IfcUtil::IfcBaseClass::set_attribute_value>(const std::string& name, const std::vector& value); template void IFC_PARSE_API IfcUtil::IfcBaseClass::set_attribute_value>(const std::string& name, const std::vector& value);