From e6ea58cd72a51c102d003f78151536dd491d9405 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Sun, 31 Aug 2025 21:27:21 +0200 Subject: [PATCH] Implement get_inverse_indices on rocksdb --- src/ifcparse/IfcParse.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/ifcparse/IfcParse.cpp b/src/ifcparse/IfcParse.cpp index 595abe167b..55e040eb0f 100644 --- a/src/ifcparse/IfcParse.cpp +++ b/src/ifcparse/IfcParse.cpp @@ -2471,7 +2471,20 @@ std::vector IfcFile::get_inverse_indices(int instance_id) { } } } else if constexpr (std::is_same_v, impl::rocks_db_file_storage>) { - // @todo + // @todo no lower/upper_bounds() implemented yet + auto prefix = "v|" + std::to_string(instance_id) + "|"; + auto it = x.db->NewIterator(rocksdb::ReadOptions()); + it->Seek(prefix); + while (it->Valid() && it->key().starts_with(prefix)) { + std::vector vals(it->value().size() / sizeof(uint32_t)); + memcpy(vals.data(), it->value().data(), it->value().size()); + auto tuple = key_from_string>(it->key().ToString().substr(2)); + for (auto& i : vals) { + mapping[i].push_back(std::get<2>(tuple)); + } + it->Next(); + } + } }, storage_);