summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--c++/src/H5File.cpp18
-rw-r--r--c++/src/H5File.h3
2 files changed, 21 insertions, 0 deletions
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp
index 3a28543..3f3b714 100644
--- a/c++/src/H5File.cpp
+++ b/c++/src/H5File.cpp
@@ -468,6 +468,7 @@ DataSpace H5File::getRegion(void *ref, H5R_type_t ref_type) const
DataSpace dataspace(p_get_region(ref, ref_type));
return(dataspace);
}
+
//--------------------------------------------------------------------------
// Function: H5File::getLocId
// Purpose: Get the id of this file
@@ -482,6 +483,23 @@ hid_t H5File::getLocId() const
}
//--------------------------------------------------------------------------
+// Function: H5File::getFileSize
+///\brief 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.
+///\exception H5::FileIException
+// Programmer Raymond Lu - June 24, 2004
+//--------------------------------------------------------------------------
+haddr_t H5File::getFileSize(void) const
+{
+ haddr_t ret_value = H5Fget_filesize(id);
+ if( ret_value < 0 )
+ {
+ throw FileIException("H5File::getFileSize", "H5Fget_filesize failed");
+ }
+}
+
+//--------------------------------------------------------------------------
// Function: H5File::p_close (private)
///\brief Closes this H5 file.
///\exception H5::FileIException
diff --git a/c++/src/H5File.h b/c++/src/H5File.h
index b3edbb6..e19f3f8 100644
--- a/c++/src/H5File.h
+++ b/c++/src/H5File.h
@@ -72,6 +72,9 @@ class H5_DLLCPP H5File : public IdComponent, public CommonFG {
// Retrieves a dataspace with the region pointed to selected.
DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const;
+ // Retrieves the file size of an opened file.
+ haddr_t getFileSize() const;
+
// Reopens this file
void reopen();