|
vitrio 0.3.1
High-throughput image I/O for Cryo-Electron Microscopy (CryoEM)
|
A writer that writes on the calling thread. More...
#include <vitrio/synchronous_image_writer.hpp>


Public Member Functions | |
| void | write_async (const_array source, image_transfer_plan regions, std::shared_ptr< completion_notifier > done) final |
| Start writing a set of hyperrectangles of the file from one array. | |
| void | flush_async (std::shared_ptr< completion_notifier > done) final |
| Start making what has been written reach the storage. | |
| virtual void | write (const_array_ref source, const image_transfer_plan ®ions)=0 |
| Write a set of hyperrectangles of the file from one array, all before returning. | |
| virtual void | flush ()=0 |
| Make what has been written reach the storage, before returning. | |
| Public Member Functions inherited from vitrio::image_writer | |
| image_writer (const image_writer &other)=delete | |
| image_writer (image_writer &&other)=delete | |
| image_writer & | operator= (const image_writer &other)=delete |
| image_writer & | operator= (image_writer &&other)=delete |
| virtual const image_descriptor & | get_descriptor () const noexcept=0 |
| Get the shape and data type of the file. | |
A writer that writes on the calling thread.
Its write and flush are done before they return, and write_async and flush_async are those, reported to their notifiers before they return. A writer whose work belongs on the thread that asks for it implements write and flush alone.
|
pure virtual |
Make what has been written reach the storage, before returning.
| image_file_error | If what has been written could not reach the storage. |
|
finalvirtual |
Start making what has been written reach the storage.
What has been written is what every write that reported to its notifier before this was called wrote. A write still under way is not covered.
Call this before dropping a writer whose failures matter. A writer flushes itself when it is destroyed, but a destructor can not report a failure, so a write that only fails on the way out is lost unless it was flushed explicitly.
The flush may still be under way when this returns. It reports to done exactly once: when what has been written has reached the storage, or with what made it fail.
| done | Where the outcome is reported. Must not be null. |
| std::invalid_argument | If done is null. Every other failure is reported to done rather than thrown: image_file_error if what has been written could not reach the storage. |
Flushes as flush does, and reports to done before returning.
Implements vitrio::image_writer.
|
pure virtual |
Write a set of hyperrectangles of the file from one array, all before returning.
As image_writer::write_async describes, except that it is done when it returns and a failure is thrown. source must outlive the call, and no longer.
| source | The values to write. Must be initialized. |
| regions | The regions to write and where each one comes from. |
| std::invalid_argument,std::out_of_range,unsupported_operation_error,image_file_error | As image_writer::write_async reports them. |
|
finalvirtual |
Start writing a set of hyperrectangles of the file from one array.
The mirror of image_reader::read_async, sharing its plan and naming its sides the same way: the file is the file side and source the array side, so every region names where it is taken from in source and where it lands in the file, and all of them share the extents the plan carries. The plan is therefore built the same way for a write as for a read. Passing every region in one call lets a writer order and merge the accesses it is about to make, and pays for the source's geometry once.
source is the whole array and may be strided. Its rank must be the array rank of the plan and the file's the file rank, and values are converted as a cast between the two types does, without scaling or normalising.
Regions that do not overlap may be written by concurrent calls. Overlapping ones may not, and where two regions of one call land on the same elements of the file, which one prevails is unspecified.
A region that is never written keeps whatever the format leaves in a file it has laid out but not filled. An empty plan writes nothing and reports success.
The write may still be under way when this returns. It reports to done exactly once: when every region has been written, or with what made it fail. It keeps source, and with it the memory it writes from, until then.
| source | The values to write. Must be initialized. |
| regions | The regions to write and where each one comes from. |
| done | Where the outcome is reported. Must not be null. |
| std::invalid_argument | If done is null. Every other failure is reported to done rather than thrown:
|
Writes as write does, and reports to done before returning.
Implements vitrio::image_writer.