vitrio 0.1.4
High-throughput image I/O for Cryo-Electron Microscopy (CryoEM)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
vitrio::image_scratch_entry Class Referenceabstract

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 (array_ref destination, const image_transfer_plan &regions) const =0
 Read the regions of a plan that are held, and answer the rest.
 
virtual void store (const image_reader &file, const image_transfer_plan &regions)=0
 Take in regions of the file, out of a reader over it.
 

Detailed Description

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.

Thread safety
Every method may be called concurrently.
See also
image_scratch

Member Function Documentation

◆ read()

virtual image_transfer_plan vitrio::image_scratch_entry::read ( array_ref  destination,
const image_transfer_plan &  regions 
) const
pure virtual

Read 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, 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.

Parameters
destinationWhere the regions that are held are written. Must be initialized.
regionsThe regions to read and where each one lands.
Returns
image_transfer_plan The regions that were not read, of the shape of regions and in the order they have in it. Empty when every region was read.
Exceptions
std::invalid_argumentIf destination is not initialized.
std::out_of_rangeIf a region that is held does not fit in destination where it is placed.
unsupported_operation_errorIf the data type of destination can not be produced from the one of the file.

◆ store()

virtual void vitrio::image_scratch_entry::store ( const image_reader &  file,
const image_transfer_plan &  regions 
)
pure virtual

Take in regions of the file, out of a reader over it.

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.

Only the file side of the plan plays a part.

If reading file fails, what was being taken in is not held.

Parameters
fileA reader over the file this entry is of.
regionsThe regions to take in.
Exceptions
image_file_format_errorIf the file turns out to be malformed or truncated where it is read.

The documentation for this class was generated from the following file: