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

◆ open()

bool MayaFlux::IO::VolumeReader::open ( const std::string &  filepath,
FileReadOptions  options = FileReadOptions::ALL 
)
overridevirtual

Open a file for reading.

Parameters
filepathPath to the file.
optionsReading options (see FileReadOptions).
Returns
true if file was successfully opened.

Implements MayaFlux::IO::FileReader.

Definition at line 328 of file VolumeReader.cpp.

329{
330 close();
331
332 if (!can_read(filepath)) {
333 set_error("Unsupported volume format: " + filepath);
335 "VolumeReader: {}", m_last_error);
336 return false;
337 }
338
339 const auto resolved = resolve_path(filepath);
340
341 if (!m_archive->open(resolved)) {
342 set_error(std::string(m_archive->last_error()));
344 "VolumeReader: open failed for '{}' — {}", filepath, m_last_error);
345 return false;
346 }
347
348 m_filepath = filepath;
349 m_is_open = true;
350
352 "VolumeReader: opened '{}' — {} grid(s)",
353 std::filesystem::path(resolved).filename().string(),
354 m_archive->read_grid_count());
355
356 return true;
357}
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
static std::string resolve_path(const std::string &filepath)
Resolve a filepath against the project source root if not found as-is.
void set_error(std::string msg) const
std::unique_ptr< Detail::VDBArchive > m_archive
bool can_read(const std::string &filepath) const override
Check if a file can be read by this reader.
void close() override
Close the currently open file.
@ FileIO
Filesystem I/O operations.
@ IO
Networking, file handling, streaming.

References can_read(), close(), MayaFlux::Journal::FileIO, MayaFlux::Journal::IO, m_archive, m_filepath, m_is_open, m_last_error, MF_ERROR, MF_INFO, MayaFlux::IO::FileReader::resolve_path(), and set_error().

Referenced by load(), and load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: