ome-files  0.1.1
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
ome::files::FormatHandler Class Referenceabstract

Interface for all biological file format readers and writers. More...

#include <ome/files/FormatHandler.h>

+ Inheritance diagram for ome::files::FormatHandler:

Public Member Functions

virtual ~FormatHandler ()
 Destructor.
 
virtual bool isThisType (const boost::filesystem::path &name, bool open=true) const =0
 Check if the given file is a valid instance of this file format. More...
 
virtual const std::string & getFormat () const =0
 Get the name of this file format. More...
 
virtual const std::string & getFormatDescription () const =0
 Get the description of this file format. More...
 
virtual const std::vector< boost::filesystem::path > & getSuffixes () const =0
 Get the default file suffixes for this file format. More...
 
virtual const std::vector< boost::filesystem::path > & getCompressionSuffixes () const =0
 Get the default compression suffixes for this file format. More...
 
virtual void setId (const boost::filesystem::path &id)=0
 Set the current file name. More...
 
virtual void close (bool fileOnly=false)=0
 Close the currently open file. More...
 

Static Public Member Functions

static bool checkSuffix (const boost::filesystem::path &name, const boost::filesystem::path &suffix)
 Perform suffix matching for the given filename. More...
 
static bool checkSuffix (const boost::filesystem::path &name, const std::vector< boost::filesystem::path > &suffixes)
 Perform suffix matching for the given filename. More...
 
static bool checkSuffix (const boost::filesystem::path &name, const std::vector< boost::filesystem::path > &suffixes, const std::vector< boost::filesystem::path > &compression_suffixes)
 Perform suffix matching for the given filename. More...
 
static void assertId (const boost::optional< boost::filesystem::path > &id, bool notNull=true)
 Assert that the current file is valid. More...
 

Protected Member Functions

 FormatHandler ()
 Constructor.
 

Private Member Functions

 FormatHandler (const FormatHandler &)
 Copy constructor (deleted).
 
FormatHandleroperator= (const FormatHandler &)
 Assignment operator (deleted).
 

Detailed Description

Interface for all biological file format readers and writers.

Note
The Java implementation includes a getNativeDataType method; this is not included in this implementation.

Member Function Documentation

static void ome::files::FormatHandler::assertId ( const boost::optional< boost::filesystem::path > &  id,
bool  notNull = true 
)
inlinestatic

Assert that the current file is valid.

Assert if the current file is null, or not, according to the given flag. If the assertion fails, an exception is thrown.

Parameters
idFilename to test.
notNulltrue if id should be non-null, false if id should be null.
Exceptions
std::logic_errorif the assertion fails.

Referenced by ome::files::detail::FormatWriter::changeOutputFile(), ome::files::detail::FormatReader::FormatReader(), ome::files::detail::FormatWriter::FormatWriter(), ome::files::detail::FormatReader::getBitsPerPixel(), ome::files::detail::FormatReader::getCoreMetadataList(), ome::files::detail::FormatReader::getDimensionOrder(), ome::files::in::OMETIFFReader::getDomains(), ome::files::detail::FormatReader::getDomains(), ome::files::detail::FormatReader::getImageCount(), ome::files::detail::FormatWriter::getIndex(), ome::files::detail::FormatReader::getIndex(), ome::files::in::MinimalTIFFReader::getLookupTable(), ome::files::in::OMETIFFReader::getLookupTable(), ome::files::detail::FormatReader::getLookupTable(), ome::files::in::OMETIFFReader::getOptimalTileHeight(), ome::files::detail::FormatReader::getOptimalTileHeight(), ome::files::in::OMETIFFReader::getOptimalTileWidth(), ome::files::detail::FormatReader::getOptimalTileWidth(), ome::files::detail::FormatReader::getPixelType(), ome::files::detail::FormatWriter::getPlane(), ome::files::detail::FormatReader::getPlane(), ome::files::detail::FormatReader::getResolutionCount(), ome::files::detail::FormatWriter::getSeries(), ome::files::detail::FormatReader::getSeriesCount(), ome::files::detail::FormatReader::getSeriesMetadata(), ome::files::detail::FormatReader::getSeriesMetadataValue(), ome::files::in::OMETIFFReader::getSeriesUsedFiles(), ome::files::detail::FormatReader::getSizeC(), ome::files::detail::FormatReader::getSizeT(), ome::files::detail::FormatReader::getSizeX(), ome::files::detail::FormatReader::getSizeY(), ome::files::detail::FormatReader::getSizeZ(), ome::files::detail::FormatReader::getThumbSize(), ome::files::detail::FormatWriter::getZCTCoords(), ome::files::detail::FormatReader::getZCTCoords(), ome::files::detail::FormatReader::getZCTModuloCoords(), ome::files::detail::FormatReader::isFalseColor(), ome::files::detail::FormatReader::isIndexed(), ome::files::detail::FormatReader::isInterleaved(), ome::files::detail::FormatReader::isLittleEndian(), ome::files::detail::FormatReader::isMetadataComplete(), ome::files::detail::FormatReader::isOrderCertain(), ome::files::detail::FormatReader::isRGB(), ome::files::detail::FormatReader::isThumbnailSeries(), ome::files::in::MinimalTIFFReader::openBytesImpl(), ome::files::in::OMETIFFReader::openBytesImpl(), ome::files::detail::FormatReader::openThumbBytes(), ome::files::out::MinimalTIFFWriter::saveBytes(), ome::files::out::OMETIFFWriter::saveBytes(), ome::files::detail::FormatWriter::saveBytes(), ome::files::detail::FormatReader::setFlattenedResolutions(), ome::files::detail::FormatReader::setGroupFiles(), ome::files::detail::FormatWriter::setLookupTable(), ome::files::detail::FormatReader::setMetadataFiltered(), ome::files::detail::FormatWriter::setMetadataRetrieve(), ome::files::detail::FormatReader::setMetadataStore(), ome::files::detail::FormatReader::setNormalized(), ome::files::detail::FormatReader::setOriginalMetadataPopulated(), ome::files::detail::FormatWriter::setPlane(), ome::files::detail::FormatReader::setPlane(), and ome::files::detail::FormatWriter::setSeries().

