diff --git a/src/ifcparse/IfcParse.cpp b/src/ifcparse/IfcParse.cpp index 5791928731..1f06531afe 100644 --- a/src/ifcparse/IfcParse.cpp +++ b/src/ifcparse/IfcParse.cpp @@ -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); } } diff --git a/src/ifcparse/IfcSpfHeader.cpp b/src/ifcparse/IfcSpfHeader.cpp index 3c69be6bd1..8a17294152 100644 --- a/src/ifcparse/IfcSpfHeader.cpp +++ b/src/ifcparse/IfcSpfHeader.cpp @@ -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(); + file_description_->file_ = file_; + file_name_ = Header_section_schema::get_schema().instantiate(&Header_section_schema::file_name::Class(), IfcEntityInstanceData(rocks_db_attribute_storage{}))->as(); + file_name_->file_ = file_; + file_schema_ = Header_section_schema::get_schema().instantiate(&Header_section_schema::file_schema::Class(), IfcEntityInstanceData(rocks_db_attribute_storage{}))->as(); + file_schema_->file_ = file_; + } } }