|
vitrio 0.1.4
High-throughput image I/O for Cryo-Electron Microscopy (CryoEM)
|
List of regions to transfer between many files and one array. More...
#include <vitrio/image_transaction_plan.hpp>
Public Member Functions | |
| image_transaction_plan (image_transfer_shape shape) | |
| Construct an empty plan of a given shape. | |
| image_transaction_plan (const image_transaction_plan &other) | |
| image_transaction_plan (image_transaction_plan &&other) noexcept | |
| image_transaction_plan & | operator= (const image_transaction_plan &other) |
| image_transaction_plan & | operator= (image_transaction_plan &&other) noexcept |
| std::size_t | add_file (std::string key) |
| Name a file the regions may address. | |
| void | add (std::size_t file_index, span< const std::size_t > file_offset, span< const std::size_t > array_offset) |
| Append one region. | |
| 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. | |
| 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. | |
| 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. | |
| std::size_t | get_region_file (std::size_t region_index) const noexcept |
| Get which file one region addresses. | |
| span< const std::size_t > | get_file_offset (std::size_t region_index) const noexcept |
| Get where a region starts in its file. | |
| span< const std::size_t > | get_array_offset (std::size_t region_index) const noexcept |
| Get where a region starts in the array. | |
List of regions to transfer between many files and one array.
Every region pairs an offset into a file with an offset into the array, names the file it belongs to, and shares one image_transfer_shape with every other region in the plan. The file rank of the shape is the rank of every file.
The shape is fixed when a plan is constructed; only the files and the regions come and go.
Regions are held in the order they were added, not grouped by file.
|
explicit |
Construct an empty plan of a given shape.
The shape is what every region of the plan shares and is fixed for the life of it; only the files and the regions are added and dropped.
| shape | The shape of every region. |
| void vitrio::image_transaction_plan::add | ( | std::size_t | file_index, |
| span< const std::size_t > | file_offset, | ||
| span< const std::size_t > | array_offset | ||
| ) |
Append one region.
| file_index | Index of the file it addresses, as add_file returned it. |
| file_offset | Index of the first element of the region in the file. Its size must equal the file rank of the shape. |
| array_offset | Index of the first element of the region in the array. Its size must equal the array rank of the shape. |
| std::out_of_range | If file_index names no file. |
| std::invalid_argument | If either offset has the wrong rank. |
| std::size_t vitrio::image_transaction_plan::add_file | ( | std::string | key | ) |
Name a file the regions may address.
A key equal to one already named yields the index it was given the first time, so the file of every region may be named without checking whether it has been named already.
| key | Key of the file. |
|
noexcept |
Get where a region starts in the array.
| region_index | Index of the region. Must be below get_region_count. |
|
noexcept |
Get the key of one of the files.
| file_index | Index of the file. Must be below get_file_count. |
|
noexcept |
Get how many distinct files the regions may address.
Counts every file named, including one no region addresses.
|
noexcept |
Get where a region starts in its file.
| region_index | Index of the region. Must be below get_region_count. |
|
noexcept |
Get how many regions are held.
|
noexcept |
Get which file one region addresses.
| region_index | Index of the region. Must be below get_region_count. |
|
noexcept |
Get the shape every region shares.
| void vitrio::image_transaction_plan::reserve | ( | std::size_t | files, |
| std::size_t | regions | ||
| ) |
Make room without allocating later.
| files | Number of distinct files to make room for. |
| regions | Number of regions to make room for. |