vitrio 0.3.1
High-throughput image I/O for Cryo-Electron Microscopy (CryoEM)
Loading...
Searching...
No Matches
image_scratch_storage.hpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2
3#pragma once
4
5#include <vitrio/array/array.hpp>
6#include <vitrio/byte.hpp>
7#include <vitrio/export.hpp>
8#include <vitrio/image_transfer_plan.hpp>
9#include <vitrio/span.hpp>
10
11#include <cstddef>
12#include <memory>
13
14namespace vitrio
15{
16
19class image_reader;
20
40class VITRIO_API image_scratch_storage
41{
42public:
43 image_scratch_storage() noexcept;
44 image_scratch_storage(const image_scratch_storage &other) = delete;
45 image_scratch_storage(image_scratch_storage &&other) = delete;
46 virtual ~image_scratch_storage();
47
48 image_scratch_storage&
49 operator=(const image_scratch_storage &other) = delete;
50 image_scratch_storage& operator=(image_scratch_storage &&other) = delete;
51
57 virtual std::size_t get_size() const noexcept = 0;
58
67 virtual void read(std::size_t offset, span<byte> bytes) const = 0;
68
77 virtual void write(std::size_t offset, span<const byte> bytes) = 0;
78
89 virtual void write_async(
90 std::size_t offset,
91 span<const byte> bytes,
92 std::shared_ptr<completion_notifier> done
93 ) = 0;
94
110 virtual void serve_async(
111 const array_descriptor &values,
112 array destination,
113 image_transfer_plan regions,
114 std::shared_ptr<completion_notifier> done
115 ) const = 0;
116
133 virtual void load_async(
134 std::shared_ptr<const image_reader> file,
135 const array_descriptor &values,
136 image_transfer_plan regions,
137 std::shared_ptr<completion_notifier> done
138 ) = 0;
139};
140
141} // namespace vitrio
How a block of memory is read as a multidimensional array.
Definition array_descriptor.hpp:31
A multidimensional array of numbers in host memory.
Definition array.hpp:37
Where a finished unit of work is reported.
Definition completion_notifier.hpp:20
Abstract read-only view of one image file.
Definition image_reader.hpp:38
virtual void serve_async(const array_descriptor &values, array destination, image_transfer_plan regions, std::shared_ptr< completion_notifier > done) const =0
Start reading regions of values the block holds into an array.
virtual std::size_t get_size() const noexcept=0
Get the size of the block.
virtual void write(std::size_t offset, span< const byte > bytes)=0
Write bytes of the block, before this returns.
virtual void read(std::size_t offset, span< byte > bytes) const =0
Read bytes of the block, before this returns.
virtual void load_async(std::shared_ptr< const image_reader > file, const array_descriptor &values, image_transfer_plan regions, std::shared_ptr< completion_notifier > done)=0
Start taking regions of a file into values the block holds.
virtual void write_async(std::size_t offset, span< const byte > bytes, std::shared_ptr< completion_notifier > done)=0
Start writing bytes of the block, as a transfer.
The regions to transfer between one file and one array.
Definition image_transfer_plan.hpp:34
A view of a contiguous sequence of elements.
Definition span.hpp:29