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

◆ get_metadata()

std::optional< FileMetadata > MayaFlux::IO::TensorReader::get_metadata ( ) const
nodiscardoverridevirtual

Get metadata from the open file.

Returns
File metadata or nullopt if no file is open.

Implements MayaFlux::IO::FileReader.

Definition at line 39 of file TensorReader.cpp.

40{
41 if (!is_open())
42 return std::nullopt;
43
44 FileMetadata metadata;
45 metadata.format = format_name();
46 std::error_code error;
47 const auto size = std::filesystem::file_size(m_path, error);
48 metadata.file_size = error ? 0 : size;
49 return metadata;
50}
virtual bool is_open() const =0
Check if a file is currently open.
virtual std::string format_name() const =0
Format identifier such as safetensors or npy.
void error(Component component, Context context, std::source_location location, std::string_view message)
Log an error message and optionally throw an exception.

References MayaFlux::IO::FileMetadata::file_size, MayaFlux::IO::FileMetadata::format, format_name(), MayaFlux::IO::FileReader::is_open(), and m_path.

Here is the call graph for this function: