ISIS Core Library 0.7.2 (api 3.0.0)
Public Types | Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions | Static Protected Member Functions | Static Protected Attributes

isis::image_io::FileFormat Class Reference

Base class for image-io-plugins. More...

#include <io_interface.h>

Public Types

enum  io_modes { read_only = 1, write_only = 2, both = 3 }

Public Member Functions

virtual util::istring dialects (const std::string &) const
virtual std::string getName () const =0
std::list< util::istringgetSuffixes (io_modes mode=both) const
 get all file suffixes a plugin suggests to handle The string returned by suffixes is tokenized at the spaces and every leading "." is stripped.
virtual int load (std::list< data::Chunk > &chunks, const std::string &filename, const util::istring &dialect, boost::shared_ptr< util::ProgressFeedback > feedback)=0 throw ( std::runtime_error & )
 Load data into the given chunk list.
virtual std::pair< std::string,
std::string > 
makeBasename (const std::string &filename) const
 splits the suffix (and the ".") from the filename (or path) and returns a pair made of both parts
std::list< std::string > makeUniqueFilenames (const std::list< data::Image > &images, const std::string &namePattern) const
virtual bool tainted () const
virtual void write (const std::list< data::Image > &images, const std::string &filename, const util::istring &dialect, boost::shared_ptr< util::ProgressFeedback > feedback) throw ( std::runtime_error & )
 Write a image list.
virtual void write (const data::Image &image, const std::string &filename, const util::istring &dialect, boost::shared_ptr< util::ProgressFeedback > feedback)=0 throw ( std::runtime_error & )
 Write a single image to a file.
virtual ~FileFormat ()

Static Public Member Functions

static std::string makeFilename (const util::PropertyMap &img, std::string namePattern)
static void throwGenericError (std::string desc)
static void throwSystemError (int err, std::string desc="")

Data Fields

boost::filesystem::path plugin_file

Protected Member Functions

virtual util::istring suffixes (io_modes modes=both) const =0

Static Protected Member Functions

static bool hasOrTell (const util::PropertyMap::KeyType &name, const util::PropertyMap &object, LogLevel level)
 Check if a given property exists in the given PropMap.
static bool setGender (util::PropertyMap &object, const char *set, const char *entries="female,male,other")
 Check if a given property exists in the given PropMap.
template<typename TYPE >
static bool transformOrTell (const util::PropertyMap::KeyType &from, const util::PropertyMap::KeyType &to, util::PropertyMap &object, LogLevel level)
 Transform a given property into another and remove the original in the given PropMap.

Static Protected Attributes

static const float invalid_float = -std::numeric_limits<float>::infinity()

Detailed Description

Base class for image-io-plugins.

Definition at line 30 of file io_interface.h.


Member Enumeration Documentation

Enumerator:
read_only 
write_only 
both 

Definition at line 33 of file io_interface.h.


Constructor & Destructor Documentation

virtual isis::image_io::FileFormat::~FileFormat ( ) [inline, virtual]

Definition at line 133 of file io_interface.h.


Member Function Documentation

virtual util::istring isis::image_io::FileFormat::dialects ( const std::string &  ) const [inline, virtual]
Returns:
a space separated list of the dialects the plugin supports

Definition at line 93 of file io_interface.h.

virtual std::string isis::image_io::FileFormat::getName ( ) const [pure virtual]
Returns:
the name of the plugin
std::list< util::istring > isis::image_io::FileFormat::getSuffixes ( io_modes  mode = both) const

get all file suffixes a plugin suggests to handle The string returned by suffixes is tokenized at the spaces and every leading "." is stripped.

The result is returned in a string-list sorted by the length of the suffix (longest first).

Parameters:
modethe io mode you are asking for

  • read_only explicitely ask for reading - the plugin will give all suffixes it can read (maybe none)
  • write_only explicitely ask for writing - the plugin will give all suffixes it can write (maybe none)
  • both ask for suffixes which can be red or written (sould never be empty)
Returns:
a list of suffixes the plugin handles

Definition at line 81 of file io_interface.cpp.

bool isis::image_io::FileFormat::hasOrTell ( const util::PropertyMap::KeyType name,
const util::PropertyMap object,
LogLevel  level 
) [static, protected]

Check if a given property exists in the given PropMap.

If the property doesn't exist a message will be sent to Log using the given loglevel.

Returns:
object.hasProperty(name)

Definition at line 61 of file io_interface.cpp.

