| 478 | |
| 479 | template<typename T> |
| 480 | bool rocks_db_attribute_storage::has(void* storage, const IfcParse::declaration* decl, std::size_t identity, std::size_t index) const |
| 481 | { |
| 482 | // @todo unify with other implementation functions |
| 483 | const bool is_header = decl->schema() == &Header_section_schema::get_schema(); |
| 484 | IfcParse::impl::rocks_db_file_storage* rdb_storage = (IfcParse::impl::rocks_db_file_storage*)storage; |
| 485 | std::string v; |
| 486 | auto success = rdb_storage->db->Get( |
| 487 | rocksdb::ReadOptions{}, |
| 488 | (is_header ? "h|" : (decl->as_entity() ? "i|" : "t|")) + |
| 489 | (is_header ? decl->name() : std::to_string(identity)) + "|" + |
| 490 | std::to_string(index), &v); |
| 491 | if constexpr (std::is_same_v<std::decay_t<T>, Blank>) { |
| 492 | if (!success.ok()) { |
| 493 | return true; |
| 494 | } |
| 495 | } |
| 496 | return v.size() && v[0] == TypeEncoder::encode_type<T>(); |
| 497 | } |
| 498 | |
| 499 | template<typename T> |
| 500 | void rocks_db_attribute_storage::set(void* storage, const IfcParse::declaration* decl, std::size_t identity, std::size_t index, const T& value) |