From b2c20b15b429b290e2ed4cddefd6e1775df29aaf Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Wed, 27 Aug 2025 10:32:58 +0200 Subject: [PATCH] Move definitions --- src/ifcparse/IfcFile.cpp | 23 +++++++++++++++++++++++ src/ifcparse/IfcFile.h | 25 ------------------------- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/src/ifcparse/IfcFile.cpp b/src/ifcparse/IfcFile.cpp index aecd84ae58..819582f931 100644 --- a/src/ifcparse/IfcFile.cpp +++ b/src/ifcparse/IfcFile.cpp @@ -663,3 +663,26 @@ std::optionalas_entity() || decl->as_type_declaration()) { + auto* inst = file->schema()->instantiate(decl, rocks_db_attribute_storage{}); + inst->file_ = file; + return file->addEntity(inst); + } else { + throw std::runtime_error("Requires and entity or type declaration"); + } +} + +IfcUtil::IfcBaseClass* IfcParse::impl::in_memory_file_storage::create(const IfcParse::declaration* decl) { + IfcUtil::IfcBaseClass* inst = nullptr; + if (auto* ent = decl->as_entity()) { + inst = file->schema()->instantiate(decl, in_memory_attribute_storage(ent->attribute_count())); + } else if (decl->as_type_declaration() != nullptr) { + inst = file->schema()->instantiate(decl, in_memory_attribute_storage(1)); + } else { + throw std::runtime_error("Requires and entity or type declaration"); + } + inst->file_ = file; + return file->addEntity(inst); +} diff --git a/src/ifcparse/IfcFile.h b/src/ifcparse/IfcFile.h index e8f61826da..b619b62f0c 100644 --- a/src/ifcparse/IfcFile.h +++ b/src/ifcparse/IfcFile.h @@ -405,8 +405,6 @@ namespace impl { } // namespace IfcParse - - template T* IfcParse::impl::in_memory_file_storage::create() { IfcUtil::IfcBaseClass* inst = nullptr; @@ -421,19 +419,6 @@ T* IfcParse::impl::in_memory_file_storage::create() { return file->addEntity(inst)->as(); } -IfcUtil::IfcBaseClass* IfcParse::impl::in_memory_file_storage::create(const IfcParse::declaration* decl) { - IfcUtil::IfcBaseClass* inst = nullptr; - if (auto* ent = decl->as_entity()) { - inst = file->schema()->instantiate(decl, in_memory_attribute_storage(ent->attribute_count())); - } else if (decl->as_type_declaration() != nullptr) { - inst = file->schema()->instantiate(decl, in_memory_attribute_storage(1)); - } else { - throw std::runtime_error("Requires and entity or type declaration"); - } - inst->file_ = file; - return file->addEntity(inst); -} - template T* IfcParse::impl::rocks_db_file_storage::create() { if constexpr (std::is_same_v>, IfcParse::entity> || std::is_same_v>, IfcParse::type_declaration>) { @@ -445,16 +430,6 @@ T* IfcParse::impl::rocks_db_file_storage::create() { } } -IfcUtil::IfcBaseClass* IfcParse::impl::rocks_db_file_storage::create(const IfcParse::declaration* decl) { - if (decl->as_entity() || decl->as_type_declaration()) { - auto* inst = file->schema()->instantiate(decl, rocks_db_attribute_storage{}); - inst->file_ = file; - return file->addEntity(inst); - } else { - throw std::runtime_error("Requires and entity or type declaration"); - } -} - namespace std { template <> struct iterator_traits {