HDF5Serie

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

Serie of vectors. More...

#include <vectorserie.h>

List of all members.

Public Member Functions

 VectorSerie ()
 A stub constructor.
 VectorSerie (const VectorSerie< T > &dataset)
 Copy constructor.
 VectorSerie (const CommonFG &parent, const std::string &name)
 Constructor for opening a dataset.
 VectorSerie (const CommonFG &parent, const std::string &name, const std::vector< std::string > &columnLabel, int compression=FileSerie::getDefaultCompression(), int chunkSize=FileSerie::getDefaultChunkSize())
 Dataset creating constructor.
void create (const CommonFG &parent, const std::string &name, const std::vector< std::string > &columnLabel, int compression=FileSerie::getDefaultCompression(), int chunkSize=FileSerie::getDefaultChunkSize())
 Creating a dataset.
void open (const CommonFG &parent, const std::string &name)
 Open a dataset.
void setDescription (const std::string &desc)
 Sets a description for the dataset.
void append (const std::vector< T > &data)
 Append a data vector.
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.
std::vector< T > getRow (const int row)
 Returns the data vector at row row.
std::vector< T > getColumn (const int column)
 Returns the data vector at column column.
std::string getDescription ()
 Return the description for the dataset.
std::vector< std::string > getColumnLabel ()
 Returns the column labels.
void extend (const hsize_t *size)
template<>
void append (const std::vector< std::string > &data)
template<>
std::vector< std::string > getRow (const int row)
template<>
std::vector< std::string > getColumn (const int column)
template<>
void append (const vector< string > &data)
template<>
vector< string > getRow (const int row)
template<>
vector< string > getColumn (const int column)

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> >.


Constructor & Destructor Documentation

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

A stub constructor.

Creates a empty object.

template<class T >
H5::VectorSerie< T >::VectorSerie ( const CommonFG &  parent,
const std::string &  name 
)

Constructor for opening a dataset.

see open()

template<class T >
H5::VectorSerie< T >::VectorSerie ( const CommonFG &  parent,
const std::string &  name,
const std::vector< std::string > &  columnLabel,
int  compression = FileSerie::getDefaultCompression(),
int  chunkSize = FileSerie::getDefaultChunkSize() 
)

Dataset creating constructor.

see create()


Member Function Documentation

template<class T >
void H5::VectorSerie< T >::append ( const std::vector< T > &  data)

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.

template<class T >
void H5::VectorSerie< T >::create ( const CommonFG &  parent,
const std::string &  name,
const std::vector< std::string > &  columnLabel,
int  compression = FileSerie::getDefaultCompression(),
int  chunkSize = FileSerie::getDefaultChunkSize() 
)

Creating a dataset.

Creates a dataset named name as a child of position parent. By default the dataset is compressed using deflate (gzip) with compression level FileSerie::defaultCompression. Use compression to adjuste the compression level [1-9] or 0 to disable compression. Each element of the data vector (columns in the HDF5 file) must be given a description label using the parameter columnLabel. The column labels are stored as a string vector attribute named Column Label in the dataset.

template<class T >
std::vector< T > H5::VectorSerie< T >::getColumn ( const int  column)

Returns the data vector at column column.

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

template<class T >
std::vector< std::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 >
std::string H5::VectorSerie< T >::getDescription ( )

Return the description for the dataset.

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

References H5::SimpleAttribute< T >::getData().

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

Returns the data vector at row row.

The first row is 0. The last avaliable row ist getRows()-1.

template<class T >
void H5::VectorSerie< T >::open ( const CommonFG &  parent,
const std::string &  name 
)

Open a dataset.

Opens the dataset named name as a child of position parent.

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: