summaryrefslogtreecommitdiffstats
path: root/c++/src
diff options
context:
space:
mode:
authorDavid Young <dyoung@hdfgroup.org>2019-12-09 16:30:58 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2019-12-09 16:30:58 (GMT)
commitc8f533cfc33ac743227cbed8eba361c715a2976f (patch)
treebcae5320f80bac774647cacbbd8493604f9384d2 /c++/src
parentadcf8a315e82c0848d126e7e46b662930c081896 (diff)
downloadhdf5-c8f533cfc33ac743227cbed8eba361c715a2976f.zip
hdf5-c8f533cfc33ac743227cbed8eba361c715a2976f.tar.gz
hdf5-c8f533cfc33ac743227cbed8eba361c715a2976f.tar.bz2
Merge all of my changes from merge-back-to-feature-vfd_swmr-attempt-1,
including the merge of `hdffv/hdf5/develop`, back to the branch that Vailin and I share. Now I need to put this branch on a fork with a less confusing name than vchoi_fork!
Diffstat (limited to 'c++/src')
-rw-r--r--c++/src/C2Cppfunction_map.htm36
-rw-r--r--c++/src/CMakeLists.txt51
-rw-r--r--c++/src/H5CppDoc.h3
-rw-r--r--c++/src/H5DataSet.cpp8
-rw-r--r--c++/src/H5DxferProp.h4
-rw-r--r--c++/src/H5FaccProp.cpp12
-rw-r--r--c++/src/H5File.cpp70
-rw-r--r--c++/src/H5File.h7
-rw-r--r--c++/src/H5IdComponent.cpp4
-rw-r--r--c++/src/H5LaccProp.h11
-rw-r--r--c++/src/H5LcreatProp.cpp40
-rw-r--r--c++/src/H5LcreatProp.h19
-rw-r--r--c++/src/H5Location.cpp7
-rw-r--r--c++/src/H5Object.cpp73
-rw-r--r--c++/src/H5Object.h26
-rw-r--r--c++/src/H5PropList.cpp2
-rw-r--r--c++/src/cpp_doc_config2
17 files changed, 313 insertions, 62 deletions
diff --git a/c++/src/C2Cppfunction_map.htm b/c++/src/C2Cppfunction_map.htm
index b53ea15..2d779a3 100644
--- a/c++/src/C2Cppfunction_map.htm
+++ b/c++/src/C2Cppfunction_map.htm
@@ -7666,6 +7666,42 @@ normal'><span style='font-size:14.0pt;mso-bidi-font-size:11.0pt;line-height:
normal'><o:p>&nbsp;</o:p></p>
</td>
</tr>
+ <tr style='mso-yfti-irow:180'>
+ <td width=263 style='width:197.2pt;border:solid windowtext 1.0pt;border-top:
+ none;mso-border-top-alt:solid windowtext .5pt;mso-border-alt:solid windowtext .5pt;
+ padding:0in 5.4pt 0in 5.4pt'>
+ <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
+ normal'>H5Fget_fileno</p>
+ </td>
+ <td width=474 valign=top style='width:355.2pt;border-top:none;border-left:
+ none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+ mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
+ mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt'>
+ <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
+ normal'>unsigned long H5File::getFileNum()</p>
+ </td>
+ <td width=35 valign=top style='width:26.05pt;border-top:none;border-left:
+ none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+ mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
+ mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt'>
+ <p class=MsoNormal align=center style='margin-bottom:0in;margin-bottom:.0001pt;
+ text-align:center;line-height:normal'><o:p>&nbsp;</o:p></p>
+ </td>
+ <td width=42 valign=top style='width:31.45pt;border-top:none;border-left:
+ none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+ mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
+ mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt'>
+ <p class=MsoNormal align=center style='margin-bottom:0in;margin-bottom:.0001pt;
+ text-align:center;line-height:normal'><o:p>&nbsp;</o:p></p>
+ </td>
+ <td width=169 valign=top style='width:126.65pt;border-top:none;border-left:
+ none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+ mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
+ mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt'>
+ <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
+ normal'><o:p>&nbsp;</o:p></p>
+ </td>
+ </tr>
<tr style='mso-yfti-irow:181'>
<td width=263 style='width:197.2pt;border:solid windowtext 1.0pt;border-top:
none;mso-border-top-alt:solid windowtext .5pt;mso-border-alt:solid windowtext .5pt;
diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt
index 945b352..2a92ed2 100644
--- a/c++/src/CMakeLists.txt
+++ b/c++/src/CMakeLists.txt
@@ -84,24 +84,26 @@ set (CPP_HDRS
${HDF5_CPP_SRC_SOURCE_DIR}/H5VarLenType.h
)
-add_library (${HDF5_CPP_LIB_TARGET} STATIC ${CPP_SOURCES} ${CPP_HDRS})
-target_include_directories(${HDF5_CPP_LIB_TARGET}
- PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
- INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
-)
-target_compile_definitions(${HDF5_CPP_LIB_TARGET}
- PRIVATE $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings
-)
-TARGET_C_PROPERTIES (${HDF5_CPP_LIB_TARGET} STATIC)
-target_link_libraries (${HDF5_CPP_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET})
-set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIB_TARGET}")
-H5_SET_LIB_OPTIONS (${HDF5_CPP_LIB_TARGET} ${HDF5_CPP_LIB_NAME} STATIC 0)
-set_target_properties (${HDF5_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/cpp)
-set (install_targets ${HDF5_CPP_LIB_TARGET})
+if (NOT ONLY_SHARED_LIBS)
+ add_library (${HDF5_CPP_LIB_TARGET} STATIC ${CPP_SOURCES} ${CPP_HDRS})
+ target_include_directories (${HDF5_CPP_LIB_TARGET}
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+ target_compile_definitions(${HDF5_CPP_LIB_TARGET}
+ PRIVATE $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings
+ )
+ TARGET_C_PROPERTIES (${HDF5_CPP_LIB_TARGET} STATIC)
+ target_link_libraries (${HDF5_CPP_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET})
+ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIB_TARGET}")
+ H5_SET_LIB_OPTIONS (${HDF5_CPP_LIB_TARGET} ${HDF5_CPP_LIB_NAME} STATIC 0)
+ set_target_properties (${HDF5_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/cpp)
+ set (install_targets ${HDF5_CPP_LIB_TARGET})
+endif ()
if (BUILD_SHARED_LIBS)
add_library (${HDF5_CPP_LIBSH_TARGET} SHARED ${CPP_SOURCES} ${CPP_HDRS})
- target_include_directories(${HDF5_CPP_LIBSH_TARGET}
+ target_include_directories (${HDF5_CPP_LIBSH_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
@@ -110,7 +112,14 @@ if (BUILD_SHARED_LIBS)
PRIVATE $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings
)
TARGET_C_PROPERTIES (${HDF5_CPP_LIBSH_TARGET} SHARED)
- target_link_libraries (${HDF5_CPP_LIBSH_TARGET} PUBLIC ${HDF5_LIBSH_TARGET})
+ target_link_libraries (${HDF5_CPP_LIBSH_TARGET}
+ PUBLIC ${HDF5_LIBSH_TARGET}
+ )
+ if (MINGW)
+ target_link_options (${HDF5_CPP_LIBSH_TARGET}
+ PRIVATE -static-libgcc -static-libstdc++
+ )
+ endif ()
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIBSH_TARGET}")
H5_SET_LIB_OPTIONS (${HDF5_CPP_LIBSH_TARGET} ${HDF5_CPP_LIB_NAME} SHARED "CXX")
set_target_properties (${HDF5_CPP_LIBSH_TARGET} PROPERTIES FOLDER libraries/cpp)
@@ -136,7 +145,9 @@ if (HDF5_EXPORTED_TARGETS)
if (BUILD_SHARED_LIBS)
INSTALL_TARGET_PDB (${HDF5_CPP_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries)
endif ()
- INSTALL_TARGET_PDB (${HDF5_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries)
+ if (NOT ONLY_SHARED_LIBS)
+ INSTALL_TARGET_PDB (${HDF5_CPP_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} cpplibraries)
+ endif ()
install (
TARGETS
@@ -163,7 +174,9 @@ set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}")
set (_PKG_CONFIG_LIBS_PRIVATE)
-set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_CPP_LIB_CORENAME}")
+if (NOT ONLY_SHARED_LIBS)
+ set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_CPP_LIB_CORENAME}")
+endif ()
if (BUILD_SHARED_LIBS)
set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_CPP_LIB_CORENAME}")
endif ()
@@ -182,7 +195,7 @@ install (
COMPONENT cpplibraries
)
-if (NOT WIN32)
+if (NOT WIN32 AND NOT MINGW)
set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER})
configure_file (
${HDF_RESOURCES_DIR}/libh5cc.in
diff --git a/c++/src/H5CppDoc.h b/c++/src/H5CppDoc.h
index 0da98a4..5e80408 100644
--- a/c++/src/H5CppDoc.h
+++ b/c++/src/H5CppDoc.h
@@ -53,8 +53,7 @@
* <br />
* \section install_sec Installation
*
- * The HDF5 C++ API is included with the HDF5 source code and can
- * be obtained from
+ * The HDF5 C++ API is included with the HDF5 source code.
*
* Please refer to the release_docs/INSTALL file under the top directory
* of the HDF5 source code for information about installing, building,
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index db14577..a071289 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -369,10 +369,10 @@ void DataSet::vlenReclaim(const DataType& type, const DataSpace& space, const DS
hid_t space_id = space.getId();
hid_t xfer_plist_id = xfer_plist.getId();
- herr_t ret_value = H5Dvlen_reclaim(type_id, space_id, xfer_plist_id, buf);
+ herr_t ret_value = H5Treclaim(type_id, space_id, xfer_plist_id, buf);
if (ret_value < 0)
{
- throw DataSetIException("DataSet::vlenReclaim", "H5Dvlen_reclaim failed");
+ throw DataSetIException("DataSet::vlenReclaim", "H5Treclaim failed");
}
}
@@ -397,10 +397,10 @@ void DataSet::vlenReclaim(void* buf, const DataType& type, const DataSpace& spac
hid_t space_id = space.getId();
hid_t xfer_plist_id = xfer_plist.getId();
- herr_t ret_value = H5Dvlen_reclaim(type_id, space_id, xfer_plist_id, buf);
+ herr_t ret_value = H5Treclaim(type_id, space_id, xfer_plist_id, buf);
if (ret_value < 0)
{
- throw DataSetIException("DataSet::vlenReclaim", "H5Dvlen_reclaim failed");
+ throw DataSetIException("DataSet::vlenReclaim", "H5Treclaim failed");
}
}
diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h
index 6955778..e53a03b 100644
--- a/c++/src/H5DxferProp.h
+++ b/c++/src/H5DxferProp.h
@@ -66,7 +66,7 @@ class H5_DLLCPP DSetMemXferPropList : public PropList {
void getTypeConvCB(H5T_conv_except_func_t *op, void **user_data) const;
// Sets the memory manager for variable-length datatype
- // allocation in H5Dread and H5Dvlen_reclaim.
+ // allocation in H5Dread and H5Treclaim.
void setVlenMemManager(H5MM_allocate_t alloc, void* alloc_info,
H5MM_free_t free, void* free_info) const;
@@ -75,7 +75,7 @@ class H5_DLLCPP DSetMemXferPropList : public PropList {
void setVlenMemManager() const;
// Gets the memory manager for variable-length datatype
- // allocation in H5Dread and H5Tvlen_reclaim.
+ // allocation in H5Dread and H5Treclaim.
void getVlenMemManager(H5MM_allocate_t& alloc, void** alloc_info,
H5MM_free_t& free, void** free_info) const;
diff --git a/c++/src/H5FaccProp.cpp b/c++/src/H5FaccProp.cpp
index 1657351..5a478e7 100644
--- a/c++/src/H5FaccProp.cpp
+++ b/c++/src/H5FaccProp.cpp
@@ -696,10 +696,16 @@ unsigned FileAccPropList::getGcReferences() const
/// Valid values of \a libver_low are as follows:
/// \li \c H5F_LIBVER_EARLIEST (Default)
/// \li \c H5F_LIBVER_18
+/// \li \c H5F_LIBVER_110
+/// \li \c H5F_LIBVER_112
+/// \li \c H5F_LIBVER_114
/// \li \c H5F_LIBVER_LATEST
///
/// Valid values of \a libver_high are as follows:
/// \li \c H5F_LIBVER_18
+/// \li \c H5F_LIBVER_110
+/// \li \c H5F_LIBVER_112
+/// \li \c H5F_LIBVER_114
/// \li \c H5F_LIBVER_LATEST (Default)
///
/// For more detail, please refer to the H5Pset_libver_bounds API in
@@ -729,10 +735,16 @@ void FileAccPropList::setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libv
/// values:
/// \li \c H5F_LIBVER_EARLIEST
/// \li \c H5F_LIBVER_18
+/// \li \c H5F_LIBVER_110
+/// \li \c H5F_LIBVER_112
+/// \li \c H5F_LIBVER_114
/// \li \c H5F_LIBVER_LATEST
///
/// and \a libver_high:
/// \li \c H5F_LIBVER_18
+/// \li \c H5F_LIBVER_110
+/// \li \c H5F_LIBVER_112
+/// \li \c H5F_LIBVER_114
/// \li \c H5F_LIBVER_LATEST
// Programmer Binh-Minh Ribler - March, 2015
//--------------------------------------------------------------------------
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp
index 07d7e84..b9ecded 100644
--- a/c++/src/H5File.cpp
+++ b/c++/src/H5File.cpp
@@ -192,16 +192,17 @@ H5File::H5File(const H5File& original) : Group()
//--------------------------------------------------------------------------
bool H5File::isHdf5(const char* name)
{
- // Calls C routine H5Fis_hdf5 to determine whether the file is in
+ // Calls C routine H5Fis_accessible to determine whether the file is in
// HDF5 format. It returns positive value, 0, or negative value
- htri_t ret_value = H5Fis_hdf5(name);
+ htri_t ret_value = H5Fis_accessible(name, H5P_DEFAULT);
+
if (ret_value > 0)
return true;
else if (ret_value == 0)
return false;
- else // Raise exception when H5Fis_hdf5 returns a negative value
+ else // Raise exception when H5Fis_accessible returns a negative value
{
- throw FileIException("H5File::isHdf5", "H5Fis_hdf5 returned negative value");
+ throw FileIException("H5File::isHdf5", "H5Fis_accessible returned negative value");
}
}
@@ -218,6 +219,46 @@ bool H5File::isHdf5(const H5std_string& name)
}
//--------------------------------------------------------------------------
+// Function: H5File::isAccessible (static)
+///\brief Determines whether a file can be accessed as HDF5. (Static)
+///\param name - IN: Name of the file
+///\param access_plist - IN: File access property list. Default to
+/// FileAccPropList::DEFAULT
+///\return true if the file can be accessed as HDF5, and false, otherwise
+///\exception H5::FileIException
+// September 2018
+//--------------------------------------------------------------------------
+bool H5File::isAccessible(const char* name, const FileAccPropList& access_plist)
+{
+ // Calls C routine H5Fis_accessible to determine whether the file is in
+ // HDF5 format. It returns positive value, 0, or negative value
+ hid_t access_plist_id = access_plist.getId();
+ htri_t ret_value = H5Fis_accessible(name, access_plist_id);
+ if (ret_value > 0)
+ return true;
+ else if (ret_value == 0)
+ return false;
+ else // Raise exception when H5Fis_accessible returns a negative value
+ {
+ throw FileIException("H5File::isAccessible", "H5Fis_accessible returned negative value");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: H5File::isAccessible (static)
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes an \c H5std_string for \a name. (Static)
+///\param name - IN: Name of the file - \c H5std_string
+///\param access_plist - IN: File access property list. Default to
+/// FileAccPropList::DEFAULT
+// September 2018
+//--------------------------------------------------------------------------
+bool H5File::isAccessible(const H5std_string& name, const FileAccPropList& access_plist)
+{
+ return(isAccessible(name.c_str(), access_plist));
+}
+
+//--------------------------------------------------------------------------
// Function: openFile
///\brief Opens an HDF5 file
///\param name - IN: Name of the file
@@ -539,6 +580,27 @@ hsize_t H5File::getFileSize() const
}
//--------------------------------------------------------------------------
+// Function: H5File::getFileNum
+///\brief Returns the file number of the HDF5 file.
+///\return File number
+///\exception H5::FileIException
+///\par Description
+/// This function is called after an existing file is opened in
+/// order to retrieve the unique 'file number' for the file.
+// Programmer Quincey Koziol - April 13, 2019
+//--------------------------------------------------------------------------
+unsigned long H5File::getFileNum() const
+{
+ unsigned long fileno = 0;
+ herr_t ret_value = H5Fget_fileno(id, &fileno);
+ if (ret_value < 0)
+ {
+ throw FileIException("H5File::getFileNum", "H5Fget_fileno failed");
+ }
+ return (fileno);
+}
+
+//--------------------------------------------------------------------------
// Function: H5File::getId
///\brief Get the id of this file
///\return File identifier
diff --git a/c++/src/H5File.h b/c++/src/H5File.h
index 473428a..1b1227f 100644
--- a/c++/src/H5File.h
+++ b/c++/src/H5File.h
@@ -69,10 +69,17 @@ class H5_DLLCPP H5File : public Group {
// Returns the file size of the HDF5 file.
hsize_t getFileSize() const;
+ // Returns the 'file number' of the HDF5 file.
+ unsigned long getFileNum() const;
+
// Determines if a file, specified by its name, is in HDF5 format
static bool isHdf5(const char* name);
static bool isHdf5(const H5std_string& name);
+ // Determines if a file, specified by its name, can be accessed as HDF5
+ static bool isAccessible(const char* name, const FileAccPropList& access_plist = FileAccPropList::DEFAULT);
+ static bool isAccessible(const H5std_string& name, const FileAccPropList& access_plist = FileAccPropList::DEFAULT);
+
// Reopens this file.
void reOpen(); // added for better name
diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp
index a041273..40520aa 100644
--- a/c++/src/H5IdComponent.cpp
+++ b/c++/src/H5IdComponent.cpp
@@ -174,8 +174,8 @@ H5I_type_t IdComponent::getHDFObjType() const
/// \li \c H5I_DATASPACE
/// \li \c H5I_DATASET
/// \li \c H5I_ATTR
-/// \li \c H5I_REFERENCE (DEPRECATED)
/// \li \c H5I_VFL
+/// \li \c H5I_VOL
/// \li \c H5I_GENPROP_CLS
/// \li \c H5I_GENPROP_LST
/// \li \c H5I_ERROR_CLASS
@@ -227,8 +227,8 @@ bool IdComponent::isValid(hid_t an_id)
/// \li \c H5I_DATASPACE
/// \li \c H5I_DATASET
/// \li \c H5I_ATTR
-/// \li \c H5I_REFERENCE (DEPRECATED)
/// \li \c H5I_VFL
+/// \li \c H5I_VOL
/// \li \c H5I_GENPROP_CLS
/// \li \c H5I_GENPROP_LST
/// \li \c H5I_ERROR_CLASS
diff --git a/c++/src/H5LaccProp.h b/c++/src/H5LaccProp.h
index 70890b3..ec5e54f 100644
--- a/c++/src/H5LaccProp.h
+++ b/c++/src/H5LaccProp.h
@@ -12,9 +12,6 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-// Class LinkAccPropList represents the HDF5 file access property list and
-// inherits from DataType.
-
#ifndef __H5LinkAccPropList_H
#define __H5LinkAccPropList_H
@@ -22,15 +19,15 @@ namespace H5 {
/*! \class LinkAccPropList
\brief Class LinkAccPropList inherits from PropList and provides
- wrappers for the HDF5 file access property list.
+ wrappers for the HDF5 link access property list.
*/
// Inheritance: PropList -> IdComponent
class H5_DLLCPP LinkAccPropList : public PropList {
public:
- ///\brief Default file access property list.
+ ///\brief Default link access property list.
static const LinkAccPropList& DEFAULT;
- // Creates a file access property list.
+ // Creates a link access property list.
LinkAccPropList();
///\brief Returns this class name.
@@ -39,7 +36,7 @@ class H5_DLLCPP LinkAccPropList : public PropList {
// Copy constructor: same as the original LinkAccPropList.
LinkAccPropList(const LinkAccPropList& original);
- // Creates a copy of an existing file access property list
+ // Creates a copy of an existing link access property list
// using the property list id.
LinkAccPropList (const hid_t plist_id);
diff --git a/c++/src/H5LcreatProp.cpp b/c++/src/H5LcreatProp.cpp
index 695c1fe..bde9339 100644
--- a/c++/src/H5LcreatProp.cpp
+++ b/c++/src/H5LcreatProp.cpp
@@ -103,6 +103,46 @@ LinkCreatPropList::LinkCreatPropList(const LinkCreatPropList& original) : PropLi
LinkCreatPropList::LinkCreatPropList(const hid_t plist_id) : PropList(plist_id) {}
//--------------------------------------------------------------------------
+// Function: LinkCreatPropList::setCreateIntermediateGroup
+///\brief Specifies in property list whether to create missing
+/// intermediate groups.
+///\param crt_intmd_group - IN: Flag specifying whether to create
+/// intermediate groups upon the creation of an object
+///\exception H5::PropListIException
+// April, 2019
+//--------------------------------------------------------------------------
+void LinkCreatPropList::setCreateIntermediateGroup(bool crt_intmd_group) const
+{
+ herr_t ret_value = H5Pset_create_intermediate_group(id, (unsigned)crt_intmd_group);
+ // Throw exception if H5Pset_create_intermediate_group returns failure
+ if (ret_value < 0)
+ {
+ throw PropListIException("setCreateIntermediateGroup", "H5Pset_create_intermediate_group failed");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: LinkCreatPropList::getCreateIntermediateGroup
+///\brief Determines whether property is set to enable creating missing
+/// intermediate groups.
+///\return true if creating intermediate groups is enabled, and false, otherwise
+///\exception H5::PropListIException
+// April, 2019
+//--------------------------------------------------------------------------
+bool LinkCreatPropList::getCreateIntermediateGroup() const
+{
+ unsigned crt_intmd_group;
+ herr_t ret_value = H5Pget_create_intermediate_group(id, &crt_intmd_group);
+ // Throw exception if H5Pget_create_intermediate_group returns failure
+ if (ret_value < 0)
+ {
+ throw PropListIException("getCreateIntermediateGroup", "H5Pget_create_intermediate_group failed");
+ }
+
+ return((bool)crt_intmd_group);
+}
+
+//--------------------------------------------------------------------------
// Function: LinkCreatPropList::setCharEncoding
///\brief Sets the character encoding of the string.
///
diff --git a/c++/src/H5LcreatProp.h b/c++/src/H5LcreatProp.h
index 12cb479..908ef63 100644
--- a/c++/src/H5LcreatProp.h
+++ b/c++/src/H5LcreatProp.h
@@ -12,9 +12,6 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-// Class LinkCreatPropList represents the HDF5 file access property list and
-// inherits from DataType.
-
#ifndef __H5LinkCreatPropList_H
#define __H5LinkCreatPropList_H
@@ -22,15 +19,15 @@ namespace H5 {
/*! \class LinkCreatPropList
\brief Class LinkCreatPropList inherits from PropList and provides
- wrappers for the HDF5 file access property list.
+ wrappers for the HDF5 link creation property list.
*/
// Inheritance: PropList -> IdComponent
class H5_DLLCPP LinkCreatPropList : public PropList {
public:
- ///\brief Default file access property list.
+ ///\brief Default link creation property list.
static const LinkCreatPropList& DEFAULT;
- // Creates a file access property list.
+ // Creates a link creation property list.
LinkCreatPropList();
///\brief Returns this class name.
@@ -39,10 +36,18 @@ class H5_DLLCPP LinkCreatPropList : public PropList {
// Copy constructor: same as the original LinkCreatPropList.
LinkCreatPropList(const LinkCreatPropList& original);
- // Creates a copy of an existing file access property list
+ // Creates a copy of an existing link creation property list
// using the property list id.
LinkCreatPropList (const hid_t plist_id);
+ // Specifies in property list whether to create missing
+ // intermediate groups
+ void setCreateIntermediateGroup(bool crt_intmd_group) const;
+
+ // Determines whether property is set to enable creating missing
+ // intermediate groups
+ bool getCreateIntermediateGroup() const;
+
// Sets the character encoding of the string.
void setCharEncoding(H5T_cset_t encoding) const;
diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp
index 2c49016..2641960 100644
--- a/c++/src/H5Location.cpp
+++ b/c++/src/H5Location.cpp
@@ -1066,7 +1066,7 @@ void H5Location::link(const char *curr_name, const Group& new_loc,
hid_t lcpl_id = lcpl.getId();
hid_t lapl_id = lapl.getId();
- ret_value = H5Lcreate_hard(getId(), curr_name, new_loc.getId(), new_name, H5P_DEFAULT, H5P_DEFAULT);
+ ret_value = H5Lcreate_hard(getId(), curr_name, new_loc_id, new_name, lcpl_id, lapl_id);
if (ret_value < 0)
throwException("link", "creating link failed");
}
@@ -1102,14 +1102,13 @@ void H5Location::link(const H5std_string& curr_name, const Group& new_loc,
/// H5Lcreate_hard APIs in the HDF5 C Reference Manual.
// March 2018
//--------------------------------------------------------------------------
-void H5Location::link(const char *curr_name, const hid_t same_loc,
- const char *new_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+void H5Location::link(const char *curr_name, const hid_t same_loc, const char *new_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
{
herr_t ret_value = -1;
hid_t lcpl_id = lcpl.getId();
hid_t lapl_id = lapl.getId();
- ret_value = H5Lcreate_hard(getId(), curr_name, same_loc, new_name, H5P_DEFAULT, H5P_DEFAULT);
+ ret_value = H5Lcreate_hard(getId(), curr_name, same_loc, new_name, lcpl_id, lapl_id);
if (ret_value < 0)
throwException("link", "creating link failed");
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp
index 1c22efe..8d3334b 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -40,9 +40,8 @@
namespace H5 {
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-// userAttrOpWrpr simply interfaces between the user's function and the
-// C library function H5Aiterate2; used to resolve the different prototype
-// problem. May be moved to Iterator later.
+// userAttrOpWrpr interfaces between the user's function and the
+// C library function H5Aiterate2
extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name,
const H5A_info_t *ainfo, void *op_data)
{
@@ -52,6 +51,17 @@ extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name,
return 0;
}
+// userVisitOpWrpr interfaces between the user's function and the
+// C library function H5Ovisit2
+extern "C" herr_t userVisitOpWrpr(hid_t obj_id, const char *attr_name,
+ const H5O_info_t *obj_info, void *op_data)
+{
+ H5std_string s_attr_name = H5std_string(attr_name);
+ UserData4Visit* myData = reinterpret_cast<UserData4Visit *> (op_data);
+ int status = myData->op(*myData->obj, s_attr_name, obj_info, myData->opData);
+ return status;
+}
+
//--------------------------------------------------------------------------
// Function: H5Object default constructor (protected)
// Programmer Binh-Minh Ribler - 2000
@@ -197,8 +207,6 @@ Attribute H5Object::openAttribute(const unsigned int idx) const
///\par Description
/// The signature of user_op is
/// void (*)(H5::H5Location&, H5std_string, void*).
-/// For information, please refer to the H5Aiterate2 API in
-/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
int H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_data)
@@ -228,6 +236,61 @@ int H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_dat
}
//--------------------------------------------------------------------------
+// Function: H5Object::visit
+///\brief Recursively visits all HDF5 objects accessible from this object.
+///\param idx_type - IN: Type of index; valid values include:
+/// \li \c H5_INDEX_NAME
+/// \li \c H5_INDEX_CRT_ORDER
+///\param order - IN: Order in which index is traversed; valid values include:
+/// \li \c H5_ITER_DEC
+/// \li \c H5_ITER_INC
+/// \li \c H5_ITER_NATIVE
+///\param user_op - IN: Callback function passing data regarding the
+/// object to the calling application
+///\param *op_data - IN: User-defined pointer to data required by the
+/// application for its processing of the object
+///\param fields - IN: Flags specifying the fields to be retrieved
+/// to the callback op via the H5O_info_t argument.
+/// \li \c H5O_INFO_BASIC fileno, addr, type, and rc fields
+/// \li \c H5O_INFO_TIME atime, mtime, ctime, and btime fields
+/// \li \c H5O_INFO_NUM_ATTRS num_attrs field
+/// \li \c H5O_INFO_HDR hdr field
+/// \li \c H5O_INFO_META_SIZE meta_size field
+/// \li \c H5O_INFO_ALL H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS | H5O_INFO_HDR | H5O_INFO_META_SIZE
+///\return
+/// \li On success:
+/// \li the return value of the first operator that returns a positive value
+/// \li zero if all members were processed with no operator returning non-zero
+/// \li On failure:
+/// \li an exception Exception will be thrown if something went
+/// wrong within the library or the operator failed
+///\exception H5::Exception
+///\par Description
+/// For information, please refer to the H5Ovisit2 API in the HDF5
+/// C Reference Manual.
+// Programmer Binh-Minh Ribler - Feb, 2019
+//--------------------------------------------------------------------------
+void H5Object::visit(H5_index_t idx_type, H5_iter_order_t order, visit_operator_t user_op, void *op_data, unsigned int fields)
+{
+ // Store the user's function and data
+ UserData4Visit* userData = new UserData4Visit;
+ userData->opData = op_data;
+ userData->op = user_op;
+ userData->obj = this;
+
+ // Call the C API passing in op wrapper and info
+ herr_t ret_value = H5Ovisit2(getId(), idx_type, order, userVisitOpWrpr, static_cast<void *>(userData), fields);
+
+ // Release memory
+ delete userData;
+
+ // Throw exception if H5Ovisit2 failed, which could be a failure in
+ // the library or in the call back operator
+ if (ret_value < 0)
+ throw Exception(inMemFunc("visit"), "H5Ovisit2 failed");
+}
+
+//--------------------------------------------------------------------------
// Function: H5Object::objVersion
///\brief Returns the header version of this HDF5 object.
///\return Object version, which can have the following values:
diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h
index 10b3865..4a4e909 100644
--- a/c++/src/H5Object.h
+++ b/c++/src/H5Object.h
@@ -40,16 +40,30 @@ namespace H5 {
// Inheritance: H5Location -> IdComponent
// Define the operator function pointer for H5Aiterate().
-typedef void (*attr_operator_t)(H5Object& loc/*in*/,
- const H5std_string attr_name/*in*/,
- void *operator_data/*in,out*/);
+typedef void (*attr_operator_t)(H5Object& loc,
+ const H5std_string attr_name,
+ void *operator_data);
+
+// Define the operator function pointer for H5Ovisit2().
+typedef int (*visit_operator_t)(H5Object& obj,
+ const H5std_string attr_name,
+ const H5O_info_t *oinfo,
+ void *operator_data);
// User data for attribute iteration
class UserData4Aiterate {
public:
attr_operator_t op;
void* opData;
- H5Object* location;
+ H5Object* location; // Consider changing to H5Location
+};
+
+// User data for visit iteration
+class UserData4Visit {
+ public:
+ visit_operator_t op;
+ void* opData;
+ H5Object* obj;
};
class H5_DLLCPP H5Object : public H5Location {
@@ -71,6 +85,9 @@ class H5_DLLCPP H5Object : public H5Location {
// Iterate user's function over the attributes of this object.
int iterateAttrs(attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL);
+ // Recursively visit elements reachable from this object.
+ void visit(H5_index_t idx_type, H5_iter_order_t order, visit_operator_t user_op, void *op_data, unsigned int fields);
+
// Returns the object header version of an object
unsigned objVersion() const;
@@ -98,6 +115,7 @@ class H5_DLLCPP H5Object : public H5Location {
ssize_t getObjName(H5std_string& obj_name, size_t len = 0) const;
H5std_string getObjName() const;
+
#ifndef DOXYGEN_SHOULD_SKIP_THIS
protected:
diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp
index 1918d27..a01878c 100644
--- a/c++/src/H5PropList.cpp
+++ b/c++/src/H5PropList.cpp
@@ -149,8 +149,8 @@ PropList::PropList(const hid_t plist_id) : IdComponent()
case H5I_DATASPACE:
case H5I_DATASET:
case H5I_ATTR:
- case H5I_REFERENCE:
case H5I_VFL:
+ case H5I_VOL:
case H5I_ERROR_CLASS:
case H5I_ERROR_MSG:
case H5I_ERROR_STACK:
diff --git a/c++/src/cpp_doc_config b/c++/src/cpp_doc_config
index c771e8b..71db7f6 100644
--- a/c++/src/cpp_doc_config
+++ b/c++/src/cpp_doc_config
@@ -38,7 +38,7 @@ PROJECT_NAME =
# could be handy for archiving the generated documentation or if some version
# control system is used.
-PROJECT_NUMBER = "1.11.3"
+PROJECT_NUMBER = "1.13.0"
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a