|
vitrio 0.3.1
High-throughput image I/O for Cryo-Electron Microscopy (CryoEM)
|
Where a scratch keeps its copies: a block of bytes, in main memory or in a file, which it reads and writes through the operations of the storage. More...
#include <vitrio/image_scratch_storage.hpp>
Public Member Functions | |
| image_scratch_storage (const image_scratch_storage &other)=delete | |
| image_scratch_storage (image_scratch_storage &&other)=delete | |
| image_scratch_storage & | operator= (const image_scratch_storage &other)=delete |
| image_scratch_storage & | operator= (image_scratch_storage &&other)=delete |
| virtual std::size_t | get_size () const noexcept=0 |
| Get the size of the block. | |
| virtual void | read (std::size_t offset, span< byte > bytes) const =0 |
| Read bytes of the block, before this returns. | |
| virtual void | write (std::size_t offset, span< const byte > bytes)=0 |
| Write bytes of the block, before this returns. | |
| 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. | |
| 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 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. | |
Where a scratch keeps its copies: a block of bytes, in main memory or in a file, which it reads and writes through the operations of the storage.
The copies are values laid out in the block as an array_descriptor states: its extents and strides, in elements of its data type, and its offset, in elements from the first byte of the block, which a value of that type is aligned at. The storage serves regions of them into arrays and takes regions of files into them, asynchronously, as transfers do: either reports exactly once, a failure is reported rather than thrown, and only a null notifier throws. Besides them the block holds a few bytes of the scratch's own, such as which copies are whole, which are read and written on the calling thread, or written as a transfer.
|
pure virtualnoexcept |
Get the size of the block.
|
pure virtual |
Start taking regions of a file into values the block holds.
The file is the file side of the plan, as in image_reader::read_async, and the values its array side.
| file | A reader over the file, which is kept until the outcome is reported: the storage may read it later. Must not be null. |
| values | Where the values lie in the block. Within it. |
| regions | The regions, at their position in the file, and where each one lands among the values. |
| done | Where the outcome is reported, which is what reading the file reports, or what writing the block fails with, such as an std::invalid_argument for a null file. Must not be null. |
| std::invalid_argument | If done is null. |
|
pure virtual |
Read bytes of the block, before this returns.
| offset | Where the bytes start, from the first of the block. |
| bytes | Where they go: as many as are read. |
| std::out_of_range | If the bytes reach past the block. |
| image_file_error | If the block can not be read. |
|
pure virtual |
Start reading regions of values the block holds into an array.
The values are the file side of the plan, as a file is to image_reader::read_async, and destination its array side: the same values land on the same elements, converted the same way, and the transfer keeps destination until it reports.
| values | Where the values lie in the block. Within it. |
| destination | Where the regions land. |
| regions | The regions, at their position among the values, and where each one lands. |
| done | Where the outcome is reported. Must not be null. |
| std::invalid_argument | If done is null. |
|
pure virtual |
Write bytes of the block, before this returns.
| offset | Where the bytes start, from the first of the block. |
| bytes | What is written: as many as are written. |
| std::out_of_range | If the bytes reach past the block. |
| image_file_error | If the block can not be written. |
|
pure virtual |
Start writing bytes of the block, as a transfer.
| offset | Where the bytes start, from the first of the block. |
| bytes | What is written, which is copied before this returns. |
| done | Where the outcome is reported: once the bytes are written, or with what failed them, such as an std::out_of_range for bytes that reach past the block. Must not be null. |
| std::invalid_argument | If done is null. |