From e25b9b5f7002b7a19000fc8d81cf4a96776cd671 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Thu, 29 Dec 2005 06:41:02 -0500 Subject: [svn-r11845] Purpose: Adding another wrapper/Fixing typos Description: Added missing member function H5File::flush Fixed parameters passed to H5Awrite Other typos Platforms tested: Linux 2.4 (heping) SunOS 5.8 64-bit (sol) --- c++/src/H5Attribute.cpp | 4 ++-- c++/src/H5File.cpp | 21 ++++++++++++++++++++- c++/src/H5File.h | 3 +++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index e8573c3..89d72a8 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -102,7 +102,7 @@ void Attribute::write( const DataType& mem_type, const string& strg ) const const char* strg_C; strg_C = strg.c_str(); // strg_C refers to the contents of strg as a C-str - herr_t ret_value = H5Awrite( id, mem_type.getId(), strg_C ); + herr_t ret_value = H5Awrite( id, mem_type.getId(), &strg_C ); if( ret_value < 0 ) { throw AttributeIException("Attribute::write", "H5Awrite failed"); @@ -139,7 +139,7 @@ void Attribute::read( const DataType& mem_type, string& strg ) const { size_t size = mem_type.getSize(); char* strg_C = new char[size+1]; // temporary C-string for C API - herr_t ret_value = H5Aread( id, mem_type.getId(), strg_C ); + herr_t ret_value = H5Aread( id, mem_type.getId(), &strg_C ); if( ret_value < 0 ) { throw AttributeIException("Attribute::read", "H5Aread failed"); diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index abcbc6b..b3f1c35 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -148,6 +148,25 @@ void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPro H5File::H5File( const H5File& original ) : IdComponent( original ) {} //-------------------------------------------------------------------------- +// Function: H5File::flush +///\brief Flushes all buffers associated with a file to disk. +///\param scope - IN: Specifies the scope of the flushing action, +/// which can be either of these values: +/// \li \c H5F_SCOPE_GLOBAL - Flushes the entire virtual file +/// \li \c H5F_SCOPE_LOCAL - Flushes only the specified file +///\exception H5::FileIException +// Programmer Binh-Minh Ribler - Dec. 2005 +//-------------------------------------------------------------------------- +void H5File::flush(H5F_scope_t scope) const +{ + herr_t ret_value = H5Fflush( id, scope ); + if( ret_value < 0 ) + { + throw FileIException("H5File::flush", "H5Fflush failed"); + } +} + +//-------------------------------------------------------------------------- // Function: H5File::isHdf5 ///\brief Determines whether a file in HDF5 format. ///\param name - IN: Name of the file @@ -155,7 +174,7 @@ H5File::H5File( const H5File& original ) : IdComponent( original ) {} ///\exception H5::FileIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -bool H5File::isHdf5(const char* name ) +bool H5File::isHdf5(const char* name) { // Calls C routine H5Fis_hdf5 to determine whether the file is in // HDF5 format. It returns positive value, 0, or negative value diff --git a/c++/src/H5File.h b/c++/src/H5File.h index 7e73ef3..84947fd 100644 --- a/c++/src/H5File.h +++ b/c++/src/H5File.h @@ -39,6 +39,9 @@ class H5_DLLCPP H5File : public IdComponent, public CommonFG { // Close this file. virtual void close(); + // Flushes all buffers associated with this file to disk + void flush(H5F_scope_t scope) const; + // Gets the access property list of this file. FileAccPropList getAccessPlist() const; -- cgit v0.12