summaryrefslogtreecommitdiffstats
path: root/c++
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2017-03-19 04:40:37 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2017-03-19 04:40:37 (GMT)
commit34731511da3f3064b0f6e6681516be7b34d0bfbf (patch)
treea2103d5311bb7c51e520916523900f7f00abd4cb /c++
parentc89e53431bff1fd584aabbe6d326df7d69361219 (diff)
downloadhdf5-34731511da3f3064b0f6e6681516be7b34d0bfbf.zip
hdf5-34731511da3f3064b0f6e6681516be7b34d0bfbf.tar.gz
hdf5-34731511da3f3064b0f6e6681516be7b34d0bfbf.tar.bz2
Purpose: Add new C++ wrappers
Description: Because H5Pset_file_space and H5Pget_file_space are deprecated, changed to make wrappers for the new functions instead: H5Ps/get_file_space_strategy H5Ps/get_file_space_page_size New wrappers in FileCreatPropList: // Sets the strategy and the threshold value that the library will // will employ in managing file space. void setFileSpaceStrategy(H5F_fspace_strategy_t strategy, hbool_t persist, hsize_t threshold) const; // Returns the strategy that the library uses in managing file space. void getFileSpaceStrategy(H5F_fspace_strategy_t& strategy, hbool_t& persist, hsize_t& threshold) const; // Sets the file space page size for paged aggregation. void setFileSpacePagesize(hsize_t fsp_psize) const; // Returns the threshold value that the library uses in tracking free // space sections. hsize_t getFileSpacePagesize() const; Platforms tested: Linux/32 2.6 (jam) Linux/64 (platypus) Darwin (osx1010test)
Diffstat (limited to 'c++')
-rw-r--r--c++/src/H5Attribute.cpp2
-rw-r--r--c++/src/H5FcreatProp.cpp63
-rw-r--r--c++/src/H5FcreatProp.h9
-rw-r--r--c++/test/tfile.cpp46
4 files changed, 73 insertions, 47 deletions
diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp
index 6701f6e..c506906 100644
--- a/c++/src/H5Attribute.cpp
+++ b/c++/src/H5Attribute.cpp
@@ -1,7 +1,7 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
-/* All rights reserved. *
+ * All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
diff --git a/c++/src/H5FcreatProp.cpp b/c++/src/H5FcreatProp.cpp
index c490f26..893db64 100644
--- a/c++/src/H5FcreatProp.cpp
+++ b/c++/src/H5FcreatProp.cpp
@@ -295,7 +295,7 @@ unsigned FileCreatPropList::getIstorek() const
}
//--------------------------------------------------------------------------
-// Function: FileCreatPropList::setFileSpace
+// Function: FileCreatPropList::setFileSpaceStrategy
///\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
@@ -307,62 +307,71 @@ unsigned FileCreatPropList::getIstorek() const
/// 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
+void FileCreatPropList::setFileSpaceStrategy(H5F_fspace_strategy_t strategy, hbool_t persist, hsize_t threshold) const
{
- herr_t ret_value = H5Pset_file_space(id, strategy, threshold);
+ herr_t ret_value = H5Pset_file_space_strategy(id, strategy, persist, threshold);
if (ret_value < 0)
{
- throw PropListIException("FileCreatPropList::setFileSpace",
- "H5Pset_file_space failed");
+ throw PropListIException("FileCreatPropList::setFileSpaceStrategy",
+ "H5Pset_file_space_strategy failed");
}
}
//--------------------------------------------------------------------------
// Function: FileCreatPropList::getFileSpaceStrategy
-///\brief Returns the strategy that the library uses in managing file space.
-///\return The strategy value
+///\brief Retrieves the strategy, persist, and threshold that the library
+/// uses in managing file space.
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - Feb, 2017
//--------------------------------------------------------------------------
-H5F_file_space_type_t FileCreatPropList::getFileSpaceStrategy() const
+void FileCreatPropList::getFileSpaceStrategy(H5F_fspace_strategy_t& strategy, hbool_t& persist, hsize_t& threshold) const
{
- H5F_file_space_type_t strategy = H5F_FILE_SPACE_ALL;
- herr_t ret_value = H5Pget_file_space(id, &strategy, NULL);
+ herr_t ret_value = H5Pget_file_space_strategy(id, &strategy, &persist, &threshold);
if (ret_value < 0)
{
throw PropListIException("FileCreatPropList::getFileSpaceStrategy",
- "H5Pget_file_space for strategy failed");
+ "H5Pget_file_space_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
+// Function: FileCreatPropList::setFileSpacePagesize
+///\brief Sets the file space page size for paged aggregation.
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - Feb, 2017
//--------------------------------------------------------------------------
-hsize_t FileCreatPropList::getFileSpaceThreshold() const
+void FileCreatPropList::setFileSpacePagesize(hsize_t fsp_psize) const
{
- hsize_t threshold = 0;
- herr_t ret_value = H5Pget_file_space(id, NULL, &threshold);
+ herr_t ret_value = H5Pset_file_space_page_size(id, fsp_psize);
if (ret_value < 0)
{
- throw PropListIException("FileCreatPropList::getFileSpaceThreshold",
- "H5Pget_file_space for threshold failed");
+ throw PropListIException("FileCreatPropList::setFileSpacePagesize",
+ "H5Pset_file_space_page_size failed");
}
- return(threshold);
+}
+
+//--------------------------------------------------------------------------
+// Function: FileCreatPropList::getFileSpacePagesize
+///\brief Returns the file space page size for aggregating small
+/// metadata or raw data.
+///\return File space page size
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - Feb, 2017
+//--------------------------------------------------------------------------
+hsize_t FileCreatPropList::getFileSpacePagesize() const
+{
+ hsize_t fsp_psize = 0;
+ herr_t ret_value = H5Pget_file_space_page_size(id, &fsp_psize);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileCreatPropList::getFileSpacePagesize",
+ "H5Pget_file_space_page_size failed");
+ }
+ return(fsp_psize);
}
//--------------------------------------------------------------------------
diff --git a/c++/src/H5FcreatProp.h b/c++/src/H5FcreatProp.h
index 7b594a3..6beac02 100644
--- a/c++/src/H5FcreatProp.h
+++ b/c++/src/H5FcreatProp.h
@@ -67,14 +67,17 @@ class H5_DLLCPP FileCreatPropList : public PropList {
// 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;
+ void setFileSpaceStrategy(H5F_fspace_strategy_t strategy, hbool_t persist, hsize_t threshold) const;
// Returns the strategy that the library uses in managing file space.
- H5F_file_space_type_t getFileSpaceStrategy() const;
+ void getFileSpaceStrategy(H5F_fspace_strategy_t& strategy, hbool_t& persist, hsize_t& threshold) const;
+
+ // Sets the file space page size for paged aggregation.
+ void setFileSpacePagesize(hsize_t fsp_psize) const;
// Returns the threshold value that the library uses in tracking free
// space sections.
- hsize_t getFileSpaceThreshold() const;
+ hsize_t getFileSpacePagesize() const;
///\brief Returns this class name.
virtual H5std_string fromClass() const { return("FileCreatPropList"); }
diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp
index eb07657..78fab09 100644
--- a/c++/test/tfile.cpp
+++ b/c++/test/tfile.cpp
@@ -812,19 +812,17 @@ const H5std_string FILE7("tfile7.h5");
*
*-------------------------------------------------------------------------
*/
+const hsize_t FSP_SIZE_DEF = 4096;
+const hsize_t FSP_SIZE512 = 512;
static void test_file_info()
{
// Output message about test being performed
SUBTEST("File general information");
-#ifndef H5_NO_DEPRECATED_SYMBOLS
- hsize_t in_threshold = 2; // Free space section threshold to set */
- hsize_t out_threshold = 0; // Free space section threshold to get */
- // File space handling strategy
- H5F_file_space_type_t in_strategy = H5F_FILE_SPACE_ALL;
+ hsize_t out_threshold = 0; // Free space section threshold to get
+ hbool_t out_persist = FALSE;// Persist free-space read
// File space handling strategy
- H5F_file_space_type_t out_strategy = H5F_FILE_SPACE_DEFAULT;
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ H5F_fspace_strategy_t out_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR;
try {
// Create a file using default properties.
@@ -843,14 +841,30 @@ static void test_file_info()
// Create file creation property list.
FileCreatPropList fcpl;
+ // Retrieve file space information.
+ fcpl.getFileSpaceStrategy(out_strategy, out_persist, out_threshold);
+
+ // Verify file space information.
+ verify_val(out_strategy, H5F_FSPACE_STRATEGY_FSM_AGGR, "H5File::getFileInfo", __LINE__, __FILE__);
+ verify_val(out_persist, FALSE, "H5File::getFileInfo", __LINE__, __FILE__);
+ verify_val(out_threshold, 1, "H5File::getFileInfo", __LINE__, __FILE__);
+
+ /* Retrieve file space page size */
+ hsize_t out_fsp_psize = fcpl.getFileSpacePagesize();
+ verify_val(out_fsp_psize, FSP_SIZE_DEF, "FileCreatPropList::getFileSpacePagesize", __LINE__, __FILE__);
+
// Set various file information.
fcpl.setUserblock(F2_USERBLOCK_SIZE);
fcpl.setSizes(F2_OFFSET_SIZE, F2_LENGTH_SIZE);
fcpl.setSymk(F2_SYM_INTERN_K, F2_SYM_LEAF_K);
fcpl.setIstorek(F2_ISTORE);
-#ifndef H5_NO_DEPRECATED_SYMBOLS
- fcpl.setFileSpace(in_strategy, in_threshold);
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+ hsize_t threshold = 5; // Free space section threshold to set
+ hbool_t persist = TRUE; // Persist free-space to set
+ H5F_fspace_strategy_t strategy = H5F_FSPACE_STRATEGY_PAGE;
+
+ fcpl.setFileSpaceStrategy(strategy, persist, threshold);
+ fcpl.setFileSpacePagesize(FSP_SIZE512);
// Creating a file with the non-default file creation property list
// should create a version 1 superblock
@@ -912,14 +926,14 @@ static void test_file_info()
VERIFY(nindexes, MISC11_NINDEXES, "H5Pget_shared_mesg_nindexes");
*/
-#ifndef H5_NO_DEPRECATED_SYMBOLS
// Get and verify the file space info from the creation property list */
- out_strategy = fcpl2.getFileSpaceStrategy();
- verify_val(static_cast<unsigned>(out_strategy), static_cast<unsigned>(in_strategy), "FileCreatPropList::getFileSpaceStrategy", __LINE__, __FILE__);
+ fcpl2.getFileSpaceStrategy(out_strategy, out_persist, out_threshold);
+ verify_val(out_strategy, strategy, "FileCreatPropList::getFileSpaceStrategy", __LINE__, __FILE__);
+ verify_val(out_persist, persist, "FileCreatPropList::getFileSpaceStrategy", __LINE__, __FILE__);
+ verify_val(out_threshold, threshold, "FileCreatPropList::getFileSpaceStrategy", __LINE__, __FILE__);
- out_threshold = fcpl2.getFileSpaceThreshold();
- verify_val(static_cast<unsigned>(out_threshold), static_cast<unsigned>(in_threshold), "FileCreatPropList::getFileSpaceThreshold", __LINE__, __FILE__);
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ out_fsp_psize = fcpl2.getFileSpacePagesize();
+ verify_val(out_fsp_psize, FSP_SIZE512, "FileCreatPropList::getFileSpacePagesize", __LINE__, __FILE__);
PASSED();
} // end of try block