9#ifndef H5PROPERTY_LIST_MISC_HPP
10#define H5PROPERTY_LIST_MISC_HPP
17inline hid_t convert_plist_type(
PropertyType propertyType) {
20 switch (propertyType) {
22 return H5P_OBJECT_CREATE;
24 return H5P_FILE_CREATE;
26 return H5P_FILE_ACCESS;
28 return H5P_DATASET_CREATE;
30 return H5P_DATASET_ACCESS;
32 return H5P_DATASET_XFER;
34 return H5P_GROUP_CREATE;
36 return H5P_GROUP_ACCESS;
38 return H5P_DATATYPE_CREATE;
40 return H5P_DATATYPE_ACCESS;
42 return H5P_STRING_CREATE;
44 return H5P_ATTRIBUTE_CREATE;
46 return H5P_OBJECT_COPY;
48 return H5P_LINK_CREATE;
50 return H5P_LINK_ACCESS;
52 HDF5ErrMapper::ToException<PropertyException>(
53 "Unsupported property list type");
64template <PropertyType T>
66 if (_hid != H5P_DEFAULT) {
69 if ((_hid = H5Pcreate(convert_plist_type(T))) < 0) {
70 HDF5ErrMapper::ToException<PropertyException>(
71 "Unable to create property list");
75template <PropertyType T>
78 _initializeIfNeeded();
82template <PropertyType T>
83template <
typename F,
typename... Args>
85 this->_initializeIfNeeded();
86 if (funct(this->_hid, args...) < 0) {
87 HDF5ErrMapper::ToException<PropertyException>(
88 "Error setting raw hdf5 property.");
95inline void Chunking::apply(
const hid_t hid)
const {
96 if (H5Pset_chunk(hid,
static_cast<int>(_dims.size()), _dims.data()) < 0) {
97 HDF5ErrMapper::ToException<PropertyException>(
98 "Error setting chunk property");
102inline void Deflate::apply(
const hid_t hid)
const {
103 if (!H5Zfilter_avail(H5Z_FILTER_DEFLATE) ||
104 H5Pset_deflate(hid, _level) < 0) {
105 HDF5ErrMapper::ToException<PropertyException>(
106 "Error setting deflate property");
110inline void Szip::apply(
const hid_t hid)
const {
111 if (!H5Zfilter_avail(H5Z_FILTER_SZIP)) {
112 HDF5ErrMapper::ToException<PropertyException>(
113 "Error setting szip property");
116 if (H5Pset_szip(hid, _options_mask, _pixels_per_block) < 0) {
117 HDF5ErrMapper::ToException<PropertyException>(
118 "Error setting szip property");
122inline void Shuffle::apply(
const hid_t hid)
const {
123 if (!H5Zfilter_avail(H5Z_FILTER_SHUFFLE)) {
124 HDF5ErrMapper::ToException<PropertyException>(
125 "Error setting shuffle property");
128 if (H5Pset_shuffle(hid) < 0) {
129 HDF5ErrMapper::ToException<PropertyException>(
130 "Error setting shuffle property");
134inline void Caching::apply(
const hid_t hid)
const {
135 if (H5Pset_chunk_cache(hid, _numSlots, _cacheSize, _w0) < 0) {
136 HDF5ErrMapper::ToException<PropertyException>(
137 "Error setting dataset cache parameters");
141inline void CreateIntermediateGroup::apply(
const hid_t hid)
const {
142 if (H5Pset_create_intermediate_group(hid, _create ? 1 : 0) < 0) {
143 HDF5ErrMapper::ToException<PropertyException>(
144 "Error setting property for create intermediate groups");
Definition H5Object.hpp:36
PropertyListBase() noexcept
Definition H5PropertyList_misc.hpp:60
void _initializeIfNeeded()
Definition H5PropertyList_misc.hpp:65
void add(const P &property)
Definition H5PropertyList_misc.hpp:77
void add(const F &funct, const Args &... args)
Definition H5PropertyList_misc.hpp:84
Definition H5_definitions.hpp:15
PropertyType
Types of property lists.
Definition H5PropertyList.hpp:24