virtual int isis::image_io::FileFormat::load ( std::list< data::Chunk > &  chunks,
const std::string &  filename,
const util::istring dialect,
boost::shared_ptr< util::ProgressFeedback feedback 
) throw ( std::runtime_error & ) [pure virtual]

Load data into the given chunk list.

I case of an error std::runtime_error will be thrown.

Parameters:
chunksthe chunk list where the loaded chunks shall be added to
filenamethe name of the file to load from (the system does NOT check if this file exists)
dialectthe dialect to be used when loading the file (use "" to not define a dialect)
feedbacka shared_ptr to a ProgressFeedback-object to inform about loading progress. Not used if zero.
Returns:
the amount of loaded chunks.
std::pair< std::string, std::string > isis::image_io::FileFormat::makeBasename ( const std::string &  filename) const [virtual]

splits the suffix (and the ".") from the filename (or path) and returns a pair made of both parts

Definition at line 91 of file io_interface.cpp.

std::string isis::image_io::FileFormat::makeFilename ( const util::PropertyMap img,
std::string  namePattern 
) [static]

Definition at line 105 of file io_interface.cpp.

std::list< std::string > isis::image_io::FileFormat::makeUniqueFilenames ( const std::list< data::Image > &  images,
const std::string &  namePattern 
) const

Definition at line 187 of file io_interface.cpp.

bool isis::image_io::FileFormat::setGender ( util::PropertyMap object,
const char *  set,
const char *  entries = "female,male,other" 
) [static, protected]

Check if a given property exists in the given PropMap.

If the property doesn't exist a message will be sent to Log using the given loglevel.

Returns:
object.hasProperty(name)

Definition at line 49 of file io_interface.cpp.

virtual util::istring isis::image_io::FileFormat::suffixes ( io_modes  modes = both) const [protected, pure virtual]
Returns:
the file-suffixes the plugin supports
virtual bool isis::image_io::FileFormat::tainted ( ) const [inline, virtual]
Returns:
if the plugin is not part of the official distribution

Definition at line 96 of file io_interface.h.

void isis::image_io::FileFormat::throwGenericError ( std::string  desc) [static]

Definition at line 71 of file io_interface.cpp.

void isis::image_io::FileFormat::throwSystemError ( int  err,
std::string  desc = "" 
) [static]

Definition at line 76 of file io_interface.cpp.

template<typename TYPE >
static bool isis::image_io::FileFormat::transformOrTell ( const util::PropertyMap::KeyType from,
const util::PropertyMap::KeyType to,
util::PropertyMap object,
LogLevel  level 
) [inline, static, protected]

Transform a given property into another and remove the original in the given PropMap.

If the property doesn't exist a message will be sent to Log using the given loglevel.

Returns:
true if the property existed and was transformed.

Definition at line 53 of file io_interface.h.

API_EXCLUDE_BEGIN _internal API_EXCLUDE_END void isis::image_io::FileFormat::write ( const std::list< data::Image > &  images,
const std::string &  filename,
const util::istring dialect,
boost::shared_ptr< util::ProgressFeedback feedback 
) throw ( std::runtime_error & ) [virtual]

Write a image list.

I case of an error std::runtime_error will be thrown. The default implementation will call write( const data::Image &, const std::string&, const std::string&) for every image using a generated unique filename.

Parameters:
imagesa list of the images to be written
filenamethe name to be used as base for the filename generation if neccessary.
dialectthe dialect to be used when loading the file (use "" to not define a dialect)
feedbacka shared_ptr to a ProgressFeedback-object to inform about loading progress. Not used if zero.

Definition at line 28 of file io_interface.cpp.

virtual void isis::image_io::FileFormat::write ( const data::Image image,
const std::string &  filename,
const util::istring dialect,
boost::shared_ptr< util::ProgressFeedback feedback 
) throw ( std::runtime_error & ) [pure virtual]

Write a single image to a file.

I case of an error std::runtime_error will be thrown.

Parameters:
imagethe image to be written
filenamethe name of the file to write (the system does NOT check if this file exists/is writeable)
dialectthe dialect to be used when loading the file (use "" to not define a dialect)
feedbacka shared_ptr to a ProgressFeedback-object to inform about loading progress. Not used if zero.

Field Documentation

const float isis::image_io::FileFormat::invalid_float = -std::numeric_limits<float>::infinity() [static, protected]

Definition at line 63 of file io_interface.h.

boost::filesystem::path isis::image_io::FileFormat::plugin_file

Definition at line 67 of file io_interface.h.


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