mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 02:23:34 +00:00
Move template down to .cpp to prevent use of incomplete type
This commit is contained in:
@@ -529,8 +529,6 @@ template IFC_PARSE_API void rocks_db_attribute_storage::set<Derived>(void* stora
|
||||
template IFC_PARSE_API void rocks_db_attribute_storage::set<empty_aggregate_t>(void* storage, const IfcParse::declaration* decl, std::size_t identity, size_t index, const empty_aggregate_t& value);
|
||||
template IFC_PARSE_API void rocks_db_attribute_storage::set<empty_aggregate_of_aggregate_t>(void* storage, const IfcParse::declaration* decl, std::size_t identity, size_t index, const empty_aggregate_of_aggregate_t& value);
|
||||
|
||||
|
||||
|
||||
template IFC_PARSE_API bool rocks_db_attribute_storage::has<Blank>(void* storage, const IfcParse::declaration* decl, std::size_t identity, size_t index) const;
|
||||
template IFC_PARSE_API bool rocks_db_attribute_storage::has<int>(void* storage, const IfcParse::declaration* decl, std::size_t identity, size_t index) const;
|
||||
template IFC_PARSE_API bool rocks_db_attribute_storage::has<bool>(void* storage, const IfcParse::declaration* decl, std::size_t identity, size_t index) const;
|
||||
@@ -554,4 +552,17 @@ template IFC_PARSE_API bool rocks_db_attribute_storage::has<Derived>(void* stora
|
||||
template IFC_PARSE_API bool rocks_db_attribute_storage::has<empty_aggregate_t>(void* storage, const IfcParse::declaration* decl, std::size_t identity, size_t index) const;
|
||||
template IFC_PARSE_API bool rocks_db_attribute_storage::has<empty_aggregate_of_aggregate_t>(void* storage, const IfcParse::declaration* decl, std::size_t identity, size_t index) const;
|
||||
|
||||
template <typename T>
|
||||
T* InstanceData::get_storage_of_type() const {
|
||||
return std::visit([this](auto& m) -> T* {
|
||||
if constexpr (std::is_same_v<std::decay_t<decltype(m)>, T>) {
|
||||
return &m;
|
||||
}
|
||||
return nullptr;
|
||||
}, file()->storage_);
|
||||
}
|
||||
|
||||
template IFC_PARSE_API IfcParse::impl::in_memory_file_storage* InstanceData::get_storage_of_type<IfcParse::impl::in_memory_file_storage>() const;
|
||||
template IFC_PARSE_API IfcParse::impl::rocks_db_file_storage* InstanceData::get_storage_of_type<IfcParse::impl::rocks_db_file_storage>() const;
|
||||
|
||||
#endif
|
||||
@@ -424,15 +424,7 @@ class IFC_PARSE_API InstanceData {
|
||||
uint32_t id_;
|
||||
|
||||
template <typename T>
|
||||
T* get_storage_of_type() const {
|
||||
return std::visit([this](auto& m) -> T* {
|
||||
if constexpr (std::is_same_v<std::decay_t<decltype(m)>, T>) {
|
||||
return &m;
|
||||
}
|
||||
return nullptr;
|
||||
},
|
||||
file()->storage_);
|
||||
}
|
||||
T* get_storage_of_type() const;
|
||||
|
||||
public:
|
||||
// Since rocks_db_attribute_storage has no members this is not a variant<in_memory, rocks> but in_memory*, where nullptr means a rocks_db_attribute_storage is constructed on the fly given the context from instance data.
|
||||
|
||||
Reference in New Issue
Block a user