|
7 | 7 |
|
8 | 8 | //TODO: if constexpr(..){} >= c++17 |
9 | 9 | namespace h5 { |
10 | | - /** \func_create_hdr |
11 | | - * \code |
12 | | - * examples: |
13 | | - * //creates a dataset with 2*myvec.size() + offset |
14 | | - * auto ds = h5::create( "path/to/file.h5", "path/to/dataset", myvec, h5::offset{5}, h5::stride{2} ); |
15 | | - * // explicit dataset spec |
16 | | - * \endcode |
17 | | - * \par_file_path \par_dataset_path \par_current_dims \par_max_dims |
18 | | - * \par_lcpl \par_dcpl \par_dapl \tpar_T \returns_ds |
19 | | - */ |
| 10 | + /** @ingroup io-create |
| 11 | + * @brief creates a dataset within an already opened HDF5 container |
| 12 | + * By default the HDF5 dataset size, the file space, is derived from the passed object properties, or may be explicitly specified |
| 13 | + * with optional properties such as h5::count, h5::current_dims h5::max_dims, h5::stride, h5::block |
| 14 | + * @param fd valid h5::fd_t descriptor |
| 15 | + * @param dataset_path where the dataset is, or will be created within the HDF5 file |
| 16 | + * @param args[, ...] comma separated list of arguments in arbitrary order, only `T object` | `const T*` is required |
| 17 | + * @return h5::ds_t a valid, RAII enabled handle, binary compatible with HDF5 CAP `hid_t` |
| 18 | + * |
| 19 | + * @tparam T C++ type of dataset being written into HDF5 container |
| 20 | + * |
| 21 | + * <br/>The following arguments are context sensitive, may be passed in arbitrary order and with the exception |
| 22 | + * of `const ref&` or `const T*` object being saved/memory region pointed to, the arguments are optional. By default the arguments are set to sensible values, |
| 23 | + * and in most cases the function call will deliver good performance. With that in mind, the options below provide an easy to use high level fine |
| 24 | + * tuning mechanism to get the best experience without calling HDF5 CAPI functions directly. |
| 25 | + * |
| 26 | + * @param h5::current_dims_t optionaly defines the size of the dataset, applicable only to datasets which has to be created |
| 27 | + * When omitted, the system computes the default value as follows `h5::block{..}` and `h5::stride{..}` given as: |
| 28 | + * `current_dims[i] = count[i] (stride[i] - block[i] + 1) + offset[i]` and when only `h5::count` is available |
| 29 | + * `current_dims[i] = count[i] + offset[i]` |
| 30 | + * @param h5::max_dims_t optional maximum size of dataset, applicable only to datasets which has to be created `max_dims[i] >= current_dims[i]` |
| 31 | + * or `H5S_UNLIMITED` along the dimension intended to be extendable |
| 32 | + * @param h5::dcpl_t data creation property list, used only if dataset needs to be created |
| 33 | + * @param h5::lcpl_t link control property list, controls how path is created when applicabl |
| 34 | + * <br/><b>example:</b> |
| 35 | + * @code |
| 36 | + * auto ds = h5::create<short>("file.h5","path/to/dataset", |
| 37 | + * h5::current_dims{10,20}, h5::max_dims{10,H5S_UNLIMITED}, |
| 38 | + * h5::create_path | h5::utf8, // optional lcpl with this default settings** |
| 39 | + * h5::chunk{2,3} | h5::fill_value<short>{42} | h5::fletcher32 | h5::shuffle | h5::nbit | h5::gzip{9}) |
| 40 | + * @endcode |
| 41 | + */ |
20 | 42 | template<class T, class... args_t> inline |
21 | 43 | h5::ds_t create( const h5::fd_t& fd, const std::string& dataset_path, args_t&&... args ) try { |
22 | 44 | // compile time check of property lists: |
@@ -80,7 +102,38 @@ namespace h5 { |
80 | 102 | throw h5::error::io::dataset::create( err.what() ); |
81 | 103 | } |
82 | 104 |
|
83 | | - // delegate to h5::fd_t |
| 105 | + /** @ingroup io-create |
| 106 | + * @brief creates a dataset within an HDF5 container opened with flag `H5F_ACC_RDWR` |
| 107 | + * By default the HDF5 dataset size, the file space, is derived from the passed object properties, or may be explicitly specified |
| 108 | + * with optional properties such as h5::count, h5::current_dims h5::max_dims, h5::stride, h5::block |
| 109 | + * @param file_path path the the HDF5 file |
| 110 | + * @param dataset_path where the dataset is, or will be created within the HDF5 file |
| 111 | + * @param args[, ...] comma separated list of arguments in arbitrary order, only `T object` | `const T*` is required |
| 112 | + * @return h5::ds_t a valid, RAII enabled handle, binary compatible with HDF5 CAP `hid_t` |
| 113 | + * |
| 114 | + * @tparam T C++ type of dataset being written into HDF5 container |
| 115 | + * |
| 116 | + * <br/>The following arguments are context sensitive, may be passed in arbitrary order and with the exception |
| 117 | + * of `const ref&` or `const T*` object being saved/memory region pointed to, the arguments are optional. By default the arguments are set to sensible values, |
| 118 | + * and in most cases the function call will deliver good performance. With that in mind, the options below provide an easy to use high level fine |
| 119 | + * tuning mechanism to get the best experience without calling HDF5 CAPI functions directly. |
| 120 | + * |
| 121 | + * @param h5::current_dims_t optionaly defines the size of the dataset, applicable only to datasets which has to be created |
| 122 | + * When omitted, the system computes the default value as follows `h5::block{..}` and `h5::stride{..}` given as: |
| 123 | + * `current_dims[i] = count[i] (stride[i] - block[i] + 1) + offset[i]` and when only `h5::count` is available |
| 124 | + * `current_dims[i] = count[i] + offset[i]` |
| 125 | + * @param h5::max_dims_t optional maximum size of dataset, applicable only to datasets which has to be created `max_dims[i] >= current_dims[i]` |
| 126 | + * or `H5S_UNLIMITED` along the dimension intended to be extendable |
| 127 | + * @param h5::dcpl_t data creation property list, used only if dataset needs to be created |
| 128 | + * @param h5::lcpl_t link control property list, controls how path is created when applicabl |
| 129 | + * <br/><b>example:</b> |
| 130 | + * @code |
| 131 | + * auto ds = h5::create<short>("file.h5","path/to/dataset", |
| 132 | + * h5::current_dims{10,20}, h5::max_dims{10,H5S_UNLIMITED}, |
| 133 | + * h5::create_path | h5::utf8, // optional lcpl with this default settings** |
| 134 | + * h5::chunk{2,3} | h5::fill_value<short>{42} | h5::fletcher32 | h5::shuffle | h5::nbit | h5::gzip{9}) |
| 135 | + * @endcode |
| 136 | + */ |
84 | 137 | template<class T, class... args_t> |
85 | 138 | inline h5::ds_t create( const std::string& file_path, const std::string& dataset_path, args_t&&... args ){ |
86 | 139 | h5::fd_t fd = h5::open(file_path, H5F_ACC_RDWR, h5::default_fapl); |
|
0 commit comments