diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2012-10-16 14:53:01 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2012-10-16 14:53:01 (GMT) |
commit | e54b019108172f807a5d4af1915ba0a6cee18a7c (patch) | |
tree | 7ac71b52f1ba039eeee151d2b5a9192c7b9162d3 /c++ | |
parent | f5b20375943c2f0f27390a94e1a8e1c7de98c404 (diff) | |
download | hdf5-e54b019108172f807a5d4af1915ba0a6cee18a7c.zip hdf5-e54b019108172f807a5d4af1915ba0a6cee18a7c.tar.gz hdf5-e54b019108172f807a5d4af1915ba0a6cee18a7c.tar.bz2 |
[svn-r22902] - fix bug in H5is_accessible (check if fapl is default, and convert it to default access plist)
- remove the c++ and fortran interfaces for H5is_hdf5 as it is deprecated
- add the c++ and fortran interfaces for H5is_accessible
- update all tests to use is_accessible and not is_hdf5
Diffstat (limited to 'c++')
-rw-r--r-- | c++/src/H5File.cpp | 27 | ||||
-rw-r--r-- | c++/src/H5File.h | 8 |
2 files changed, 21 insertions, 14 deletions
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index 92c4d32..44186e2 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -147,38 +147,43 @@ H5File::H5File(const H5File& original) : H5Location(original) } //-------------------------------------------------------------------------- -// Function: H5File::isHdf5 -///\brief Determines whether a file in HDF5 format. (Static) +// Function: H5File::isAccessible +///\brief Determines whether a file is accessible by the fapl. (Static) ///\param name - IN: Name of the file -///\return true if the file is in HDF5 format, and false, otherwise +///\param access_plist - IN: File access property list. Default to +/// FileCreatPropList::DEFAULT +///\return true if the file is accessible, and false, otherwise ///\exception H5::FileIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -bool H5File::isHdf5(const char* name) +bool H5File::isAccessible(const char* name, const FileAccPropList& access_plist) { - // 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 ); + 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_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::isAccessible", "H5Fis_accessible returned negative value"); } } //-------------------------------------------------------------------------- -// Function: H5File::isHdf5 +// Function: H5File::isAccessible ///\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 +/// FileCreatPropList::DEFAULT // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -bool H5File::isHdf5(const H5std_string& name ) +bool H5File::isAccessible(const H5std_string& name, const FileAccPropList& access_plist ) { - return( isHdf5( name.c_str()) ); + return( isAccessible(name.c_str(), access_plist) ); } //-------------------------------------------------------------------------- diff --git a/c++/src/H5File.h b/c++/src/H5File.h index cfb6bdf..1601a3a 100644 --- a/c++/src/H5File.h +++ b/c++/src/H5File.h @@ -68,9 +68,11 @@ class H5_DLLCPP H5File : public H5Location, public CommonFG { void getVFDHandle(FileAccPropList& fapl, void **file_handle) const; void getVFDHandle(void **file_handle) 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 with the fapl + 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 |