diff options
Diffstat (limited to 'c++/src')
-rw-r--r-- | c++/src/H5AbstractDs.cpp | 5 | ||||
-rw-r--r-- | c++/src/H5AbstractDs.h | 4 | ||||
-rw-r--r-- | c++/src/H5Attribute.cpp | 25 | ||||
-rw-r--r-- | c++/src/H5Attribute.h | 4 | ||||
-rw-r--r-- | c++/src/H5File.cpp | 26 |
5 files changed, 51 insertions, 13 deletions
diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp index 9cf1ee8..e6cacf9 100644 --- a/c++/src/H5AbstractDs.cpp +++ b/c++/src/H5AbstractDs.cpp @@ -25,11 +25,6 @@ #include "H5CommonFG.h" #include "H5Alltypes.h" -#include <iostream> // remove when done - - using std::cerr; - using std::endl; - #ifndef H5_NO_NAMESPACE namespace H5 { #endif diff --git a/c++/src/H5AbstractDs.h b/c++/src/H5AbstractDs.h index 1d04d6c..c5ffa36 100644 --- a/c++/src/H5AbstractDs.h +++ b/c++/src/H5AbstractDs.h @@ -65,7 +65,7 @@ class H5_DLLCPP AbstractDs { // dataset - pure virtual. virtual hsize_t getStorageSize() const = 0; - // Returns this class name + // Returns this class name - pure virtual. virtual H5std_string fromClass() const = 0; // Copy constructor @@ -82,7 +82,7 @@ class H5_DLLCPP AbstractDs { AbstractDs( const hid_t ds_id ); private: - // This member function is implemented by DataSet and Attribute. + // This member function is implemented by DataSet and Attribute - pure virtual. virtual hid_t p_get_type() const = 0; }; #ifndef H5_NO_NAMESPACE diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index 226ae5c..6c14269 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -385,6 +385,31 @@ hsize_t Attribute::getStorageSize() const } //-------------------------------------------------------------------------- +// Function: Attribute::flush +///\brief Flushes all buffers associated with a file specified by +/// this attribute, 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::AttributeIException +///\par Description +/// This attribute is used to identify the file to be flushed. +// Programmer Binh-Minh Ribler - 2013 +// Modification +// Mar 2013 - BMR +// Duplicated from H5Location +//-------------------------------------------------------------------------- +void Attribute::flush(H5F_scope_t scope) const +{ + herr_t ret_value = H5Fflush(getId(), scope); + if( ret_value < 0 ) + { + throw AttributeIException("Attribute::flush", "H5Fflush failed"); + } +} + +//-------------------------------------------------------------------------- // Function: Attribute::getId // Purpose: Get the id of this attribute // Description: diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h index f392f1a..cafc264 100644 --- a/c++/src/H5Attribute.h +++ b/c++/src/H5Attribute.h @@ -51,6 +51,10 @@ class H5_DLLCPP Attribute : public AbstractDs, public IdComponent { void write(const DataType& mem_type, const void *buf ) const; void write(const DataType& mem_type, const H5std_string& strg ) const; + // Flushes all buffers associated with the file specified by this + // attribute to disk. + void flush( H5F_scope_t scope ) const; + ///\brief Returns this class name virtual H5std_string fromClass () const { return("Attribute"); } diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index da0241f..6e85428 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -61,7 +61,7 @@ H5File::H5File() : IdComponent(), id(0) {} /// modifying default file meta-data. Default to /// FileCreatPropList::DEFAULT ///\param access_plist - IN: File access property list. Default to -/// FileCreatPropList::DEFAULT +/// FileAccPropList::DEFAULT ///\par Description /// Valid values of \a flags include: /// \li \c H5F_ACC_TRUNC - Truncate file, if it already exists, @@ -77,11 +77,18 @@ H5File::H5File() : IdComponent(), id(0) {} /// please refer to the \b Special \b case section in the C layer /// Reference Manual at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-Create +// Notes With a PGI compiler (~2012-2013), the exception thrown by p_get_file +// could not be caught in the applications. Added try block here +// to catch then re-throw it. -BMR 2013/03/21 // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : IdComponent(0) { - p_get_file(name, flags, create_plist, access_plist); + try { + p_get_file(name, flags, create_plist, access_plist); + } catch (FileIException open_file) { + throw open_file; + } } //-------------------------------------------------------------------------- @@ -94,12 +101,19 @@ H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& c /// modifying default file meta-data. Default to /// FileCreatPropList::DEFAULT ///\param access_plist - IN: File access property list. Default to -/// FileCreatPropList::DEFAULT +/// FileAccPropList::DEFAULT +// Notes With a PGI compiler (~2012-2013), the exception thrown by p_get_file +// could not be caught in the applications. Added try block here +// to catch then re-throw it. -BMR 2013/03/21 // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : IdComponent(0) { - p_get_file(name.c_str(), flags, create_plist, access_plist); + try { + p_get_file(name.c_str(), flags, create_plist, access_plist); + } catch (FileIException open_file) { + throw open_file; + } } //-------------------------------------------------------------------------- @@ -166,7 +180,7 @@ void H5File::flush(H5F_scope_t scope) const } //-------------------------------------------------------------------------- -// Function: H5File::isHdf5 +// Function: H5File::isHdf5 (static) ///\brief Determines whether a file in HDF5 format. ///\param name - IN: Name of the file ///\return true if the file is in HDF5 format, and false, otherwise @@ -189,7 +203,7 @@ bool H5File::isHdf5(const char* name) } //-------------------------------------------------------------------------- -// Function: H5File::isHdf5 +// Function: H5File::isHdf5 (static) ///\brief This is an overloaded member function, provided for convenience. /// It takes an \c H5std_string for \a name. ///\param name - IN: Name of the file - \c H5std_string |