diff options
Diffstat (limited to 'c++')
-rw-r--r-- | c++/examples/run-c++-ex.sh.in | 2 | ||||
-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 | ||||
-rw-r--r-- | c++/test/tattr.cpp | 8 | ||||
-rw-r--r-- | c++/test/tlinks.cpp | 5 |
9 files changed, 63 insertions, 20 deletions
diff --git a/c++/examples/run-c++-ex.sh.in b/c++/examples/run-c++-ex.sh.in index f0d3e93..d975924 100644 --- a/c++/examples/run-c++-ex.sh.in +++ b/c++/examples/run-c++-ex.sh.in @@ -32,7 +32,7 @@ EXIT_FAILURE=1 # Where the tool is installed. # default is relative path to installed location of the tools -prefix="${prefix:-@prefix@}" +prefix="${prefix:-../../..}" AR="@AR@" RANLIB="@RANLIB@" H5TOOL="h5c++" # The tool name 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 diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index bdf6d80..4734755 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -1712,7 +1712,7 @@ static void test_attr_dense_create(FileCreatPropList& fcpl, // Close property list dcpl.close(); - // H5O_is_attr_dense_test - un-usable + // H5O__is_attr_dense_test - un-usable // Add attributes, until just before converting to dense storage char attr_name[NAME_BUF_SIZE]; @@ -1727,7 +1727,7 @@ static void test_attr_dense_create(FileCreatPropList& fcpl, attr.write(PredType::NATIVE_UINT, &attr_num); } // end for - // H5O_is_attr_dense_test - un-usable + // H5O__is_attr_dense_test - un-usable { // Add one more attribute, to push into "dense" storage @@ -1815,8 +1815,8 @@ static void test_attr_corder_create_basic(FileCreatPropList& fcpl, ds_space.close(); // Check on dataset's attribute storage status. - // NOTE: Wrappers not available yet (H5O_is_attr_empty_test - // and H5O_is_attr_dense_test) + // NOTE: Wrappers not available yet (H5O__is_attr_empty_test + // and H5O__is_attr_dense_test) // Close dataset dataset.close(); diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index f8d7089..6e990c9 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -857,11 +857,6 @@ void test_links() { hid_t fapl_id, fapl2_id; /* File access property lists */ unsigned new_format; /* Whether to use the new format or not */ - const char *envval; - - envval = HDgetenv("HDF5_DRIVER"); - if(envval == NULL) - envval = "nomatch"; fapl_id = h5_fileaccess(); |