HighFive 2.3.1
HighFive - Header-only C++ HDF5 interface
Loading...
Searching...
No Matches
H5PropertyList.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c), 2017-2018, Adrien Devresse <adrien.devresse@epfl.ch>
3 * Juan Hernando <juan.hernando@epfl.ch>
4 * Distributed under the Boost Software License, Version 1.0.
5 * (See accompanying file LICENSE_1_0.txt or copy at
6 * http://www.boost.org/LICENSE_1_0.txt)
7 *
8 */
9#ifndef H5PROPERTY_LIST_HPP
10#define H5PROPERTY_LIST_HPP
11
12#include <vector>
13
14#include <H5Ppublic.h>
15
16#include "H5Exception.hpp"
17#include "H5Object.hpp"
18
19namespace HighFive {
20
24enum class PropertyType : int {
40};
41
42
45class PropertyListBase : public Object {
46
47 public:
48 PropertyListBase() noexcept;
49
50 static const PropertyListBase& Default() noexcept {
51 static const PropertyListBase plist{};
52 return plist;
53 }
54
55};
56
57
61template <PropertyType T>
63 public:
64
67 constexpr PropertyType getType() const noexcept {
68 return T;
69 }
70
76 template <typename P>
77 void add(const P& property);
78
81 static const PropertyList<T>& Default() noexcept {
82 return static_cast<const PropertyList<T>&>(PropertyListBase::Default());
83 }
84
85 protected:
87
88};
89
105
110template <PropertyType T>
111class RawPropertyList : public PropertyList<T> {
112 public:
113 template <typename F, typename... Args>
114 void add(const F& funct, const Args&... args);
115};
116
117
118class Chunking {
119 public:
120 explicit Chunking(const std::vector<hsize_t>& dims)
121 : _dims(dims) {}
122
123 Chunking(const std::initializer_list<hsize_t>& items)
124 : Chunking(std::vector<hsize_t>{items}) {}
125
126 template <typename... Args>
127 explicit Chunking(hsize_t item, Args... args)
128 : Chunking(std::vector<hsize_t>{item, static_cast<hsize_t>(args)...}) {}
129
130 const std::vector<hsize_t>& getDimensions() const noexcept {
131 return _dims;
132 }
133
134 private:
135 friend DataSetCreateProps;
136 void apply(hid_t hid) const;
137 const std::vector<hsize_t> _dims;
138};
139
140class Deflate {
141 public:
142 explicit Deflate(unsigned level)
143 : _level(level) {}
144
145 private:
146 friend DataSetCreateProps;
147 void apply(hid_t hid) const;
148 const unsigned _level;
149};
150
151class Szip {
152 public:
153 explicit Szip(unsigned options_mask = H5_SZIP_EC_OPTION_MASK,
154 unsigned pixels_per_block = H5_SZIP_MAX_PIXELS_PER_BLOCK)
155 : _options_mask(options_mask)
156 , _pixels_per_block(pixels_per_block)
157 {}
158
159 private:
160 friend DataSetCreateProps;
161 void apply(hid_t hid) const;
162 const unsigned _options_mask;
163 const unsigned _pixels_per_block;
164};
165
166class Shuffle {
167 public:
168 Shuffle() = default;
169
170 private:
171 friend DataSetCreateProps;
172 void apply(hid_t hid) const;
173};
174
177class Caching {
178 public:
181 Caching(const size_t numSlots,
182 const size_t cacheSize,
183 const double w0 = static_cast<double>(H5D_CHUNK_CACHE_W0_DEFAULT))
184 : _numSlots(numSlots)
185 , _cacheSize(cacheSize)
186 , _w0(w0) {}
187
188 private:
189 friend DataSetAccessProps;
190 void apply(hid_t hid) const;
191 const size_t _numSlots;
192 const size_t _cacheSize;
193 const double _w0;
194};
195
197 public:
198 explicit CreateIntermediateGroup(bool create=true)
199 : _create(create)
200 {}
201
202 private:
203 friend ObjectCreateProps;
204 friend LinkCreateProps;
205 void apply(hid_t hid) const;
206 const bool _create;
207};
208
209} // namespace HighFive
210
212
213#endif // H5PROPERTY_LIST_HPP
Definition: H5PropertyList.hpp:177
Caching(const size_t numSlots, const size_t cacheSize, const double w0=static_cast< double >(H5D_CHUNK_CACHE_W0_DEFAULT))
Definition: H5PropertyList.hpp:181
Definition: H5PropertyList.hpp:118
Chunking(hsize_t item, Args... args)
Definition: H5PropertyList.hpp:127
const std::vector< hsize_t > & getDimensions() const noexcept
Definition: H5PropertyList.hpp:130
Chunking(const std::vector< hsize_t > &dims)
Definition: H5PropertyList.hpp:120
Chunking(const std::initializer_list< hsize_t > &items)
Definition: H5PropertyList.hpp:123
Definition: H5PropertyList.hpp:196
CreateIntermediateGroup(bool create=true)
Definition: H5PropertyList.hpp:198
Definition: H5PropertyList.hpp:140
Deflate(unsigned level)
Definition: H5PropertyList.hpp:142
Definition: H5Object.hpp:36
Base Class for Property lists, providing global default.
Definition: H5PropertyList.hpp:45
PropertyListBase() noexcept
Definition: H5PropertyList_misc.hpp:60
static const PropertyListBase & Default() noexcept
Definition: H5PropertyList.hpp:50
HDF5 property Lists.
Definition: H5PropertyList.hpp:62
void _initializeIfNeeded()
Definition: H5PropertyList_misc.hpp:65
static const PropertyList< T > & Default() noexcept
Return the Default property type object.
Definition: H5PropertyList.hpp:81
constexpr PropertyType getType() const noexcept
return the type of this PropertyList
Definition: H5PropertyList.hpp:67
void add(const P &property)
Definition: H5PropertyList_misc.hpp:77
Definition: H5PropertyList.hpp:111
void add(const F &funct, const Args &... args)
Definition: H5PropertyList_misc.hpp:84
Definition: H5PropertyList.hpp:166
Definition: H5PropertyList.hpp:151
Szip(unsigned options_mask=H5_SZIP_EC_OPTION_MASK, unsigned pixels_per_block=H5_SZIP_MAX_PIXELS_PER_BLOCK)
Definition: H5PropertyList.hpp:153
Definition: H5_definitions.hpp:15
PropertyType
Types of property lists.
Definition: H5PropertyList.hpp:24
PropertyList< PropertyType::FILE_CREATE > FileCreateProps
Definition: H5PropertyList.hpp:91
PropertyList< PropertyType::DATATYPE_ACCESS > DataTypeAccessProps
Definition: H5PropertyList.hpp:99
PropertyList< PropertyType::OBJECT_CREATE > ObjectCreateProps
Definition: H5PropertyList.hpp:90
PropertyList< PropertyType::STRING_CREATE > StringCreateProps
Definition: H5PropertyList.hpp:100
PropertyList< PropertyType::DATATYPE_CREATE > DataTypeCreateProps
Definition: H5PropertyList.hpp:98
PropertyList< PropertyType::DATASET_ACCESS > DataSetAccessProps
Definition: H5PropertyList.hpp:94
PropertyList< PropertyType::DATASET_CREATE > DataSetCreateProps
Definition: H5PropertyList.hpp:93
PropertyList< PropertyType::GROUP_CREATE > GroupCreateProps
Definition: H5PropertyList.hpp:96
PropertyList< PropertyType::OBJECT_COPY > ObjectCopyProps
Definition: H5PropertyList.hpp:102
PropertyList< PropertyType::LINK_CREATE > LinkCreateProps
Definition: H5PropertyList.hpp:103
PropertyList< PropertyType::GROUP_ACCESS > GroupAccessProps
Definition: H5PropertyList.hpp:97
PropertyList< PropertyType::FILE_ACCESS > FileAccessProps
Definition: H5PropertyList.hpp:92
PropertyList< PropertyType::DATASET_XFER > DataTransferProps
Definition: H5PropertyList.hpp:95
PropertyList< PropertyType::LINK_ACCESS > LinkAccessProps
Definition: H5PropertyList.hpp:104
PropertyList< PropertyType::ATTRIBUTE_CREATE > AttributeCreateProps
Definition: H5PropertyList.hpp:101