vitrio 0.3.1
High-throughput image I/O for Cryo-Electron Microscopy (CryoEM)
Loading...
Searching...
No Matches
image_transfer_plan.hpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2
3#pragma once
4
5#include <vitrio/export.hpp>
6#include <vitrio/image_transfer_shape.hpp>
7#include <vitrio/index_table.hpp>
8#include <vitrio/span.hpp>
9
10#include <cstddef>
11
12namespace vitrio
13{
14
34{
35public:
44 VITRIO_API
46
47 VITRIO_API
49 VITRIO_API
51 VITRIO_API
53
54 VITRIO_API
55 image_transfer_plan& operator=(const image_transfer_plan &other);
56 VITRIO_API
57 image_transfer_plan& operator=(image_transfer_plan &&other) noexcept;
58
68 VITRIO_API
69 void add(
70 span<const std::size_t> file_offset,
71 span<const std::size_t> array_offset
72 );
73
77 VITRIO_API
78 void clear() noexcept;
79
85 VITRIO_API
86 void reserve(std::size_t count);
87
93 VITRIO_API
94 std::size_t get_region_count() const noexcept;
95
102 VITRIO_API
103 const image_transfer_shape& get_shape() const noexcept;
104
113 VITRIO_API
114 span<const std::size_t>
115 get_file_offset(std::size_t region_index) const noexcept;
116
125 VITRIO_API
126 span<const std::size_t>
127 get_array_offset(std::size_t region_index) const noexcept;
128
129private:
130 image_transfer_shape m_shape;
131 index_table m_file_offsets;
132 index_table m_array_offsets;
133};
134
135} // namespace vitrio
void add(span< const std::size_t > file_offset, span< const std::size_t > array_offset)
Append one region.
span< const std::size_t > get_file_offset(std::size_t region_index) const noexcept
Get where a region starts in the file.
image_transfer_plan(image_transfer_shape shape)
Construct an empty plan of a given shape.
span< const std::size_t > get_array_offset(std::size_t region_index) const noexcept
Get where a region starts in the array.
void reserve(std::size_t count)
Make room for a number of regions without allocating later.
void clear() noexcept
Drop the regions held, keeping the shape and the capacity.
std::size_t get_region_count() const noexcept
Get how many regions are held.
const image_transfer_shape & get_shape() const noexcept
Get the shape every region shares.
The shape every region of a transfer shares: the extents of one region and the ranks of the file and ...
Definition image_transfer_shape.hpp:32
A sequence of indices of one and the same rank.
Definition index_table.hpp:29
A view of a contiguous sequence of elements.
Definition span.hpp:29