diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2005-08-08 03:53:58 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2005-08-08 03:53:58 (GMT) |
commit | 07592ad7c32fe5ed0b947a7a6a4ee3aef58173ab (patch) | |
tree | a9439aefae26c6a9897e1190095079e32e891fb5 /c++/src/H5File.cpp | |
parent | e49bb1feeaa3e2c18a2bd38ff5a5ef3142b5f9b1 (diff) | |
download | hdf5-07592ad7c32fe5ed0b947a7a6a4ee3aef58173ab.zip hdf5-07592ad7c32fe5ed0b947a7a6a4ee3aef58173ab.tar.gz hdf5-07592ad7c32fe5ed0b947a7a6a4ee3aef58173ab.tar.bz2 |
[svn-r11206] Purpose: Additional wrapper/Code improvement
Description:
Added wrapper for H5Iget_type.
Added try/catch to many APIs that call private functions so that more
specific information can be provided at failure.
Added IdComponent::inMemFunc to help providing specific info.
Added const to parameters of several functions that missed that.
Platforms tested:
Linux 2.4 (heping)
SunOS 5.8 64-bit (sol)
AIX 5.1 (copper)
IRIX64 with -n32 (modi4)
HPUX 11.00 (kelgia)
Diffstat (limited to 'c++/src/H5File.cpp')
-rw-r--r-- | c++/src/H5File.cpp | 50 |
1 files changed, 44 insertions, 6 deletions
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index 985fc72..361d448 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -427,7 +427,12 @@ void H5File::getVFDHandle(void **file_handle) const //-------------------------------------------------------------------------- string H5File::getFileName() const { - return(p_get_file_name()); + try { + return(p_get_file_name()); + } + catch (IdComponentException E) { + throw FileIException("H5File::getFileName", E.getDetailMsg()); + } } //-------------------------------------------------------------------------- @@ -444,7 +449,12 @@ string H5File::getFileName() const //-------------------------------------------------------------------------- void* H5File::Reference(const char* name, DataSpace& dataspace, H5R_type_t ref_type) const { - return(p_reference(name, dataspace.getId(), ref_type)); + try { + return(p_reference(name, dataspace.getId(), ref_type)); + } + catch (IdComponentException E) { + throw FileIException("H5File::Reference", E.getDetailMsg()); + } } //-------------------------------------------------------------------------- @@ -466,7 +476,25 @@ void* H5File::Reference(const char* name, DataSpace& dataspace, H5R_type_t ref_t //-------------------------------------------------------------------------- void* H5File::Reference(const char* name) const { - return(p_reference(name, -1, H5R_OBJECT)); + try { + return(p_reference(name, -1, H5R_OBJECT)); + } + catch (IdComponentException E) { + throw FileIException("H5File::Reference", E.getDetailMsg()); + } +} + +//-------------------------------------------------------------------------- +// Function: H5File::Reference +///\brief This is an overloaded function, provided for your convenience. +/// It differs from the above function in that it takes an +/// \c std::string for the object's name. +///\param name - IN: Name of the object to be referenced - \c std::string +// Programmer Binh-Minh Ribler - May, 2004 +//-------------------------------------------------------------------------- +void* H5File::Reference(const string& name) const +{ + return(Reference(name.c_str())); } //-------------------------------------------------------------------------- @@ -484,7 +512,12 @@ void* H5File::Reference(const char* name) const //-------------------------------------------------------------------------- H5G_obj_t H5File::getObjType(void *ref, H5R_type_t ref_type) const { - return(p_get_obj_type(ref, ref_type)); + try { + return(p_get_obj_type(ref, ref_type)); + } + catch (IdComponentException E) { + throw FileIException("H5File::getObjType", E.getDetailMsg()); + } } //-------------------------------------------------------------------------- @@ -498,8 +531,13 @@ H5G_obj_t H5File::getObjType(void *ref, H5R_type_t ref_type) const //-------------------------------------------------------------------------- DataSpace H5File::getRegion(void *ref, H5R_type_t ref_type) const { - DataSpace dataspace(p_get_region(ref, ref_type)); - return(dataspace); + try { + DataSpace dataspace(p_get_region(ref, ref_type)); + return(dataspace); + } + catch (IdComponentException E) { + throw FileIException("H5File::getRegion", E.getDetailMsg()); + } } //-------------------------------------------------------------------------- |