summaryrefslogtreecommitdiffstats
path: root/c++
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2004-06-25 15:15:27 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2004-06-25 15:15:27 (GMT)
commitc95b683457c1b47f7095e7a9804db7ce84f8e39b (patch)
tree065175aae97d2665622f8709ea0a4607b4ebeb1e /c++
parentcdf28fd58f704aa0166db26fdf1c03e2bb60ce5e (diff)
downloadhdf5-c95b683457c1b47f7095e7a9804db7ce84f8e39b.zip
hdf5-c95b683457c1b47f7095e7a9804db7ce84f8e39b.tar.gz
hdf5-c95b683457c1b47f7095e7a9804db7ce84f8e39b.tar.bz2
[svn-r8742] Purpose: New feature and bug fix.
Description: 1. A new API function H5Fget_filesize was added to return the actual size of an opened file. 2. In H5Gpublic.h, object types are defined as integers in v1.4 instead of H5G_obj_t in v1.6. In titerate.c, H5G_obj_t couldn't be recognized if compatibility with v1.4 is enabled. Solution: 1. Call H5FDget_eof to return file size in H5Fget_filesize. 2. When compatibility with v1.4 is enabled, define variable as integer instead of H5G_obj_t. Platforms tested: h5committest. Misc. update: RELEASE.txt
Diffstat (limited to 'c++')
-rw-r--r--c++/src/H5File.cpp13
-rw-r--r--c++/src/H5File.h3
2 files changed, 16 insertions, 0 deletions
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp
index e85700c..8bfd676 100644
--- a/c++/src/H5File.cpp
+++ b/c++/src/H5File.cpp
@@ -171,6 +171,19 @@ FileAccPropList H5File::getAccessPlist() const
}
}
+// Retrieves the file size of the HDF5 file. This function
+// is called after an existing file is opened in order
+// to learn the true size of the underlying file.
+// (Raymond Lu)
+haddr_t H5File::getFileSize(void) const
+{
+ haddr_t ret_value = H5Fget_filesize(id);
+ if( ret_value < 0 )
+ {
+ throw FileIException("H5File::getFileSize", "H5Fget_filesize failed");
+ }
+}
+
// Calls the C API H5Fclose to close this file. Used by IdComponent::reset
void H5File::p_close() const
{
diff --git a/c++/src/H5File.h b/c++/src/H5File.h
index 2e088ad..82615df 100644
--- a/c++/src/H5File.h
+++ b/c++/src/H5File.h
@@ -50,6 +50,9 @@ class H5_DLLCPP H5File : public IdComponent, public CommonFG {
// Reopens this file
void reopen();
+ // Retrieves the file size of an opened file.
+ haddr_t getFileSize() const;
+
// Gets the creation property list of this file
FileCreatPropList getCreatePlist() const;