vitrio 0.1.4
High-throughput image I/O for Cryo-Electron Microscopy (CryoEM)
Loading...
Searching...
No Matches
image_file_probe.hpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2
3#pragma once
4
5#include <vitrio/byte.hpp>
6#include <vitrio/export.hpp>
7#include <vitrio/span.hpp>
8
9#include <cstddef>
10#include <string>
11#include <vector>
12
13namespace vitrio
14{
15
28{
29public:
33 VITRIO_API
34 static constexpr std::size_t max_leading_bytes = 4096;
35
44 VITRIO_API
45 explicit image_file_probe(std::string path);
46
47 VITRIO_API
49 VITRIO_API
50 image_file_probe(image_file_probe &&other) noexcept;
51 VITRIO_API
53
54 VITRIO_API
55 image_file_probe& operator=(const image_file_probe &other);
56 VITRIO_API
57 image_file_probe& operator=(image_file_probe &&other) noexcept;
58
64 VITRIO_API
65 const std::string& get_path() const noexcept;
66
75 VITRIO_API
76 const std::string& get_extension() const noexcept;
77
88 VITRIO_API
89 span<const byte> get_leading_bytes() const noexcept;
90
98 VITRIO_API
99 bool exists() const noexcept;
100
101private:
102 std::string m_path;
103 std::string m_extension;
104 std::vector<byte> m_leading_bytes;
105 bool m_exists;
106};
107
108} // namespace vitrio
Inmutable brief representation of a file.
Definition image_file_probe.hpp:28
image_file_probe(std::string path)
Construct a probe by reading the leading bytes of a file.
span< const byte > get_leading_bytes() const noexcept
Get the leading bytes of the probed file.
const std::string & get_extension() const noexcept
Get the extension of the probed file.
bool exists() const noexcept
Check whether the probed file exists and could be read.
static constexpr std::size_t max_leading_bytes
Most bytes a probe reads off the front of a file.
Definition image_file_probe.hpp:34
const std::string & get_path() const noexcept
Get the path of the probed file.
A view of a contiguous sequence of elements.
Definition span.hpp:29