vitrio 0.1.4
High-throughput image I/O for Cryo-Electron Microscopy (CryoEM)
Loading...
Searching...
No Matches
image_transaction_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/interned_key_list.hpp>
9#include <vitrio/span.hpp>
10
11#include <cstddef>
12#include <string>
13
14namespace vitrio
15{
16
33{
34public:
45
52
57 operator=(image_transaction_plan &&other) noexcept;
58
70 std::size_t add_file(std::string key);
71
85 void add(
86 std::size_t file_index,
89 );
90
97
105 void reserve(std::size_t files, std::size_t regions);
106
114
123
133
143 const std::string& get_file(std::size_t file_index) const noexcept;
144
153 std::size_t get_region_file(std::size_t region_index) const noexcept;
154
164 span<const std::size_t>
166
176 span<const std::size_t>
178
179private:
180 image_transfer_shape m_shape;
181 interned_key_list m_files;
182 index_table m_file_offsets;
183 index_table m_array_offsets;
184};
185
186} // namespace vitrio
List of regions to transfer between many files and one array.
Definition image_transaction_plan.hpp:33
std::size_t get_file_count() const noexcept
Get how many distinct files the regions may address.
const std::string & get_file(std::size_t file_index) const noexcept
Get the key of one of the files.
const image_transfer_shape & get_shape() const noexcept
Get the shape every region shares.
std::size_t get_region_count() const noexcept
Get how many regions are held.
std::size_t add_file(std::string key)
Name a file the regions may address.
std::size_t get_region_file(std::size_t region_index) const noexcept
Get which file one region addresses.
void add(std::size_t file_index, span< const std::size_t > file_offset, span< const std::size_t > array_offset)
Append one region.
image_transaction_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 clear() noexcept
Drop the files and the regions, keeping the shape and the capacity.
void reserve(std::size_t files, std::size_t regions)
Make room without allocating later.
span< const std::size_t > get_file_offset(std::size_t region_index) const noexcept
Get where a region starts in its file.
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 list of keys in which equal keys are held once.
Definition interned_key_list.hpp:32
A view of a contiguous sequence of elements.
Definition span.hpp:29