Open a .vdb and read every grid's tree into memory.
Replaces whatever a previous open() on this instance had loaded. Does not touch the write-side grid accumulation, so an instance is safe to open for reading even if add_grid was never called — the two are independent state.
- Parameters
-
| path | Source path, already resolved by the caller. |
- Returns
- False on failure; call last_error() for detail.
Definition at line 614 of file VDBArchive.cpp.
615{
617 tvdb_file_close(&
m_state->read_file);
618 m_state->read_file_open =
false;
619 }
620
621 tvdb_error_t err;
622 std::memset(&err, 0, sizeof(err));
623
624 if (tvdb_file_open(&
m_state->read_file, path.c_str(),
nullptr, &err) != TVDB_OK) {
626 + (err.message[0] != '\0' ? err.message : "unknown");
627 return false;
628 }
629 m_state->read_file_open =
true;
630
631 if (tvdb_read_all_grids(&
m_state->read_file, &err) != TVDB_OK) {
633 + (err.message[0] != '\0' ? err.message : "unknown");
634 tvdb_file_close(&
m_state->read_file);
635 m_state->read_file_open =
false;
636 return false;
637 }
638
639 return true;
640}
std::string m_last_error
Set from the const read-path accessors too.
std::unique_ptr< State > m_state
References m_last_error, and m_state.