summaryrefslogtreecommitdiffstats
path: root/c++/src/H5File.cpp
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2005-12-05 20:23:12 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2005-12-05 20:23:12 (GMT)
commit11d013f8ccd95d7a5511260fad585ea6a039eac4 (patch)
treeda7c8eff13f9d09d1a96456da8935d346920df66 /c++/src/H5File.cpp
parente969226fc701d06fc3e6e4b312c6bd77395b76d3 (diff)
downloadhdf5-11d013f8ccd95d7a5511260fad585ea6a039eac4.zip
hdf5-11d013f8ccd95d7a5511260fad585ea6a039eac4.tar.gz
hdf5-11d013f8ccd95d7a5511260fad585ea6a039eac4.tar.bz2
[svn-r11762] Purpose: Adding more wrappers
Description: Added member function H5File::openFile and overloaded for convenience. Added overloaded getObjinfo to skip the middle parameter. Changed StrType(const size_t& size); to StrType(const int dummy, const size_t& size); because the first one clashed with StrType(const hid_t existing_id); Platforms tested: Linux 2.4 (heping) SunOS 5.8 64-bit (sol) HPUX 11.00 (kelgia)
Diffstat (limited to 'c++/src/H5File.cpp')
-rw-r--r--c++/src/H5File.cpp45
1 files changed, 44 insertions, 1 deletions
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp
index 50a2fca..abcbc6b 100644
--- a/c++/src/H5File.cpp
+++ b/c++/src/H5File.cpp
@@ -116,7 +116,7 @@ void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPro
{
// These bits only set for creation, so if any of them are set,
// create the file.
- if( flags & (H5F_ACC_EXCL|H5F_ACC_TRUNC|H5F_ACC_DEBUG ))
+ if( flags & (H5F_ACC_CREAT|H5F_ACC_EXCL|H5F_ACC_TRUNC|H5F_ACC_DEBUG))
{
hid_t create_plist_id = create_plist.getId();
hid_t access_plist_id = access_plist.getId();
@@ -183,6 +183,49 @@ bool H5File::isHdf5(const string& name )
}
//--------------------------------------------------------------------------
+// Function: openFile
+///\brief Opens an HDF5 file
+///\param name - IN: Name of the file
+///\param flags - IN: File access flags
+///\param access_plist - IN: File access property list. Default to
+/// FileCreatPropList::DEFAULT
+///\par Description
+/// Valid values of \a flags include:
+/// H5F_ACC_RDWR: Open with read/write access. If the file is
+/// currently open for read-only access then it
+/// will be reopened. Absence of this flag
+/// implies read-only access.
+///
+/// H5F_ACC_RDONLY: Open with read only access. - default
+///
+// Programmer Binh-Minh Ribler - Oct, 2005
+//--------------------------------------------------------------------------
+void H5File::openFile(const char* name, unsigned int flags, const FileAccPropList& access_plist)
+{
+ hid_t access_plist_id = access_plist.getId();
+ id = H5Fopen (name, flags, access_plist_id);
+ if (id < 0) // throw an exception when open fails
+ {
+ throw FileIException("H5File::openFile", "H5Fopen failed");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: H5File::openFile
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes an \c std::string for \a name.
+///\param name - IN: Name of the file - \c std::string
+///\param flags - IN: File access flags
+///\param access_plist - IN: File access property list. Default to
+/// FileAccPropList::DEFAULT
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void H5File::openFile(const string& name, unsigned int flags, const FileAccPropList& access_plist)
+{
+ openFile(name.c_str(), flags, access_plist);
+}
+
+//--------------------------------------------------------------------------
// Function: H5File::reOpen
///\brief Reopens this file.
///