HDF5Serie

Project Page
Public Member Functions | Protected Member Functions | Friends
H5::VectorSerie< T > Class Template Reference

Serie of vectors. More...

#include <vectorserie.h>

Inheritance diagram for H5::VectorSerie< T >:
H5::Dataset H5::Object H5::Element H5::Container< Attribute, Object >

List of all members.

Public Member Functions

void setDescription (const std::string &desc)
 Sets a description for the dataset.
void append (const T data[], size_t size)
 Append a data vector.
template<class DataType >
void append (const DataType &data)
int getRows ()
 Returns the number of rows in the dataset.
unsigned int getColumns ()
 Returns the number of columns(=number of data elements) in the dataset.
void getRow (const int row, size_t size, T data[])
 Returns the data vector at row row The first row is 0. The last avaliable row ist getRows()-1. data points to an array of size elements of type T.
template<class DataType >
void getRow (const int row, DataType &data)
std::vector< T > getRow (const int row)
void getColumn (const int column, size_t size, T data[])
 Returns the data vector at column column.
template<class DataType >
void getColumn (const int column, DataType &data)
std::vector< T > getColumn (const int row)
std::string getDescription ()
 Return the description for the dataset.
void setColumnLabel (const std::vector< std::string > &columnLabel)
std::vector< std::string > getColumnLabel ()
 Returns the column labels.
template<>
void append (const string data[], size_t size)
template<>
void getRow (const int row, size_t size, string data[])
template<>
void getColumn (const int column, size_t size, string data[])

Protected Member Functions

 VectorSerie (int dummy, GroupBase *parent_, const std::string &name_)
 VectorSerie (GroupBase *parent_, const std::string &name_, int cols, int compression=File::getDefaultCompression(), int chunkSize=File::getDefaultChunkSize())
void close ()
void open ()

Friends

class Container< Object, GroupBase >

Detailed Description

template<class T>
class H5::VectorSerie< T >

Serie of vectors.

A HDF5 dataset for reading and writing a serie of data vectors. The type of the elements of the vector (template type T) can be of:

The data is stored as a 2D array in the HDF5 file. Each row is onw data vector.

A Note when using a vector-matrix-library: It is likly that the data in calculated by using a vector-matrix-library. If so, and the vector object (of type T) of the library (e.g. fmatvec from http://code.google.com/p/fmatvec/) has a cast-operator to std::vector<T> and a constructor with a single parameter of type std::vector<T>, then you can use the vector-object wherever a object of type std::vector<T> is needed. E.g. in append(const std::vector<T>) or the return value of getRow(int r). The same applies to a matrix-object for std::vector<std::vector<T> >.


Member Function Documentation

template<class T >
void H5::VectorSerie< T >::append ( const T  data[],
size_t  size 
)

Append a data vector.

Appends the data vector data at the end of the dataset. The number of rows of the HDF5 array will be incremented by this operation.

Referenced by H5::VectorSerie< T >::append().

template<class T >
template<class DataType >
void H5::VectorSerie< T >::append ( const DataType &  data) [inline]

Convinience append function. DataType must provide a "size_t size()" member function which returns the number of elements as well as a "T &operator[](int i)" member function which returns a reference to the i-te element. All elements must be lie in order in memory

References H5::VectorSerie< T >::append().

template<class T >
void H5::VectorSerie< T >::getColumn ( const int  column,
size_t  size,
T  data[] 
)

Returns the data vector at column column.

The first column is 0. The last avaliable column ist getColumns()-1.

Referenced by H5::VectorSerie< T >::getColumn().

template<class T >
template<class DataType >
void H5::VectorSerie< T >::getColumn ( const int  column,
DataType &  data 
) [inline]

Convinience getRow function. DataType must provide a "size_t size()" member function which returns the number of elements as well as a "T &operator[](int i)" member function which returns a reference to the i-te element. The elements of DataType must be of Type T and must be stored sequencially in memory.

References H5::VectorSerie< T >::getColumn().

template<class T >
std::vector<T> H5::VectorSerie< T >::getColumn ( const int  row) [inline]

Convinience getColumn function for backward compatiblity. Returns a copy in form of a std::vector<T>.

References H5::VectorSerie< T >::getColumn(), and H5::VectorSerie< T >::getRows().

template<class T >
vector< string > H5::VectorSerie< T >::getColumnLabel ( )

Returns the column labels.

Return the value of the string vector attribute named Column Label of the dataset.

template<class T >
string H5::VectorSerie< T >::getDescription ( )

Return the description for the dataset.

Returns the value of the string attribute named Description of the dataset.

template<class T >
template<class DataType >
void H5::VectorSerie< T >::getRow ( const int  row,
DataType &  data 
) [inline]

Convinience getRow function. DataType must provide a "size_t size()" member function which returns the number of elements as well as a "T &operator[](int i)" member function which returns a reference to the i-te element. The elements of DataType must be of Type T and must be stored sequencially in memory.

References H5::VectorSerie< T >::getRow().

template<class T >
std::vector<T> H5::VectorSerie< T >::getRow ( const int  row) [inline]

Convinience getRow function for backward compatiblity. Returns a copy in form of a std::vector<T>.

References H5::VectorSerie< T >::getRow().

template<class T >
void H5::VectorSerie< T >::setDescription ( const std::string &  desc)

Sets a description for the dataset.

The value of desc is stored as an string attribute named Description in the dataset.


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