| 73 | } |
| 74 | |
| 75 | void load( std::string_view directory ) |
| 76 | { |
| 77 | const auto filename = absl::StrCat( directory, "/identifier" ); |
| 78 | std::ifstream file{ filename, std::ifstream::binary }; |
| 79 | if( !file ) |
| 80 | { |
| 81 | return; |
| 82 | } |
| 83 | TContext context{}; |
| 84 | BitseryExtensions::register_deserialize_pcontext( |
| 85 | std::get< 0 >( context ) ); |
| 86 | Deserializer archive{ context, file }; |
| 87 | archive.object( *this ); |
| 88 | const auto& adapter = archive.adapter(); |
| 89 | OpenGeodeBasicException::check_exception( |
| 90 | adapter.error() == bitsery::ReaderError::NoError |
| 91 | && adapter.isCompletedSuccessfully() |
| 92 | && std::get< 1 >( context ).isValid(), |
| 93 | nullptr, OpenGeodeException::TYPE::internal, |
| 94 | "[Identifier::load] Error while reading file: ", filename ); |
| 95 | } |
| 96 | |
| 97 | private: |
| 98 | static constexpr auto DEFAULT_NAME = "default_name"; |
no test coverage detected