summaryrefslogtreecommitdiffstats
path: root/c++
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2018-10-10 15:10:15 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2018-10-10 15:10:15 (GMT)
commite962df1591bc6eaee5b9e318de83b9c6698bc7b6 (patch)
treede3cb2001c62b76a89837ff1e90044574d71f19d /c++
parent471150151d29eeb806333a8db41fefc9dfb452bb (diff)
downloadhdf5-e962df1591bc6eaee5b9e318de83b9c6698bc7b6.zip
hdf5-e962df1591bc6eaee5b9e318de83b9c6698bc7b6.tar.gz
hdf5-e962df1591bc6eaee5b9e318de83b9c6698bc7b6.tar.bz2
VOL FEATURE
Diffstat (limited to 'c++')
-rw-r--r--c++/src/H5File.cpp49
-rw-r--r--c++/src/H5File.h4
-rw-r--r--c++/src/H5IdComponent.cpp2
-rw-r--r--c++/src/H5PropList.cpp1
4 files changed, 52 insertions, 4 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: