diff options
Diffstat (limited to 'c++/src/H5DataSet.cpp')
-rw-r--r-- | c++/src/H5DataSet.cpp | 58 |
1 files changed, 46 insertions, 12 deletions
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index 765b1e5..7ab5179 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -349,7 +349,8 @@ int DataSet::iterateElems( void* buf, const DataType& type, const DataSpace& spa ///\par Description /// For more information, please see the Description section in /// C layer Reference Manual at: -/// http: +///\par +/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5D.html#Dataset-Extend // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSet::extend( const hsize_t* size ) const @@ -413,12 +414,17 @@ void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space) ///\param dataspace - IN: Dataspace with selection ///\param ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION ///\return A reference -///\exception H5::IdComponentException +///\exception H5::DataSetIException // Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void* DataSet::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 DataSetIException("DataSet::Reference", E.getDetailMsg()); + } } //-------------------------------------------------------------------------- @@ -428,7 +434,7 @@ void* DataSet::Reference(const char* name, DataSpace& dataspace, H5R_type_t ref_ /// a reference to an HDF5 object, not to a dataset region. ///\param name - IN: Name of the object to be referenced ///\return A reference -///\exception H5::IdComponentException +///\exception H5::DataSetIException ///\par Description // This function passes H5R_OBJECT and -1 to the protected // function for it to pass to the C API H5Rcreate @@ -437,7 +443,25 @@ void* DataSet::Reference(const char* name, DataSpace& dataspace, H5R_type_t ref_ //-------------------------------------------------------------------------- void* DataSet::Reference(const char* name) const { - return(p_reference(name, -1, H5R_OBJECT)); + try { + return(p_reference(name, -1, H5R_OBJECT)); + } + catch (IdComponentException E) { + throw DataSetIException("DataSet::Reference", E.getDetailMsg()); + } +} + +//-------------------------------------------------------------------------- +// Function: DataSet::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* DataSet::Reference(const string& name) const +{ + return(Reference(name.c_str())); } //-------------------------------------------------------------------------- @@ -445,17 +469,22 @@ void* DataSet::Reference(const char* name) const ///\brief Retrieves the type of object that an object reference points to. ///\param ref_type - IN: Type of reference to query ///\param ref - IN: Reference to query -// Return An object type, which can be one of the following: +///\return An object type, which can be one of the following: // H5G_LINK Object is a symbolic link. // H5G_GROUP Object is a group. // H5G_DATASET Object is a dataset. // H5G_TYPE Object is a named datatype -// Exception H5::IdComponentException +///\exception H5::DataSetIException // Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- H5G_obj_t DataSet::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 DataSetIException("DataSet::getObjType", E.getDetailMsg()); + } } //-------------------------------------------------------------------------- @@ -465,13 +494,18 @@ H5G_obj_t DataSet::getObjType(void *ref, H5R_type_t ref_type) const /// to H5R_DATASET_REGION ///\param ref - IN: Reference to get region of ///\return DataSpace instance -///\exception H5::IdComponentException +///\exception H5::DataSetIException // Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- DataSpace DataSet::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 DataSetIException("DataSet::getRegion", E.getDetailMsg()); + } } //-------------------------------------------------------------------------- @@ -488,7 +522,7 @@ void DataSet::close() { throw DataSetIException("DataSet::close", "H5Dclose failed"); } - // reset the id because the group that it represents is now closed + // reset the id because the dataset that it represents is now closed id = 0; } |