Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

fl::ImageFileFormat Class Reference

#include <image.h>

Inheritance diagram for fl::ImageFileFormat:

fl::ImageFileFormatEPS fl::ImageFileFormatJPEG fl::ImageFileFormatMatlab fl::ImageFileFormatPGM fl::ImageFileFormatTIFF List of all members.

Public Methods

 ImageFileFormat ()
virtual ~ImageFileFormat ()
virtual void read (const std::string &fileName, Image &image) const
virtual void read (std::istream &stream, Image &image) const=0
virtual void write (const std::string &fileName, const Image &image) const
virtual void write (std::ostream &stream, const Image &image) const=0
virtual bool isIn (std::istream &stream) const=0
 Determines if this format is on the stream. Always rewinds stream back to where it was when function was called.

virtual bool handles (const std::string &formatName) const=0
 Determines if this object handles the format with the given human readable name.


Static Public Methods

ImageFileFormat * find (const std::string &fileName)
 Determines what format the stream is in.

ImageFileFormat * find (std::istream &stream)
 Ditto. Always returns stream to original position.

ImageFileFormat * findName (const std::string &formatName)
 Determines what format to use based on given name.

void getMagic (std::istream &stream, std::string &magic)
 Attempts to read magic.size () worth of bytes from stream and return them in magic. Always returns stream to original position.


Static Public Attributes

std::vector< ImageFileFormat * > formats

Detailed Description

Danger! Not thread-safe. Need a mutex around modifications and accesses to static variable "formats". Add if there's ever a need to create and destroy formats on the fly with multiple threads trying to access the list. Translation of the above: it is very unlikely that in practice there will be a problem with the "unsafe" version. :)


Constructor & Destructor Documentation

ImageFileFormat::ImageFileFormat  
 

ImageFileFormat::~ImageFileFormat   [virtual]
 


Member Function Documentation

ImageFileFormat * ImageFileFormat::find std::istream &    stream [static]
 

Ditto. Always returns stream to original position.

ImageFileFormat * ImageFileFormat::find const std::string &    fileName [static]
 

Determines what format the stream is in.

ImageFileFormat * ImageFileFormat::findName const std::string &    formatName [static]
 

Determines what format to use based on given name.

void ImageFileFormat::getMagic std::istream &    stream,
std::string &    magic
[static]
 

Attempts to read magic.size () worth of bytes from stream and return them in magic. Always returns stream to original position.

Todo:
Currently there is no guarantee that the stream can actually rewind to the position at the beginning of the magic string. Some streams can go bad at this point because they don't support seekg(). One possibility is to use sputbackc() to return magic to the stream. This could still fail if magic straddles the boundary between buffer loads. Another possibility is to have ImageFileFormat::find() wrap the given stream in a special stream that can always put back at least 16 or so characters regardless of underlying state.

virtual bool fl::ImageFileFormat::handles const std::string &    formatName const [pure virtual]
 

Determines if this object handles the format with the given human readable name.

Implemented in fl::ImageFileFormatPGM, fl::ImageFileFormatEPS, fl::ImageFileFormatJPEG, fl::ImageFileFormatTIFF, and fl::ImageFileFormatMatlab.

virtual bool fl::ImageFileFormat::isIn std::istream &    stream const [pure virtual]
 

Determines if this format is on the stream. Always rewinds stream back to where it was when function was called.

Implemented in fl::ImageFileFormatPGM, fl::ImageFileFormatEPS, fl::ImageFileFormatJPEG, fl::ImageFileFormatTIFF, and fl::ImageFileFormatMatlab.

virtual void fl::ImageFileFormat::read std::istream &    stream,
Image   image
const [pure virtual]
 

Implemented in fl::ImageFileFormatPGM, fl::ImageFileFormatEPS, fl::ImageFileFormatJPEG, fl::ImageFileFormatTIFF, and fl::ImageFileFormatMatlab.

void ImageFileFormat::read const std::string &    fileName,
Image   image
const [virtual]
 

Reimplemented in fl::ImageFileFormatTIFF.

virtual void fl::ImageFileFormat::write std::ostream &    stream,
const Image   image
const [pure virtual]
 

Implemented in fl::ImageFileFormatPGM, fl::ImageFileFormatEPS, fl::ImageFileFormatJPEG, fl::ImageFileFormatTIFF, and fl::ImageFileFormatMatlab.

void ImageFileFormat::write const std::string &    fileName,
const Image   image
const [virtual]
 

Reimplemented in fl::ImageFileFormatTIFF.


Member Data Documentation

vector< ImageFileFormat * > ImageFileFormat::formats [static]
 


The documentation for this class was generated from the following files:
Generated on Thu Dec 9 17:13:25 2004 for fl by doxygen1.2.18