summaryrefslogtreecommitdiffstats
path: root/c++/src/H5File.cpp
diff options
context:
space:
mode:
authorbmribler <39579120+bmribler@users.noreply.github.com>2022-08-12 18:33:30 (GMT)
committerGitHub <noreply@github.com>2022-08-12 18:33:30 (GMT)
commit10e4dd4ef135ea39b0237ccd2ce2391f14340498 (patch)
tree2dc297fdaec600dc7e960d2ca10185ca1347153d /c++/src/H5File.cpp
parent25ef5340396a786fe63072a9f057cd550c86668b (diff)
downloadhdf5-10e4dd4ef135ea39b0237ccd2ce2391f14340498.zip
hdf5-10e4dd4ef135ea39b0237ccd2ce2391f14340498.tar.gz
hdf5-10e4dd4ef135ea39b0237ccd2ce2391f14340498.tar.bz2
Fix c++ test failure (#2005)
* Fix test failure Description: - Added two H5File constructors to open file with non-default fapl - Added non-default fapl to test functions - Commented certain renaming attribute tests because of the unexpected behavior in renaming an attribute (HDFFV-11327) Platform tested: Linux/64 (jelly) * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'c++/src/H5File.cpp')
-rw-r--r--c++/src/H5File.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp
index 92a8d59..6e85015 100644
--- a/c++/src/H5File.cpp
+++ b/c++/src/H5File.cpp
@@ -119,6 +119,53 @@ H5File::H5File(const H5std_string &name, unsigned int flags, const FileCreatProp
}
}
+//--------------------------------------------------------------------------
+// Function: H5File overloaded constructor
+///\brief Opens an HDF5 file using a non-default access property list
+///\param name - IN: Name of the file
+///\param flags - IN: File access flags
+///\param access_plist - IN: File access property list. Default to
+/// FileAccPropList::DEFAULT
+///\par Description
+/// Valid values of \a flags include:
+/// \li \c H5F_ACC_RDONLY - Open file as read-only, if it already
+/// exists, and fail, otherwise
+/// \li \c H5F_ACC_RDWR - Open file for read/write, if it already
+/// exists, and fail, otherwise
+// Notes With a PGI compiler (~2012-2013,) the exception thrown by
+// p_get_file could not be caught in the applications. Added try
+// block here to catch then re-throw it. -BMR 2013/03/21
+//--------------------------------------------------------------------------
+H5File::H5File(const char *name, unsigned int flags, const FileAccPropList &access_plist)
+ : Group(), id(H5I_INVALID_HID)
+{
+ try {
+ p_get_file(name, flags, FileCreatPropList::DEFAULT, access_plist);
+ }
+ catch (FileIException &open_file) {
+ throw open_file;
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: H5File overloaded constructor
+///\brief This is another overloaded constructor. It differs from the
+/// above constructor only in the type of the \a name argument.
+///\param name - IN: Name of the file - \c H5std_string
+///\param flags - IN: File access flags
+///\param access_plist - IN: File access property list
+//--------------------------------------------------------------------------
+H5File::H5File(const H5std_string &name, unsigned int flags, const FileAccPropList &access_plist)
+ : Group(), id(H5I_INVALID_HID)
+{
+ try {
+ p_get_file(name.c_str(), flags, FileCreatPropList::DEFAULT, access_plist);
+ }
+ catch (FileIException &open_file) {
+ throw open_file;
+ }
+}
+
#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
// This function is private and contains common code between the