00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _HDF5SERIE_SIMPLEATTRIBUTE_H_
00023 #define _HDF5SERIE_SIMPLEATTRIBUTE_H_
00024
00025 #include <H5Cpp.h>
00026 #include <vector>
00027 #include <string>
00028 #include <hdf5serie/toh5type.h>
00029 #include <assert.h>
00030
00031 namespace H5 {
00032
00058 template<class T>
00059 class SimpleAttribute : public Attribute {
00060 private:
00061 DataType memDataType;
00062 public:
00064 SimpleAttribute();
00065
00067 SimpleAttribute(const SimpleAttribute<T>& attribute);
00068
00084 SimpleAttribute(const H5Object& parent, const std::string& name, bool create=false);
00085
00090 SimpleAttribute(const H5Object& parent, const std::string& name, const T& data);
00091
00107 void create(const H5Object& parent, const std::string& name);
00108
00113 void open(const H5Object& parent, const std::string& name);
00114
00119 void write(const T& data);
00120
00125 T read();
00126
00131 void write(const H5Object& parent, const std::string& name, const T& data);
00132
00137 T read(const H5Object& parent, const std::string& name);
00138
00143 static T getData(const H5Object& parent, const std::string& name);
00144
00149 static void setData(const H5Object& parent, const std::string& name, const T& data);
00150 };
00151
00152
00153 template<class T>
00154 class SimpleAttribute<std::vector<T> > : public Attribute {
00155 private:
00156 DataType memDataType;
00157 public:
00158 SimpleAttribute();
00159 SimpleAttribute(const SimpleAttribute<std::vector<T> >& attribute);
00160 SimpleAttribute(const H5Object& parent, const std::string& name, const int count=0);
00161 SimpleAttribute(const H5Object& parent, const std::string& name, const std::vector<T>& data);
00162 void create(const H5Object& parent, const std::string& name, const int count);
00163 void open(const H5Object& parent, const std::string& name);
00164 void write(const std::vector<T>& data);
00165 std::vector<T> read();
00166 void write(const H5Object& parent, const std::string& name, const std::vector<T>& data);
00167 std::vector<T> read(const H5Object& parent, const std::string& name);
00168 static std::vector<T> getData(const H5Object& parent, const std::string& name);
00169 static void setData(const H5Object& parent, const std::string& name, const std::vector<T>& data);
00170 };
00171
00172
00173 template<class T>
00174 class SimpleAttribute<std::vector<std::vector<T> > > : public Attribute {
00175 private:
00176 DataType memDataType;
00177 public:
00178 SimpleAttribute();
00179 SimpleAttribute(const SimpleAttribute<std::vector<std::vector<T> > >& attribute);
00180 SimpleAttribute(const H5Object& parent, const std::string& name, const int rows=0, const int columns=0);
00181 SimpleAttribute(const H5Object& parent, const std::string& name, const std::vector<std::vector<T> >& data);
00182 void create(const H5Object& parent, const std::string& name, const int rows, const int columns);
00183 void open(const H5Object& parent, const std::string& name);
00184 void write(const std::vector<std::vector<T> >& data);
00185 std::vector<std::vector<T> > read();
00186 void write(const H5Object& parent, const std::string& name, const std::vector<std::vector<T> >& data);
00187 std::vector<std::vector<T> > read(const H5Object& parent, const std::string& name);
00188 static std::vector<std::vector<T> > getData(const H5Object& parent, const std::string& name);
00189 static void setData(const H5Object& parent, const std::string& name, const std::vector<std::vector<T> >& data);
00190 };
00191
00192 }
00193
00194 #endif