| 32 | namespace { |
| 33 | template<typename T> |
| 34 | inline T dispatch_get_(AttributeValue::pointer_type array_, uint8_t storage_model_, size_t instance_name_, const IfcParse::declaration* entity_or_type, uint8_t index_) |
| 35 | { |
| 36 | if (storage_model_ == 0) { |
| 37 | return array_.storage_ptr->get<T>(index_); |
| 38 | } |
| 39 | #ifdef IFOPSH_WITH_ROCKSDB |
| 40 | else { |
| 41 | T val = T{}; |
| 42 | const bool is_header = entity_or_type->schema() == &Header_section_schema::get_schema(); |
| 43 | if constexpr ( |
| 44 | // the following types cannot be directly deserialized from rocksdb, but need to be constructed |
| 45 | !std::is_same_v<T, EnumerationReference> && |
| 46 | !std::is_same_v<std::remove_cv_t<std::remove_pointer_t<T>>, IfcUtil::IfcBaseClass>) |
| 47 | { |
| 48 | std::string str; |
| 49 | array_.db_ptr->db->Get(rocksdb::ReadOptions{}, |
| 50 | (is_header ? "h|" : (entity_or_type->as_entity() ? "i|" : "t|")) + |
| 51 | (is_header ? entity_or_type->name() : std::to_string(instance_name_)) + "|" + |
| 52 | std::to_string(index_), &str); |
| 53 | impl::deserialize(array_.db_ptr, str, val); |
| 54 | } else { |
| 55 | static_assert( |
| 56 | std::is_same_v<T, EnumerationReference> || |
| 57 | std::is_same_v<std::remove_cv_t<std::remove_pointer_t<T>>, IfcUtil::IfcBaseClass>, |
| 58 | "RocksDB deserialization must be specialized for this EnumerationReference and IfcBaseClass*" |
| 59 | ); |
| 60 | } |
| 61 | return val; |
| 62 | } |
| 63 | #endif |
| 64 | } |
| 65 | |
| 66 | template<typename T> |
| 67 | inline bool dispatch_has_(AttributeValue::pointer_type array_, uint8_t storage_model_, size_t instance_name_, const IfcParse::declaration* entity_or_type, uint8_t index_) |
nothing calls this directly
no test coverage detected