|
vitrio 0.3.1
High-throughput image I/O for Cryo-Electron Microscopy (CryoEM)
|
What a scratch holds of one image file. More...
#include <vitrio/image_scratch_entry.hpp>
Public Member Functions | |
| image_scratch_entry (const image_scratch_entry &other)=delete | |
| image_scratch_entry (image_scratch_entry &&other)=delete | |
| image_scratch_entry & | operator= (const image_scratch_entry &other)=delete |
| image_scratch_entry & | operator= (image_scratch_entry &&other)=delete |
| virtual image_transfer_plan | read_async (array destination, image_transfer_plan regions, std::shared_ptr< completion_notifier > done) const =0 |
| Start reading the regions of a plan that are held, and answer the rest. | |
| virtual void | store_async (std::shared_ptr< const image_reader > file, image_transfer_plan regions, std::shared_ptr< completion_notifier > done)=0 |
| Take in regions of the file, out of a reader over it, and report once they are held. | |
What a scratch holds of one image file.
A copy of some of what the file holds, kept where it is faster to reach than the file. Which parts of the file an entry keeps, and how it keeps them, is implementation's own business. It is asked in regions of the file: a read is answered with the regions it did not serve, and it takes in what it has room for of the regions it is offered.
Nothing an entry has taken in is dropped, so a region it once served it serves from then on.
|
pure virtual |
Start reading the regions of a plan that are held, and answer the rest.
The file is the file side of the plan and destination its array side, as in image_reader::read_async, and a region that is held is read as that would read it: the same values land on the same elements, converted the same way.
A region is held when everything it spans is. One that is held only in part is not read at all, and neither is a plan that does not have the rank of the file.
The read of what is held may still be under way when this returns. It reports to done exactly once, as a read of a file does: when every region that is held has landed, at once if none is, or with what made it fail. It keeps destination until then.
| destination | Where the regions that are held are written. |
| regions | The regions to read and where each one lands. |
| done | Where the outcome is reported. Must not be null. |
regions and in the order they have in it. Empty when every region is, and all of them when the read fails at once. | std::invalid_argument | If done is null. Every other failure is reported to done, as that of a read of a file is. |
|
pure virtual |
Take in regions of the file, out of a reader over it, and report once they are held.
Takes in what it has room for of what the regions span, and may take in more of the file than they span. A region none of which it has room for is passed over, and so is a plan that does not have the rank of the file. What is already held is not read again, and what is already being taken in, by another call, is waited for rather than read again.
Only the file side of the plan plays a part.
Reports to done exactly once, when everything the regions need is held or failed to be. What failed to be taken in is not held, and the failure is reported, such as an image_file_format_error for a file that turns out to be malformed or truncated where it is read. Only a null notifier throws.
| file | A reader over the file this entry is of, which is kept until the outcome is reported. Must not be null. |
| regions | The regions to take in. |
| done | Where the outcome is reported. Must not be null. |
| std::invalid_argument | If done is null. |