Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

util::MatrixCodec< T > Class Template Reference

#include <MatrixCodec.h>

Inheritance diagram for util::MatrixCodec< T >:

util::Object util::AsciiCodec< T > List of all members.

Detailed Description

template<class T>
class util::MatrixCodec< T >

MatrixCodec is an interface for classes that are able to read and write matrix/image data in various formats.


Public Methods

virtual ~MatrixCodec ()
virtual Matrix< T > readFromFile (std::string file) throw (MatrixException&, io::IOException&)
 Read a matrix from a file.

virtual void writeToFile (std::string file, const Matrix< T > &mat) throw (MatrixException&, io::IOException&)
 Write a matrix to a file.

virtual void decodeMatrix (std::istream &in, Matrix< T > &mat)=0 throw (MatrixException&, io::IOException&)
 Decode an matrix.

virtual void encodeMatrix (std::ostream &out, const Matrix< T > &mat)=0 throw (MatrixException&, io::IOException&)
 Encode an matrix.


Member Function Documentation

template<class T>
virtual void util::MatrixCodec< T >::decodeMatrix std::istream &    in,
Matrix< T > &    mat
throw (MatrixException&, io::IOException&) [pure virtual]
 

Decode an matrix.

Matrix data is read from in and placed into mat. Matrix dimensions must be read from the stream.

Parameters:
in  the input stream to read an matrix from.
mat  the matrix where output is placed.
Exceptions:
MatrixException  & if there is a problem handling the matrix.
IOException  & if the data cannot be read for some reason.

Implemented in PnmCodec< T >, ColorBmpCodec, MagickCodec< T >, RasterCodec, and util::AsciiCodec< T >.

template<class T>
virtual void util::MatrixCodec< T >::encodeMatrix std::ostream &    out,
const Matrix< T > &    mat
throw (MatrixException&, io::IOException&) [pure virtual]
 

Encode an matrix.

Matrix data is extracted from mat and written into out in some matrix file format.

Parameters:
out  the output stream to write an matrix to.
mat  the matrix to get data from.
Exceptions:
MatrixException  & if there is a problem handling the matrix.
IOException  & if the data cannot be write for some reason.

Implemented in util::AsciiCodec< T >.

template<class T>
Matrix< T > util::MatrixCodec< T >::readFromFile std::string    file throw (MatrixException&, io::IOException&) [virtual]
 

Read a matrix from a file.

Opens an input stream, reads the data from the file, and returns them as a matrix.

Parameters:
file  The name of the file where the data will be read.
Returns:
Matrix<T> where the data will be placed.
Exceptions:
MatrixException  & if there is a problem handling the matrix.
IOException  & if the data cannot be read for some reason.

Reimplemented in MagickCodec< T >.

template<class T>
void util::MatrixCodec< T >::writeToFile std::string    file,
const Matrix< T > &    mat
throw (MatrixException&, io::IOException&) [virtual]
 

Write a matrix to a file.

Parameters:
file  The name of the file where the matrix will be writen.
mat  The matrix which will be writen.
Exceptions:
MatrixException  & if there is a problem handling the matrix.
IOException  & if the data cannot be write for some reason.


The documentation for this class was generated from the following file:
Documentation generated on 11.09.2003 with Doxygen.
The documentation is copyrighted material.
Copyright © Topi Mäenpää 2003. All rights reserved.