serializers: skip_supertypes filter in RocksDbSerializer streaming write

Plumbed through to the Python convert_path_to_rocksdb wrapper.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Dion Moult
2026-05-04 07:28:12 +10:00
parent e84767c22b
commit ca2e866c45
3 changed files with 33 additions and 4 deletions
+17 -1
View File
@@ -23,9 +23,10 @@ RocksDbSerializer::RocksDbSerializer(ifcopenshell::file* file, const std::string
output_file_->calculate_unit_factors = false;
}
RocksDbSerializer::RocksDbSerializer(const std::string& input_filename, const std::string& rocksdb_filename, bool stream)
RocksDbSerializer::RocksDbSerializer(const std::string& input_filename, const std::string& rocksdb_filename, bool stream, const std::vector<std::string>& skip_supertypes)
: file_(input_filename)
, rocksdb_filename_(rocksdb_filename)
, skip_supertypes_(skip_supertypes)
{
}
@@ -144,6 +145,21 @@ void RocksDbSerializer::write_streaming_() {
const bool is_header = decl->schema() == &Header_section_schema::get_schema();
if (!is_header && decl->as_entity() && !skip_supertypes_.empty()) {
bool skip = false;
for (const auto& super : skip_supertypes_) {
if (decl->is(super)) {
skip = true;
break;
}
}
if (skip) {
streamer.references().clear();
streamer.inverses().clear();
continue;
}
}
std::vector<express::Base> simple_type_instances;
for (size_t i = 0; i < data->storage_->size(); i++) {