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

◆ save_composite()

bool MayaFlux::IO::IOManager::save_composite ( const std::shared_ptr< Kakshya::CompositeContainer > &  container,
const std::string &  filepath 
)

Save a complete CompositeContainer in a supported format.

The write is synchronous, unlike the queued save_image, save_mesh, and save_volume. For bounded writes of large data, use open_composite_writer() and supply slices directly. A partial file may remain on failure.

Parameters
containerSource container.
filepathDestination CSV or TSV path.
Returns
True only if every element was written and the file closed.

Definition at line 860 of file IOManager.cpp.

863{
864 if (!container) {
866 "IOManager::save_composite: null container");
867 return false;
868 }
869
870 const auto& array = container->get_data();
871 auto writer = open_composite_writer(filepath, array.layout());
872 if (!writer)
873 return false;
874
875 const auto rows = array.slice(0, array.size());
876 const bool written = rows && writer->write_rows(*rows);
877 const std::string write_error = !rows
878 ? "could not access the container's elements"
879 : writer->get_last_error();
880 const bool closed = writer->close();
881
882 if (!written || !closed) {
884 "IOManager::save_composite: failed to write '{}' because {}",
885 filepath, written ? writer->get_last_error() : write_error);
886 return false;
887 }
888
890 "IOManager::save_composite: wrote '{}'",
891 std::filesystem::path(filepath).filename().string());
892
893 return true;
894}
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
uint32_t rows
std::shared_ptr< CompositeWriter > open_composite_writer(const std::string &filepath, const Kakshya::CompositeLayout &layout)
Open a Composite writer selected by the output file format.
@ FileIO
Filesystem I/O operations.
@ API
MayaFlux/API Wrapper and convenience functions.

References MayaFlux::Journal::API, MayaFlux::Journal::FileIO, MF_ERROR, MF_INFO, open_composite_writer(), and rows.

+ Here is the call graph for this function: