summaryrefslogtreecommitdiffstats
path: root/c++/src/H5DataSet.cpp
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2013-09-29 04:34:31 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2013-09-29 04:34:31 (GMT)
commit5478de764594d5c30bf8cd53076892f0aa60543c (patch)
tree558d9e524e5f2e84026ebdfeb9960a5b8962c06d /c++/src/H5DataSet.cpp
parent252ed47f9b0333a112a49a5b23a1cc4a5e108b1e (diff)
downloadhdf5-5478de764594d5c30bf8cd53076892f0aa60543c.zip
hdf5-5478de764594d5c30bf8cd53076892f0aa60543c.tar.gz
hdf5-5478de764594d5c30bf8cd53076892f0aa60543c.tar.bz2
[svn-r24216] Purpose: Merged changes from trunk
Description from trunk, r22836 In this bug, H5File doesn't have the ability to create attribute. The following changes will provide that functionality and several others that were also missing: - Added an abstract class H5Location in between IdComponent and H5Object. - New class structure of IdComponent, H5Location, H5Object, H5File IdComponent | H5Location / \ H5Object H5File - Wrappers in H5Object were moved to H5Location because the related C functions take either file, group, dataset, or named datatype ID. - Added wrapper for H5Rget_obj_type2 - Added tests for file attributes and H5Rget_obj_type2 wrapper Description from trunk, r22845 Fixed miscellaneous inconsistencies and typos, which also took care of the failure in Packet Table test on daily test today. Description from trunk, r24143 Fixed comments, documentation, and mis-matched DOXYGEN_SHOULD_SKIP_THIS pairs. Description from trunk, r24188 - The failure in daily test was caused by missing initialization of member "id" in a few constructors. This is now fixed. - Added two overloaded H5Location::setComment - Improved some error reporting in H5Location - Improved error reporting in tests Description from trunk, r24189 Changed header guards from single underscore to double underscore. Platforms tested: SunOS 5.11 (emu) Linux/32 2.6 (jam) Linux/64 2.6 (koala)/PGI compilers
Diffstat (limited to 'c++/src/H5DataSet.cpp')
-rw-r--r--c++/src/H5DataSet.cpp107
1 files changed, 13 insertions, 94 deletions
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index f7aaa72..1a26045 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -79,57 +79,29 @@ DataSet::DataSet(const DataSet& original) : AbstractDs(original), H5Object(origi
//--------------------------------------------------------------------------
// Function: DataSet overload constructor - dereference
-///\brief Given a reference, ref, to an hdf5 dataset, creates a
+///\brief Given a reference, ref, to an hdf5 location, creates a
/// DataSet object
-///\param obj - IN: Dataset reference object is in or location of
+///\param loc - IN: Dataset reference object is in or location of
/// object that the dataset is located within.
///\param ref - IN: Reference pointer
///\param ref_type - IN: Reference type - default to H5R_OBJECT
///\exception H5::DataSetIException
///\par Description
-/// \c obj can be DataSet, Group, H5File, or named DataType, that
+/// \c loc can be DataSet, Group, H5File, or named DataType, that
/// is a datatype that has been named by DataType::commit.
// Programmer Binh-Minh Ribler - Oct, 2006
// Modification
// Jul, 2008
// Added for application convenience.
//--------------------------------------------------------------------------
-DataSet::DataSet(H5Object& obj, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object()
+DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object(), id(0)
{
- try {
- id = p_dereference(obj.getId(), ref, ref_type);
- } catch (ReferenceException deref_error) {
- throw ReferenceException("DataSet constructor - located by object",
- deref_error.getDetailMsg());
- }
+ id = H5Location::p_dereference(loc.getId(), ref, ref_type, "constructor - by dereferenced");
}
//--------------------------------------------------------------------------
// Function: DataSet overload constructor - dereference
-///\brief Given a reference, ref, to an hdf5 dataset, creates a
-/// DataSet object
-///\param h5file - IN: Location referenced object is in
-///\param ref - IN: Reference pointer
-///\param ref_type - IN: Reference type - default to H5R_OBJECT
-///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - Oct, 2006
-// Modification
-// Jul, 2008
-// Added for application convenience.
-//--------------------------------------------------------------------------
-DataSet::DataSet(H5File& h5file, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object()
-{
- try {
- id = p_dereference(h5file.getId(), ref, ref_type);
- } catch (ReferenceException deref_error) {
- throw ReferenceException("DataSet constructor - located by HDF5 file",
- deref_error.getDetailMsg());
- }
-}
-
-//--------------------------------------------------------------------------
-// Function: DataSet overload constructor - dereference
-///\brief Given a reference, ref, to an hdf5 dataset, creates a
+///\brief Given a reference, ref, to an hdf5 attribute, creates a
/// DataSet object
///\param attr - IN: Specifying location where the referenced object is in
///\param ref - IN: Reference pointer
@@ -140,14 +112,9 @@ DataSet::DataSet(H5File& h5file, const void* ref, H5R_type_t ref_type) : Abstrac
// Jul, 2008
// Added for application convenience.
//--------------------------------------------------------------------------
-DataSet::DataSet(Attribute& attr, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object()
+DataSet::DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object(), id(0)
{
- try {
- id = p_dereference(attr.getId(), ref, ref_type);
- } catch (ReferenceException deref_error) {
- throw ReferenceException("DataSet constructor - located by attribute",
- deref_error.getDetailMsg());
- }
+ id = H5Location::p_dereference(attr.getId(), ref, ref_type, "constructor - by dereference");
}
//--------------------------------------------------------------------------
@@ -430,7 +397,7 @@ void DataSet::read( void* buf, const DataType& mem_type, const DataSpace& mem_sp
// Function: DataSet::read
///\brief This is an overloaded member function, provided for convenience.
/// It takes a reference to a \c H5std_string for the buffer.
-///\param buf - IN: Buffer for read data
+///\param strg - IN: Buffer for read data string
///\param mem_type - IN: Memory datatype
///\param mem_space - IN: Memory dataspace
///\param file_space - IN: Dataset's dataspace in the file
@@ -644,57 +611,10 @@ void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space)
}
}
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-//--------------------------------------------------------------------------
-// Function: DataSet::getObjType
-///\brief Retrieves the type of object that an object reference points to.
-///\param ref_type - IN: Type of reference to query, valid values are:
-/// \li \c H5R_OBJECT - Reference is an object reference.
-/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference.
-///\param ref - IN: Reference to query
-///\return An object type, which can be one of the following:
-/// \li \c H5G_LINK (0) - Object is a symbolic link.
-/// \li \c H5G_GROUP (1) - Object is a group.
-/// \li \c H5G_DATASET (2) - Object is a dataset.
-/// \li \c H5G_TYPE (3) - Object is a named datatype
-///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - May, 2004
-//--------------------------------------------------------------------------
-H5G_obj_t DataSet::getObjType(void *ref, H5R_type_t ref_type) const
-{
- try {
- return(p_get_obj_type(ref, ref_type));
- }
- catch (IdComponentException E) {
- throw DataSetIException("DataSet::getObjType", E.getDetailMsg());
- }
-}
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
-//--------------------------------------------------------------------------
-// Function: DataSet::getRegion
-///\brief Retrieves a dataspace with the region pointed to selected.
-///\param ref - IN: Reference to get region of
-///\param ref_type - IN: Type of reference to get region of - default
-/// to H5R_DATASET_REGION
-///\return DataSpace instance
-///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - May, 2004
-//--------------------------------------------------------------------------
-DataSpace DataSet::getRegion(void *ref, H5R_type_t ref_type) const
-{
- try {
- DataSpace dataspace(p_get_region(ref, ref_type));
- return(dataspace);
- }
- catch (IdComponentException E) {
- throw DataSetIException("DataSet::getRegion", E.getDetailMsg());
- }
-}
-
//--------------------------------------------------------------------------
// Function: DataSet::getId
///\brief Get the id of this dataset.
+///\return DataSet identifier
// Description:
// Class hierarchy is revised to address bugzilla 1068. Class
// AbstractDs and Attribute are moved out of H5Object. In
@@ -774,8 +694,9 @@ void DataSet::p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space
HDfree(strg_C);
}
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: DataSet::p_setId (private)
+// Function: DataSet::p_setId (protected)
///\brief Sets the identifier of this dataset to a new value.
///
///\exception H5::IdComponentException when the attempt to close the HDF5
@@ -797,10 +718,8 @@ void DataSet::p_setId(const hid_t new_id)
}
// reset object's id to the given id
id = new_id;
-
- // increment the reference counter of the new id
- //incRefCount();
}
+#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
// Function: DataSet::close