|
MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
|
Registry that picks a tensor reader or writer by name, content or extension. More...
#include <TensorFormat.hpp>
Public Member Functions | |
| std::unique_ptr< TensorReader > | create_reader (const std::string &filepath, std::string_view format={}) const |
| New reader for a file. | |
| std::unique_ptr< TensorWriter > | create_writer (const std::string &filepath, std::string_view format={}) const |
| New writer for a destination path. | |
| const TensorFormat * | detect (const std::string &filepath) const |
| Format recognised by content, then by extension, or nullptr. | |
| const TensorFormat * | find (std::string_view name) const |
| Format with this name, or nullptr. | |
| std::vector< std::string > | format_names () const |
| Names of all registered formats, in registration order. | |
| void | register_format (TensorFormat format) |
| Add a format, replacing any earlier one with the same name. | |
Static Public Member Functions | |
| static TensorFormatRegistry & | instance () |
| The process-wide registry. | |
Private Member Functions | |
| const TensorFormat * | by_extension (const std::string &filepath, bool need_writer) const |
Private Attributes | |
| std::vector< TensorFormat > | m_formats |
Registry that picks a tensor reader or writer by name, content or extension.
Reading tries an explicit format name first, then content probes in registration order, then the file extension. Writing, where no file exists yet, tries the name and then the extension. A format is added by calling register_format(); nothing else needs to change.
Usage:
Definition at line 40 of file TensorFormat.hpp.