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 648 of file VDBArchive.cpp.
649{
651 tvdb_file_close(&
m_state->read_file);
652 m_state->read_file_open =
false;
653 }
654
655 tvdb_error_t err;
656 std::memset(&err, 0, sizeof(err));
657
658 if (tvdb_file_open(&
m_state->read_file, path.c_str(),
nullptr, &err) != TVDB_OK) {
660 + (err.message[0] != '\0' ? err.message : "unknown");
661 return false;
662 }
663 m_state->read_file_open =
true;
664
665 if (tvdb_read_all_grids(&
m_state->read_file, &err) != TVDB_OK) {
667 + (err.message[0] != '\0' ? err.message : "unknown");
668 tvdb_file_close(&
m_state->read_file);
669 m_state->read_file_open =
false;
670 return false;
671 }
672
673 return true;
674}
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.