+ Here is the caller graph for this function:

static bool ome::files::FormatHandler::checkSuffix ( const boost::filesystem::path &  name,
const boost::filesystem::path &  suffix 
)
inlinestatic

Perform suffix matching for the given filename.

Parameters
namethe name to check.
suffixthe suffix to match.
Returns
true if the suffix is suppored, false otherwise.

Referenced by checkSuffix(), ome::files::in::OMETIFFReader::initFile(), ome::files::in::OMETIFFReader::isSingleFile(), ome::files::in::OMETIFFReader::isThisType(), ome::files::detail::FormatWriter::isThisType(), and ome::files::detail::FormatReader::isThisType().

+ Here is the caller graph for this function:

static bool ome::files::FormatHandler::checkSuffix ( const boost::filesystem::path &  name,
const std::vector< boost::filesystem::path > &  suffixes 
)
inlinestatic

Perform suffix matching for the given filename.

Parameters
namethe name to check.
suffixesthe suffixes to match.
Returns
true if the suffix is suppored, false otherwise.

References checkSuffix().

static bool ome::files::FormatHandler::checkSuffix ( const boost::filesystem::path &  name,
const std::vector< boost::filesystem::path > &  suffixes,
const std::vector< boost::filesystem::path > &  compression_suffixes 
)
inlinestatic

Perform suffix matching for the given filename.

Parameters
namethe name to check.
suffixesthe suffixes to match.
compression_suffixesthe compression suffixes to match.
Returns
true if the suffix is suppored, false otherwise.

References checkSuffix().

virtual void ome::files::FormatHandler::close ( bool  fileOnly = false)
pure virtual

Close the currently open file.

An exception may be thrown when closing the file, for example if there are problems flushing any pending writes, or if there are any inconsistencies in the metadata which prevent completing any final writes. The causes are reader- or writer-dependent, and the exception type is dependent upon the implementation details of the reader or writer in use. It is advised to always explicitly close writers, since if this is automatically called at destruction time, any errors will be lost. If an exception is thrown, the object may be left in an inconsistent state and should not be reused.

Parameters
fileOnlyclose the open file only if true, or else free all internal state if false; only meaningful for readers, since writers will always free all internal state.
Exceptions
Onerror; exception type may vary.

Implemented in ome::files::detail::FormatReader, ome::files::detail::FormatWriter, ome::files::in::OMETIFFReader, ome::files::out::OMETIFFWriter, ome::files::in::MinimalTIFFReader, ome::files::out::MinimalTIFFWriter, and ome::files::in::TIFFReader.

Referenced by ~FormatHandler().

+ Here is the caller graph for this function:

virtual const std::vector<boost::filesystem::path>& ome::files::FormatHandler::getCompressionSuffixes ( ) const
pure virtual

Get the default compression suffixes for this file format.

Returns
a list of file suffixes.

Implemented in ome::files::detail::FormatReader, and ome::files::detail::FormatWriter.

Referenced by ~FormatHandler().

+ Here is the caller graph for this function:

virtual const std::string& ome::files::FormatHandler::getFormat ( ) const
pure virtual

Get the name of this file format.

Returns
the file format name.

Implemented in ome::files::detail::FormatReader, and ome::files::detail::FormatWriter.

Referenced by ~FormatHandler().

+ Here is the caller graph for this function:

virtual const std::string& ome::files::FormatHandler::getFormatDescription ( ) const
pure virtual

Get the description of this file format.

Returns
the file format description.

Implemented in ome::files::detail::FormatReader, and ome::files::detail::FormatWriter.

Referenced by ~FormatHandler().

+ Here is the caller graph for this function:

virtual const std::vector<boost::filesystem::path>& ome::files::FormatHandler::getSuffixes ( ) const
pure virtual

Get the default file suffixes for this file format.

Returns
a list of file suffixes.

Implemented in ome::files::detail::FormatReader, and ome::files::detail::FormatWriter.

Referenced by ~FormatHandler().

+ Here is the caller graph for this function:

virtual bool ome::files::FormatHandler::isThisType ( const boost::filesystem::path &  name,
bool  open = true 
) const
pure virtual

Check if the given file is a valid instance of this file format.

Parameters
namethe file to open for checking.
openIf true, and the file extension is insufficient to determine the file type, the file may be opened for further analysis, or other relatively expensive file system operations (such as file existence tests and directory listings) may be performed. If false, file system access is not allowed.
Returns
true if the file is valid, false otherwise.
Todo:
Could this method be static?

Implemented in ome::files::detail::FormatReader, ome::files::detail::FormatWriter, ome::files::FormatReader, and ome::files::in::OMETIFFReader.

Referenced by ~FormatHandler().

+ Here is the caller graph for this function:

virtual void ome::files::FormatHandler::setId ( const boost::filesystem::path &  id)
pure virtual

Set the current file name.

Note this will throw FormatException if there are problems opening the file.

Parameters
idthe filename to open.

Implemented in ome::files::detail::FormatReader, ome::files::detail::FormatWriter, ome::files::out::OMETIFFWriter, and ome::files::out::MinimalTIFFWriter.

Referenced by ome::files::out::MinimalTIFFWriter::setId(), and ~FormatHandler().

+ Here is the caller graph for this function:


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