RMF
DataSetAccessPropertiesD.h
Go to the documentation of this file.
1 /**
2  * \file RMF/HDF5/DataSetAccessPropertiesD.h
3  * \brief Handle read/write of Model data from/to files.
4  *
5  * Copyright 2007-2022 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef RMF_HDF5_DATA_SET_ACCESS_PROPERTIES_D_H
10 #define RMF_HDF5_DATA_SET_ACCESS_PROPERTIES_D_H
11 
12 #include "RMF/config.h"
13 #include "DataSetIndexD.h"
14 #include <memory>
15 
16 RMF_ENABLE_WARNINGS namespace RMF {
17  namespace HDF5 {
18 
19  /** A class to manage properties controlling access to HDF5 data sets.*/
20  template <class TypeTraits, unsigned int D>
22  std::shared_ptr<SharedHandle> h_;
23 
24  protected:
25  DataSetAccessPropertiesD(hid_t type)
26  : h_(new SharedHandle(H5Pcreate(type), &H5Pclose, "Properties")) {}
27 
28  public:
29  hid_t get_handle() const { return *h_; }
30  /* Set the chunk cache to a certain size. See
31  \external{https://support.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetChunkCache,H5Pset_chunk_cache}.
32  */
33  void set_chunk_cache_size(unsigned int entries, unsigned int size_bytes,
34  double policy = .75) {
36  H5Pset_chunk_cache(get_handle(), entries, size_bytes, policy));
37  }
39  : h_(new SharedHandle(H5Pcreate(H5P_DATASET_ACCESS), &H5Pclose,
40  "Properties")) {}
41  };
42 
43  } /* namespace HDF5 */
44 } /* namespace RMF */
45 
46 RMF_DISABLE_WARNINGS
47 
48 #endif /* RMF_HDF5_DATA_SET_ACCESS_PROPERTIES_D_H */
Handle read/write of Model data from/to files.
Share an HDF5 handle.
Definition: handle.h:87
#define RMF_HDF5_CALL(v)