Rocksdb header parsing

This commit is contained in:
Thomas Krijnen
2025-09-10 09:10:59 +02:00
parent f8e523daff
commit de8c8d3bed
2 changed files with 12 additions and 2 deletions
+3 -2
View File
@@ -1352,6 +1352,7 @@ IfcFile::IfcFile(const std::string& fn, bool mmap) {
IfcFile::IfcFile(const std::string& path, filetype ty, bool readonly)
: schema_(nullptr)
, max_id_(0)
, _header(this)
{
// @todo allow for rocksdb from path
if (ty == FT_AUTODETECT) {
@@ -1441,7 +1442,7 @@ IfcFile::IfcFile(const IfcParse::schema_definition* schema, filetype ty, const s
: schema_(schema)
, ifcroot_type_(schema_->declaration_by_name("IfcRoot"))
, max_id_(0)
, _header(ty == FT_ROCKSDB ? this : nullptr)
, _header(this)
{
if (ty == FT_AUTODETECT) {
ty = guess_file_type(path);
@@ -2793,7 +2794,7 @@ AttributeValue IfcEntityInstanceData::get_attribute_value(void* storage, const I
if (storage_) {
return AttributeValue(storage_, (uint8_t)index);
} else {
return AttributeValue((IfcParse::impl::rocks_db_file_storage*)storage, identity, decl->as_entity() ? 1 : 0, index);
return AttributeValue((IfcParse::impl::rocks_db_file_storage*)storage, identity, decl, index);
}
}
+9
View File
@@ -87,6 +87,15 @@ IfcParse::IfcSpfHeader::IfcSpfHeader(IfcParse::IfcFile* file)
}
return nullptr;
}, file_->storage_);
if (storage_ == nullptr) {
file_description_ = Header_section_schema::get_schema().instantiate(&Header_section_schema::file_description::Class(), IfcEntityInstanceData(rocks_db_attribute_storage{}))->as<Header_section_schema::file_description>();
file_description_->file_ = file_;
file_name_ = Header_section_schema::get_schema().instantiate(&Header_section_schema::file_name::Class(), IfcEntityInstanceData(rocks_db_attribute_storage{}))->as<Header_section_schema::file_name>();
file_name_->file_ = file_;
file_schema_ = Header_section_schema::get_schema().instantiate(&Header_section_schema::file_schema::Class(), IfcEntityInstanceData(rocks_db_attribute_storage{}))->as<Header_section_schema::file_schema>();
file_schema_->file_ = file_;
}
}
}