mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-29 03:37:21 +00:00
RDB serializer: write type declarations in case of typed refs
This commit is contained in:
@@ -199,10 +199,6 @@ void RocksDbSerializer::write_streaming_() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const auto* inst : simple_type_instances) {
|
for (const auto* inst : simple_type_instances) {
|
||||||
if (type_identities_wrote_as_refs.find(inst->identity()) != type_identities_wrote_as_refs.end()) {
|
|
||||||
// already written as reference, skip
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
std::string s(sizeof(size_t), ' ');
|
std::string s(sizeof(size_t), ' ');
|
||||||
size_t v = inst->declaration().index_in_schema();
|
size_t v = inst->declaration().index_in_schema();
|
||||||
memcpy(s.data(), &v, sizeof(size_t));
|
memcpy(s.data(), &v, sizeof(size_t));
|
||||||
@@ -211,6 +207,12 @@ void RocksDbSerializer::write_streaming_() {
|
|||||||
storage.wopts,
|
storage.wopts,
|
||||||
(inst->declaration().as_entity() ? "i|" : "t|") + std::to_string(inst->identity()) + "|_", s);
|
(inst->declaration().as_entity() ? "i|" : "t|") + std::to_string(inst->identity()) + "|_", s);
|
||||||
|
|
||||||
|
if (type_identities_wrote_as_refs.find(inst->identity()) != type_identities_wrote_as_refs.end()) {
|
||||||
|
// already written as reference, skip
|
||||||
|
// only applies to the value though, the type declaration still needs to be written
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
auto val = inst->get_attribute_value(0);
|
auto val = inst->get_attribute_value(0);
|
||||||
val.apply_visitor([&](const auto& t) {
|
val.apply_visitor([&](const auto& t) {
|
||||||
rocks_db_attribute_storage{}.set(&storage, &inst->declaration(), inst->identity(), 0, t);
|
rocks_db_attribute_storage{}.set(&storage, &inst->declaration(), inst->identity(), 0, t);
|
||||||
|
|||||||
Reference in New Issue
Block a user