|
vitrio 0.1.4
High-throughput image I/O for Cryo-Electron Microscopy (CryoEM)
|
The regions to transfer between one file and one array. More...
#include <vitrio/image_transfer_plan.hpp>
Public Member Functions | |
| image_transfer_plan (image_transfer_shape shape) | |
| Construct an empty plan of a given shape. | |
| image_transfer_plan (const image_transfer_plan &other) | |
| image_transfer_plan (image_transfer_plan &&other) noexcept | |
| image_transfer_plan & | operator= (const image_transfer_plan &other) |
| image_transfer_plan & | operator= (image_transfer_plan &&other) noexcept |
| void | add (span< const std::size_t > file_offset, span< const std::size_t > array_offset) |
| Append one region. | |
| void | clear () noexcept |
| Drop the regions held, keeping the shape and the capacity. | |
| void | reserve (std::size_t count) |
| Make room for a number of regions 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. | |
| span< const std::size_t > | get_file_offset (std::size_t region_index) const noexcept |
| Get where a region starts in the file. | |
| span< const std::size_t > | get_array_offset (std::size_t region_index) const noexcept |
| Get where a region starts in the array. | |
The regions to transfer between one file and one array.
Every region pairs an offset into the file with an offset into the array, and every region in a plan shares one image_transfer_shape. The two sides are named file and array rather than source and destination, so the same plan describes a read and a write alike.
The shape is fixed when a plan is constructed; only the regions come and go.
The offsets are held in two index_table rather than one allocation per region, so any number of regions costs a bounded number of allocations, and clear keeps the capacity, so a plan refilled after its first use allocates nothing.
|
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 regions are added and dropped.
| shape | The shape of every region. |
| void vitrio::image_transfer_plan::add | ( | span< const std::size_t > | file_offset, |
| span< const std::size_t > | array_offset | ||
| ) |
Append one region.
| 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::invalid_argument | If either offset has the wrong rank. |
|
noexcept |
Get where a region starts in the array.
| region_index | Index of the region. Must be below get_region_count. |
|
noexcept |
Get where a region starts in the file.
| region_index | Index of the region. Must be below get_region_count. |
|
noexcept |
Get how many regions are held.
|
noexcept |
Get the shape every region shares.
| void vitrio::image_transfer_plan::reserve | ( | std::size_t | count | ) |
Make room for a number of regions without allocating later.
| count | Number of regions to make room for. |