Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

util::AsciiCodec< T > Class Template Reference

#include <AsciiCodec.h>

Inheritance diagram for util::AsciiCodec< T >:

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

Detailed Description

template<class T>
class util::AsciiCodec< T >

A codec for reading and writing ascii-encoded matrices.


Public Methods

 AsciiCodec (char columnDeliminator=',', char rowDeliminator='\n')
 Create a new AsciiCodec with the given column and row deliminator.

void setColumnDeliminator (char delim)
 Set the colum deliminator.

void setRowDeliminator (char delim)
 Set the row deliminator.

char getColumnDeliminator () const
 Get the colum deliminator.

char getRowDeliminator () const
 Get the row deliminator.

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

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


Constructor & Destructor Documentation

template<class T>
util::AsciiCodec< T >::AsciiCodec char    columnDeliminator = ',',
char    rowDeliminator = '\n'
[inline]
 

Create a new AsciiCodec with the given column and row deliminator.

The default values allow data interchange between matlab. (Matlab fuction dlmread/dlmwrite).

Parameters:
columnDeliminator  The deliminator for colums.
rowDeliminator  The deliminator for rows.


Member Function Documentation

template<class T>
void util::AsciiCodec< T >::decodeMatrix std::istream &    in,
Matrix< T > &    mat
throw (MatrixException&, io::IOException&) [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.

Implements util::MatrixCodec< T >.

template<class T>
void util::AsciiCodec< T >::encodeMatrix std::ostream &    out,
const Matrix< T > &    mat
throw (MatrixException&, io::IOException&) [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.

Implements util::MatrixCodec< T >.


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.