|
vitrio 0.1.4
High-throughput image I/O for Cryo-Electron Microscopy (CryoEM)
|
Inmutable brief representation of a file. More...
#include <vitrio/image_file_probe.hpp>
Public Member Functions | |
| image_file_probe (std::string path) | |
| Construct a probe by reading the leading bytes of a file. | |
| image_file_probe (const image_file_probe &other) | |
| image_file_probe (image_file_probe &&other) noexcept | |
| image_file_probe & | operator= (const image_file_probe &other) |
| image_file_probe & | operator= (image_file_probe &&other) noexcept |
| const std::string & | get_path () const noexcept |
| Get the path of the probed file. | |
| const std::string & | get_extension () const noexcept |
| Get the extension of the probed file. | |
| span< const byte > | get_leading_bytes () const noexcept |
| Get the leading bytes of the probed file. | |
| bool | exists () const noexcept |
| Check whether the probed file exists and could be read. | |
Static Public Attributes | |
| static constexpr std::size_t | max_leading_bytes = 4096 |
| Most bytes a probe reads off the front of a file. | |
Inmutable brief representation of a file.
It reads the leading bytes once, when it is constructed, and never changes afterwards, so one probe can be shown to any number of formats and shared between threads.
A file that does not exist yields a probe with no leading bytes rather than an error, so a probe can name a file yet to be created, and what fits it then rests on the extension alone.
|
explicit |
Construct a probe by reading the leading bytes of a file.
Reads at most max_leading_bytes bytes, fewer when the file is shorter and none when it does not exist or can not be read.
| path | Path to the file to probe. |
|
noexcept |
Check whether the probed file exists and could be read.
|
noexcept |
Get the extension of the probed file.
Folded to lower case and including the leading dot. Empty when the file name has no extension.
Get the leading bytes of the probed file.
At most max_leading_bytes bytes, and fewer when the file is shorter. They are the front of the file and nothing more: what counts as its header is up to each format.
|
noexcept |
Get the path of the probed file.