diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2017-02-17 21:34:43 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2017-02-17 21:34:43 (GMT) |
commit | 7e4b64bd834c95fee396aabc2cb73227f7baf873 (patch) | |
tree | a319310494ec440e7f90e708763b9b30def35bd4 /c++/src | |
parent | 9fba21485d26699c229ff023c3d601e187a6a51c (diff) | |
parent | 5f759d6d9f804d99572f605f9d9933c897ef3671 (diff) | |
download | hdf5-7e4b64bd834c95fee396aabc2cb73227f7baf873.zip hdf5-7e4b64bd834c95fee396aabc2cb73227f7baf873.tar.gz hdf5-7e4b64bd834c95fee396aabc2cb73227f7baf873.tar.bz2 |
Merge pull request #298 in HDFFV/hdf5 from ~BMRIBLER/hdf5_bmr_cpp:develop to develop
New C++ wrappers for H5P[s/g]et_file_space.
* commit '5f759d6d9f804d99572f605f9d9933c897ef3671':
Description: Fixed and added function comments. Platform tested: Jam (very minor)
Description: Fixed small typos Platform tested: Jam (very minor)
Purpose: Add new C++ wrappers Description: Added wrappers for H5Pset_file_space and H5Pget_file_space
Diffstat (limited to 'c++/src')
-rw-r--r-- | c++/src/H5FcreatProp.cpp | 71 | ||||
-rw-r--r-- | c++/src/H5FcreatProp.h | 11 |
2 files changed, 82 insertions, 0 deletions
diff --git a/c++/src/H5FcreatProp.cpp b/c++/src/H5FcreatProp.cpp index 5a99dba..ed6064f 100644 --- a/c++/src/H5FcreatProp.cpp +++ b/c++/src/H5FcreatProp.cpp @@ -295,6 +295,77 @@ unsigned FileCreatPropList::getIstorek() const } //-------------------------------------------------------------------------- +// Function: FileCreatPropList::setFileSpace +///\brief Sets the strategy and the threshold value that the library +/// will employ in managing file space. +///\param strategy - IN: Strategy for file space management +///\param threshold - IN: Free-space section threshold. The library +/// default is 1, which is to track all free-space sections. +///\exception H5::PropListIException +///\par Description +/// If the given strategy is zero, the property will not be +/// changed and the existing strategy will be retained. +/// If the given threshold value is zero, the property will not be +/// changed and the existing threshold will be retained. +/// Valid values of \a libver_low are as follows: +/// \li \c H5F_FILE_SPACE_ALL (Default) +/// \li \c H5F_FILE_SPACE_ALL_PERSIST +/// \li \c H5F_FILE_SPACE_AGGR_VFD +/// \li \c H5F_FILE_SPACE_VFD +/// For information, please see the C layer Reference Manual at: +/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFileSpace +// Programmer Binh-Minh Ribler - Feb, 2017 +//-------------------------------------------------------------------------- +void FileCreatPropList::setFileSpace(H5F_file_space_type_t strategy, hsize_t threshold) const +{ + herr_t ret_value = H5Pset_file_space(id, strategy, threshold); + if( ret_value < 0 ) + { + throw PropListIException("FileCreatPropList::setFileSpace", + "H5Pset_file_space failed"); + } +} + +//-------------------------------------------------------------------------- +// Function: FileCreatPropList::getFileSpaceStrategy +///\brief Returns the strategy that the library uses in managing file space. +///\return The strategy value +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - Feb, 2017 +//-------------------------------------------------------------------------- +H5F_file_space_type_t FileCreatPropList::getFileSpaceStrategy() const +{ + H5F_file_space_type_t strategy = H5F_FILE_SPACE_ALL; + herr_t ret_value = H5Pget_file_space(id, &strategy, NULL); + if (ret_value < 0) + { + throw PropListIException("FileCreatPropList::getFileSpaceStrategy", + "H5Pget_file_space for strategy failed"); + } + return(strategy); +} + +//-------------------------------------------------------------------------- +// Function: FileCreatPropList::getFileSpaceThreshold +///\brief Returns the threshold value that the library uses in tracking +/// free space sections. +///\return The threshold value +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - Feb, 2017 +//-------------------------------------------------------------------------- +hsize_t FileCreatPropList::getFileSpaceThreshold() const +{ + hsize_t threshold = 0; + herr_t ret_value = H5Pget_file_space(id, NULL, &threshold); + if (ret_value < 0) + { + throw PropListIException("FileCreatPropList::getFileSpaceThreshold", + "H5Pget_file_space for threshold failed"); + } + return(threshold); +} + +//-------------------------------------------------------------------------- // Function: FileCreatPropList destructor ///\brief Noop destructor. // Programmer Binh-Minh Ribler - 2000 diff --git a/c++/src/H5FcreatProp.h b/c++/src/H5FcreatProp.h index 1ac925e..cadff8b 100644 --- a/c++/src/H5FcreatProp.h +++ b/c++/src/H5FcreatProp.h @@ -65,6 +65,17 @@ class H5_DLLCPP FileCreatPropList : public PropList { // indexing chunked datasets. void setIstorek( unsigned ik ) const; + // Sets the strategy and the threshold value that the library will + // will employ in managing file space. + void setFileSpace(H5F_file_space_type_t strategy, hsize_t threshold) const; + + // Returns the strategy that the library uses in managing file space. + H5F_file_space_type_t getFileSpaceStrategy() const; + + // Returns the threshold value that the library uses in tracking free + // space sections. + hsize_t getFileSpaceThreshold() const; + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("FileCreatPropList"); } |