MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ save()

bool MayaFlux::IO::Detail::VDBArchive::save ( const std::string & path,
uint32_t compression,
int level )

Write every added grid to one file.

Parameters
pathDestination, already resolved by the caller.
compressionCombination of VDBCompression flags.
levelDeflate level for the ZIP path, ignored otherwise.
Returns
False on failure; call last_error() for detail.

Definition at line 582 of file VDBArchive.cpp.

583{
584 if (m_state->grids.empty()) {
585 m_last_error = "no grids to save";
586 return false;
587 }
588
589 tvdb_file_t out;
590 std::memset(&out, 0, sizeof(out));
591 out.alloc = make_allocator();
592 out.num_grids = m_state->grids.size();
593 out.grids = m_state->grids.data();
594
595 tvdb_error_t err;
596 std::memset(&err, 0, sizeof(err));
597
598 const tvdb_status_t st = tvdb_file_save(
599 &out, path.c_str(), compression, level, /*use_mmap=*/0, &err);
600
601 if (st != TVDB_OK) {
602 m_last_error = std::string("save failed: ")
603 + (err.message[0] != '\0' ? err.message : "unknown");
604 return false;
605 }
606
607 return true;
608}
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.

Referenced by operator=(), and MayaFlux::IO::VDBWriter::write().

Here is the caller graph for this function: