00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _HDF5SERIE_VECTORSERIE_H_
00023 #define _HDF5SERIE_VECTORSERIE_H_
00024
00025 #include <fmatvec/atom.h>
00026 #include <H5Cpp.h>
00027 #include <vector>
00028 #include <string>
00029 #include <assert.h>
00030 #include <hdf5serie/simpleattribute.h>
00031 #include <hdf5serie/fileserie.h>
00032
00033 namespace H5 {
00034
00035
00036
00067 template<class T>
00068 class VectorSerie : public DataSet, public fmatvec::Atom {
00069 private:
00070 DataType memDataType;
00071 DataSpace memDataSpace;
00072 hsize_t dims[2];
00073 std::vector<T> buf;
00074 public:
00079 VectorSerie();
00080
00082 VectorSerie(const VectorSerie<T>& dataset);
00083
00088 VectorSerie(const CommonFG& parent, const std::string& name);
00089
00094 VectorSerie(const CommonFG& parent, const std::string& name, const std::vector<std::string>& columnLabel, int compression=FileSerie::getDefaultCompression(), int chunkSize=FileSerie::getDefaultChunkSize());
00095
00105 void create(const CommonFG& parent, const std::string& name, const std::vector<std::string>& columnLabel, int compression=FileSerie::getDefaultCompression(), int chunkSize=FileSerie::getDefaultChunkSize());
00106
00111 void open(const CommonFG& parent, const std::string& name);
00112
00117 void setDescription(const std::string& desc);
00118
00124 void append(const std::vector<T> &data);
00125
00127 inline int getRows();
00128
00130 inline unsigned int getColumns();
00131
00136 std::vector<T> getRow(const int row);
00137
00142 std::vector<T> getColumn(const int column);
00143
00148 std::string getDescription();
00149
00155 std::vector<std::string> getColumnLabel();
00156
00157 void extend(const hsize_t* size);
00158 };
00159
00160
00161
00162
00163
00164 template<class T>
00165 int VectorSerie<T>::getRows() {
00166
00167 DataSpace fileDataSpace=getSpace();
00168 fileDataSpace.getSimpleExtentDims(dims);
00169
00170 return dims[0];
00171 }
00172
00173 template<class T>
00174 unsigned int VectorSerie<T>::getColumns() {
00175 return dims[1];
00176 }
00177
00178 }
00179
00180 #endif // _TIMESERIE_H_