diff options
Diffstat (limited to 'c++/src')
-rw-r--r-- | c++/src/H5File.cpp | 49 | ||||
-rw-r--r-- | c++/src/H5File.h | 4 | ||||
-rw-r--r-- | c++/src/H5IdComponent.cpp | 2 | ||||
-rw-r--r-- | c++/src/H5PropList.cpp | 1 | ||||
-rw-r--r-- | c++/src/Makefile.am | 10 | ||||
-rw-r--r-- | c++/src/cpp_doc_config | 2 |
6 files changed, 58 insertions, 10 deletions
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index 07d7e84..719c1ba 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 diff --git a/c++/src/H5File.h b/c++/src/H5File.h index 473428a..332685e 100644 --- a/c++/src/H5File.h +++ b/c++/src/H5File.h @@ -73,6 +73,10 @@ class H5_DLLCPP H5File : public Group { 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..20a0a99 100644 --- a/c++/src/H5IdComponent.cpp +++ b/c++/src/H5IdComponent.cpp @@ -176,6 +176,7 @@ H5I_type_t IdComponent::getHDFObjType() const /// \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 @@ -229,6 +230,7 @@ bool IdComponent::isValid(hid_t an_id) /// \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/H5PropList.cpp b/c++/src/H5PropList.cpp index 1918d27..99f722c 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -151,6 +151,7 @@ PropList::PropList(const hid_t plist_id) : IdComponent() 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/Makefile.am b/c++/src/Makefile.am index 949325a..eb50209 100644 --- a/c++/src/Makefile.am +++ b/c++/src/Makefile.am @@ -32,15 +32,15 @@ bin_SCRIPTS=h5c++ # Source files for the library libhdf5_cpp_la_SOURCES=H5Exception.cpp H5IdComponent.cpp \ - H5DataSpace.cpp H5PropList.cpp H5Library.cpp \ - H5FaccProp.cpp H5FcreatProp.cpp H5LcreatProp.cpp \ - H5LaccProp.cpp H5DaccProp.cpp H5DxferProp.cpp \ + H5DataSpace.cpp H5PropList.cpp H5Library.cpp \ + H5FaccProp.cpp H5FcreatProp.cpp H5LcreatProp.cpp \ + H5LaccProp.cpp H5DaccProp.cpp H5DxferProp.cpp \ H5DcreatProp.cpp H5Location.cpp H5AbstractDs.cpp \ H5Attribute.cpp H5Object.cpp H5OcreatProp.cpp \ - H5DataType.cpp H5AtomType.cpp H5PredType.cpp \ + H5DataType.cpp H5AtomType.cpp H5PredType.cpp \ H5EnumType.cpp H5IntType.cpp H5FloatType.cpp \ H5StrType.cpp H5ArrayType.cpp H5VarLenType.cpp \ - H5CompType.cpp H5DataSet.cpp H5CommonFG.cpp H5Group.cpp \ + H5CompType.cpp H5DataSet.cpp H5CommonFG.cpp H5Group.cpp \ H5File.cpp # HDF5 C++ library depends on HDF5 Library. diff --git a/c++/src/cpp_doc_config b/c++/src/cpp_doc_config index 037d4cb..697fb77 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.2" +PROJECT_NUMBER = "1.11.4" # 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 |