hdf5serie  2.0.0
HDF5 Serie
H5::VectorSerie< T > Class Template Reference

Serie of vectors. More...

#include <vectorserie.h>

Inheritance diagram for H5::VectorSerie< T >:
[legend]

Public Member Functions

void setDescription (const std::string &description)
 Sets a description for the dataset. More...
 
void append (const T data[], size_t size)
 Append a data vector. More...
 
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 (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 (int column, size_t size, T data[])
 Returns the data vector at column column. More...
 
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. More...
 
void setColumnLabel (const std::vector< std::string > &columnLabel)
 
std::vector< std::string > getColumnLabel ()
 Returns the column labels. More...
 
void append (const string data[], size_t size)
 
void getRow (const int row, size_t size, string data[])
 
void getColumn (const int column, size_t size, string data[])
 
- Public Member Functions inherited from H5::Dataset
std::vector< hsize_t > getExtentDims ()
 
- Public Member Functions inherited from H5::Object
template<class T >
Creator< T > createChildAttribute (const std::string &path)
 
template<class T >
T * openChildAttribute (const std::string &path)
 
AttributeopenChildAttribute (const std::string &name_, ElementType *attributeType=nullptr, hid_t *type=nullptr)
 
std::set< std::string > getChildAttributeNames ()
 
bool hasChildAttribute (const std::string &name_)
 
GroupBasegetParent ()
 
FilegetFile ()
 
std::string getPath ()
 
- Public Member Functions inherited from H5::Element
hid_t getID ()
 Note: use the returned hid_t only temporarily since it may get invalid, at least when File::enableSWMR is called.
 
std::string getName ()
 

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(), int cacheSize=File::getDefaultCacheSize())
 
void close () override
 
void refresh () override
 
void flush () override
 
- Protected Member Functions inherited from H5::Dataset
 Dataset (GroupBase *parent_, const std::string &name_)
 
 Dataset (int dummy, GroupBase *parent_, const std::string &name_)
 
void close () override
 
void refresh () override
 
void flush () override
 
void enableSWMR () override
 
- Protected Member Functions inherited from H5::Object
 Object (GroupBase *parent_, const std::string &name_)
 
void close () override
 
void refresh () override
 
void flush () override
 
void enableSWMR () override
 
ObjectgetFileAsObject ()
 
ObjectgetAttrParent (const std::string &path, size_t pos)
 
- Protected Member Functions inherited from H5::Element
 Element (std::string name_)
 
virtual void close ()
 
virtual void refresh ()
 
virtual void flush ()
 
virtual void enableSWMR ()
 
- Protected Member Functions inherited from H5::Container< Attribute, Object >
void close ()
 
void refresh ()
 
void flush ()
 
void enableSWMR ()
 
Creator< T > createChild (const std::string &name_)
 
T * openChild (const std::string &name_)
 

Private Member Functions

void writeToHDF5 (size_t nrRows, size_t cacheSize, const T *data)
 

Private Attributes

hid_t memDataTypeID
 
ScopedHID memDataSpaceID
 
ScopedHID memDataSpaceCacheID
 
ScopedHID fileDataSpaceID
 
hsize_t dims [2]
 
boost::multi_array< T, 2 > cache
 
size_t cacheRow
 

Friends

class Container< Object, GroupBase >
 

Additional Inherited Members

- Protected Attributes inherited from H5::Object
GroupBaseparent
 
Filefile
 
- Protected Attributes inherited from H5::Element
ScopedHID id
 
std::string name
 
- Protected Attributes inherited from H5::Container< Attribute, Object >
std::map< std::string, Attribute * > childs
 

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:

  • char
  • signed char
  • unsigned char
  • short
  • unsigned short
  • int
  • unsigned int
  • long
  • unsigned long
  • long long
  • unsigned long long
  • float
  • double
  • long double
  • std::string

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 is calculated by a vector-matrix-library. If so, and the vector object (of type T) of the library (e.g. fmatvec) has a size() member function, returning the size of the vector, and operator[](int i) returns for i=0 a reference to the first element and all other elements are store continously after the address of this element, then you can use the vector-object as parameter for append(const DataType &data).

Member Function Documentation

◆ append() [1/2]

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

◆ append() [2/2]

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.

◆ close()

template<class T >
void H5::VectorSerie< T >::close
overrideprotectedvirtual

Reimplemented from H5::Dataset.

◆ flush()

template<class T >
void H5::VectorSerie< T >::flush
overrideprotectedvirtual

Reimplemented from H5::Dataset.

◆ getColumn() [1/3]

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.

◆ getColumn() [2/3]

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

◆ getColumn() [3/3]

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

Returns the data vector at column column.

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

◆ getColumnLabel()

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.

◆ getDescription()

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.

◆ getRow() [1/2]

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

◆ getRow() [2/2]

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.

◆ refresh()

template<class T >
void H5::VectorSerie< T >::refresh
overrideprotectedvirtual

Reimplemented from H5::Dataset.

◆ setDescription()

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

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: