From 9d99de2340692d667ac8d757f1f364ec6d1d000f Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Thu, 11 Sep 2025 13:55:07 +0200 Subject: [PATCH] file.reset_identity_cache() function for adv use cases --- src/ifcparse/IfcFile.h | 2 ++ src/ifcparse/IfcParse.cpp | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/src/ifcparse/IfcFile.h b/src/ifcparse/IfcFile.h index 6572418383..e09b147b57 100644 --- a/src/ifcparse/IfcFile.h +++ b/src/ifcparse/IfcFile.h @@ -366,6 +366,8 @@ private: batch_mode_ = true; } void unbatch(); + + void reset_identity_cache(); }; #ifdef WITH_IFCXML diff --git a/src/ifcparse/IfcParse.cpp b/src/ifcparse/IfcParse.cpp index df89a0c2c5..ce7ca45d48 100644 --- a/src/ifcparse/IfcParse.cpp +++ b/src/ifcparse/IfcParse.cpp @@ -2768,6 +2768,15 @@ void IfcParse::IfcFile::unbatch() { batch_deletion_ids_.clear(); } +void IfcParse::IfcFile::reset_identity_cache() { + std::visit([](auto& x) { + if constexpr (std::is_same_v, impl::rocks_db_file_storage>) { + x.instance_cache_.clear(); + x.type_instance_cache_.clear(); + } + }, storage_); +} + void IfcParse::IfcFile::build_inverses() { for (const auto& pair : *this) { build_inverses_(pair.second);