Skip to content

Commit de8c8d3

Browse files
committed
Rocksdb header parsing
1 parent f8e523d commit de8c8d3

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/ifcparse/IfcParse.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,6 +1352,7 @@ IfcFile::IfcFile(const std::string& fn, bool mmap) {
13521352
IfcFile::IfcFile(const std::string& path, filetype ty, bool readonly)
13531353
: schema_(nullptr)
13541354
, max_id_(0)
1355+
, _header(this)
13551356
{
13561357
// @todo allow for rocksdb from path
13571358
if (ty == FT_AUTODETECT) {
@@ -1441,7 +1442,7 @@ IfcFile::IfcFile(const IfcParse::schema_definition* schema, filetype ty, const s
14411442
: schema_(schema)
14421443
, ifcroot_type_(schema_->declaration_by_name("IfcRoot"))
14431444
, max_id_(0)
1444-
, _header(ty == FT_ROCKSDB ? this : nullptr)
1445+
, _header(this)
14451446
{
14461447
if (ty == FT_AUTODETECT) {
14471448
ty = guess_file_type(path);
@@ -2793,7 +2794,7 @@ AttributeValue IfcEntityInstanceData::get_attribute_value(void* storage, const I
27932794
if (storage_) {
27942795
return AttributeValue(storage_, (uint8_t)index);
27952796
} else {
2796-
return AttributeValue((IfcParse::impl::rocks_db_file_storage*)storage, identity, decl->as_entity() ? 1 : 0, index);
2797+
return AttributeValue((IfcParse::impl::rocks_db_file_storage*)storage, identity, decl, index);
27972798
}
27982799
}
27992800

src/ifcparse/IfcSpfHeader.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@ IfcParse::IfcSpfHeader::IfcSpfHeader(IfcParse::IfcFile* file)
8787
}
8888
return nullptr;
8989
}, file_->storage_);
90+
91+
if (storage_ == nullptr) {
92+
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>();
93+
file_description_->file_ = file_;
94+
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>();
95+
file_name_->file_ = file_;
96+
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>();
97+
file_schema_->file_ = file_;
98+
}
9099
}
91100
}
92101

0 commit comments

Comments
 (0)