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

Holds the file formats of detector events that can be read, selects the most suitable of them for a file, and opens the file with it. More...

#include <vitrio/detector_event_timeline_file_read_format_selector.hpp>

Public Member Functions

 detector_event_timeline_file_read_format_selector ()
 Construct a selector with no formats.
 
 detector_event_timeline_file_read_format_selector (const detector_event_timeline_file_read_format_selector &other)=delete
 
 detector_event_timeline_file_read_format_selector (detector_event_timeline_file_read_format_selector &&other)=delete
 
detector_event_timeline_file_read_format_selector & operator= (const detector_event_timeline_file_read_format_selector &other)=delete
 
detector_event_timeline_file_read_format_selector & operator= (detector_event_timeline_file_read_format_selector &&other)=delete
 
void register_builtin_formats ()
 Register the formats bundled with the library.
 
bool register_format (std::unique_ptr< detector_event_timeline_file_read_format > format)
 Register a new format.
 
std::shared_ptr< detector_event_timeline_reader > open (const std::string &path) const
 Open a file for reading with the most suitable format.
 
const detector_event_timeline_file_read_format * get_most_suitable_format (const image_file_probe &probe) const
 Get the format that would open a file, without opening it.
 

Static Public Member Functions

static const std::shared_ptr< detector_event_timeline_file_read_format_selector > & get_shared ()
 Get the selector every use may share.
 

Detailed Description

Holds the file formats of detector events that can be read, selects the most suitable of them for a file, and opens the file with it.

register_builtin_formats adds the formats bundled with the library, and register_format adds any other. get_shared is a selector that already holds the bundled ones.

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

Member Function Documentation

◆ get_most_suitable_format()

const detector_event_timeline_file_read_format * vitrio::detector_event_timeline_file_read_format_selector::get_most_suitable_format ( const image_file_probe &  probe) const

Get the format that would open a file, without opening it.

Parameters
probeThe file under consideration.
Returns
const detector_event_timeline_file_read_format* The most suitable format, or nullptr when none recognizes probe.

◆ get_shared()

static const std::shared_ptr< detector_event_timeline_file_read_format_selector > & vitrio::detector_event_timeline_file_read_format_selector::get_shared ( )
static

Get the selector every use may share.

It holds the formats bundled with the library. A format registered on it is seen by everyone that shares it.

Returns
const std::shared_ptr<...>& The selector. Never null.

◆ open()

std::shared_ptr< detector_event_timeline_reader > vitrio::detector_event_timeline_file_read_format_selector::open ( const std::string &  path) const

Open a file for reading with the most suitable format.

Reads the head of the file once and shows it to every registered format, then opens the file with whichever reported the highest suitability.

Parameters
pathPath to the file to open, or any other locator a registered format claims, such as the address of a remote file.
Returns
std::shared_ptr<detector_event_timeline_reader> The opened reader, never null.
Exceptions
image_file_errorIf no registered format claims the path and no readable file exists there.
unsupported_operation_errorIf no registered format recognizes the file, which exists.
image_file_format_errorIf the file is malformed or truncated.

◆ register_format()

bool vitrio::detector_event_timeline_file_read_format_selector::register_format ( std::unique_ptr< detector_event_timeline_file_read_format >  format)

Register a new format.

Parameters
formatThe format to be registered.
Returns
true The format was successfully registered.
false The format was null.

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