FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
H++/H5Dataset.hpp
1#ifndef __H5_DATASET_HPP
2#define __H5_DATASET_HPP
3
4#include "H5DataType.hpp"
5#include "H5Property.hpp"
6#include <vector>
7
8class H5Group;
9
11{
12 H5DataSpace(hid_t id)
13 : H5Identifier(id)
14 {}
15
16public:
17 H5DataSpace(int rank, hsize_t*Dimensions);
18
19 H5DataSpace(hsize_t OneDimensionalSize)
20 : H5DataSpace(1, &OneDimensionalSize)
21 {}
22
24
25};
26
29class H5Dataset : public H5Object
30{
31 H5Dataset(hid_t);
32
34 H5Object::get_typed_object() const;
35
36protected:
37
38 ~H5Dataset();
39
40public:
41 H5Dataset(H5Group&, const char*name, hid_t type_id, const H5DataSpace&,
42 const MemCore::RefPtr<H5Property>&A=nullptr, const MemCore::RefPtr<H5Property>&B=nullptr, const MemCore::RefPtr<H5Property>&C=nullptr );
43
44 H5Dataset(H5Group&, const char*name, const H5DataType&, const H5DataSpace&,
45 const MemCore::RefPtr<H5Property>&A=nullptr, const MemCore::RefPtr<H5Property>&B=nullptr, const MemCore::RefPtr<H5Property>&C=nullptr );
46
47 H5Dataset(H5Group&G, const std::string&name, hid_t type_id, const H5DataSpace&DS,
48 const MemCore::RefPtr<H5Property>&A=nullptr, const MemCore::RefPtr<H5Property>&B=nullptr, const MemCore::RefPtr<H5Property>&C=nullptr )
49 : H5Dataset(G, name.c_str(), type_id, DS, A, B, C)
50 {}
51
52
53
54 hid_t H5Dget_type() const;
55
56 MemCore::RefPtr<H5DataType> get_type() const
57 {
58 return new H5DataType( H5Dget_type() );
59 }
60
61 herr_t read(hid_t LoadID, void*dataPtr) const;
62
63 template <class T>
64 herr_t read(hid_t LoadID, std::vector<T>&data) const
65 {
66 return read(LoadID, data.data());
67 }
68
69 herr_t read(const H5DataType&DT, void*dataPtr) const
70 {
71 return read( DT.getHid(), dataPtr );
72 }
73
74 template <class T>
75 herr_t read(const H5DataType&DT, std::vector<T>&data) const
76 {
77 return read( DT.getHid(), data.data());
78 }
79
84 herr_t write(hid_t data_type_id, const void*data) const;
85
89 template <class T>
90 herr_t write(hid_t data_type_id, const std::vector<T>&data) const
91 {
92 return write( data_type_id, data.data());
93 }
94
95 template <class T>
96 herr_t write(const H5DataType&DT, const std::vector<T>&data) const
97 {
98 return write( DT.getHid(), data );
99 }
100
101 hssize_t get_simple_extent_npoints() const;
102
109 int get_simple_extent_dims(hsize_t *dims, hsize_t *maxdims = nullptr) const;
110
111 using attribute_iterator_t = std::function< herr_t( hid_t location_id/*in*/, const char *attr_name/*in*/, const H5A_info_t *ainfo/*in*/)>;
112
113 herr_t iterate(const attribute_iterator_t&attribute_iterator) const;
114
115private:
116 friend class H5Group;
117};
118
119
120#endif // __H5_DATASET_HPP
Definition H++/H5Dataset.hpp:11
Definition H++/H5DataType.hpp:10
Definition H++/H5Dataset.hpp:30
int get_simple_extent_dims(hsize_t *dims, hsize_t *maxdims=nullptr) const
Dims:
Definition H++/H5Dataset.cpp:107
herr_t write(hid_t data_type_id, const std::vector< T > &data) const
Definition H++/H5Dataset.hpp:90
herr_t write(hid_t data_type_id, const void *data) const
Most basic function to write a bunch of untyped data with a given HDF5 type ID.
Definition H++/H5Dataset.cpp:93
A group within an HDF5 file.
Definition H++/H5Group.hpp:18
Definition H++/H5Object.hpp:14
Base class for groups, datasets and named datatypes.
Definition H++/H5Object.hpp:122