mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 17:57:02 +00:00
The proper id / identity fix for rocksdb
This commit is contained in:
@@ -387,6 +387,8 @@ express::Base ifcopenshell::impl::rocks_db_file_storage::assert_existance(size_t
|
|||||||
if (is_entity != (r == entityinstance_ref)) {
|
if (is_entity != (r == entityinstance_ref)) {
|
||||||
throw std::runtime_error("Incorrect reference");
|
throw std::runtime_error("Incorrect reference");
|
||||||
}
|
}
|
||||||
|
// @nb note that in case of type declarations we pass the identity as the number so
|
||||||
|
// that we can read back the attributes from the db (we cannot assign to identity).
|
||||||
auto data = std::make_shared<instance_data>(file, decl, number, rocks_db_attribute_storage{});
|
auto data = std::make_shared<instance_data>(file, decl, number, rocks_db_attribute_storage{});
|
||||||
if (r == ifcopenshell::impl::rocks_db_file_storage::entityinstance_ref) {
|
if (r == ifcopenshell::impl::rocks_db_file_storage::entityinstance_ref) {
|
||||||
instance_cache_.insert({number, data});
|
instance_cache_.insert({number, data});
|
||||||
|
|||||||
@@ -494,7 +494,7 @@ class IFC_PARSE_API instance_data {
|
|||||||
}
|
}
|
||||||
#ifdef IFOPSH_WITH_ROCKSDB
|
#ifdef IFOPSH_WITH_ROCKSDB
|
||||||
else {
|
else {
|
||||||
rocks_db_attribute_storage{}.set(get_storage_of_type<ifcopenshell::impl::rocks_db_file_storage>(), declaration_, declaration_->as_entity() ? id_ : identity_, attribute_index, value);
|
rocks_db_attribute_storage{}.set(get_storage_of_type<ifcopenshell::impl::rocks_db_file_storage>(), declaration_, id_ ? id_ : identity_, attribute_index, value);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -506,7 +506,7 @@ class IFC_PARSE_API instance_data {
|
|||||||
}
|
}
|
||||||
#ifdef IFOPSH_WITH_ROCKSDB
|
#ifdef IFOPSH_WITH_ROCKSDB
|
||||||
else {
|
else {
|
||||||
return rocks_db_attribute_storage{}.has<T>(get_storage_of_type<ifcopenshell::impl::rocks_db_file_storage>(), declaration_, declaration_->as_entity() ? id_ : identity_, attribute_index);
|
return rocks_db_attribute_storage{}.has<T>(get_storage_of_type<ifcopenshell::impl::rocks_db_file_storage>(), declaration_, id_ ? id_ : identity_, attribute_index);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2957,7 +2957,7 @@ attribute_value instance_data::get_attribute_value(size_t index) const
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}, file_->storage_);
|
}, file_->storage_);
|
||||||
return attribute_value(storage, declaration_->as_entity() ? id_ : identity_, declaration_, (uint8_t)index);
|
return attribute_value(storage, id_ ? id_ : identity_, declaration_, (uint8_t)index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user