summaryrefslogtreecommitdiffstats
path: root/c++/src/H5Group.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/H5Group.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/H5Group.cpp')
-rw-r--r--c++/src/H5Group.cpp89
1 files changed, 8 insertions, 81 deletions
diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp
index 6ec2dbb..d0231e3 100644
--- a/c++/src/H5Group.cpp
+++ b/c++/src/H5Group.cpp
@@ -99,33 +99,9 @@ Group::Group(const hid_t existing_id) : H5Object()
/// is a datatype that has been named by DataType::commit.
// Programmer Binh-Minh Ribler - Oct, 2006
//--------------------------------------------------------------------------
-Group::Group(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Object()
+Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type) : H5Object(), id(0)
{
- try {
- id = p_dereference(obj.getId(), ref, ref_type);
- } catch (ReferenceException deref_error) {
- throw ReferenceException("Group constructor - located by an H5Object",
- deref_error.getDetailMsg());
- }
-}
-
-//--------------------------------------------------------------------------
-// Function: Group overload constructor - dereference
-///\brief Given a reference, ref, to an hdf5 group, creates a Group 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::ReferenceException
-// Programmer Binh-Minh Ribler - Oct, 2006
-//--------------------------------------------------------------------------
-Group::Group(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object()
-{
- try {
- id = p_dereference(h5file.getId(), ref, ref_type);
- } catch (ReferenceException deref_error) {
- throw ReferenceException("Group constructor - located by an H5File",
- deref_error.getDetailMsg());
- }
+ id = H5Location::p_dereference(loc.getId(), ref, ref_type, "constructor - by dereference");
}
//--------------------------------------------------------------------------
@@ -137,66 +113,15 @@ Group::Group(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object()
///\exception H5::ReferenceException
// Programmer Binh-Minh Ribler - Oct, 2006
//--------------------------------------------------------------------------
-Group::Group(Attribute& attr, const void* ref, H5R_type_t ref_type) : H5Object()
-{
- try {
- id = p_dereference(attr.getId(), ref, ref_type);
- } catch (ReferenceException deref_error) {
- throw ReferenceException("Group constructor - located by an Attribute",
- deref_error.getDetailMsg());
- }
-}
-
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-//--------------------------------------------------------------------------
-// Function: Group::getObjType
-///\brief Retrieves the type of object that an object reference points to.
-///\param ref - IN: Reference to query
-///\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.
-///\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::GroupIException
-// Programmer Binh-Minh Ribler - May, 2004
-//--------------------------------------------------------------------------
-H5G_obj_t Group::getObjType(void *ref, H5R_type_t ref_type) const
-{
- try {
- return(p_get_obj_type(ref, ref_type));
- }
- catch (IdComponentException E) {
- throw GroupIException("Group::getObjType", E.getDetailMsg());
- }
-}
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
-//--------------------------------------------------------------------------
-// Function: Group::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
-///\return DataSpace instance
-///\exception H5::GroupIException
-// Programmer Binh-Minh Ribler - May, 2004
-//--------------------------------------------------------------------------
-DataSpace Group::getRegion(void *ref, H5R_type_t ref_type) const
+Group::Group(const Attribute& attr, const void* ref, H5R_type_t ref_type) : H5Object(), id(0)
{
- try {
- DataSpace dataspace(p_get_region(ref, ref_type));
- return(dataspace);
- }
- catch (IdComponentException E) {
- throw GroupIException("Group::getRegion", E.getDetailMsg());
- }
+ id = H5Location::p_dereference(attr.getId(), ref, ref_type, "constructor - by dereference");
}
//--------------------------------------------------------------------------
// Function: Group::getId
-// Purpose: Get the id of this attribute
+///\brief Get the id of this group
+///\return Group identifier
// Modification:
// May 2008 - BMR
// Class hierarchy is revised to address bugzilla 1068. Class
@@ -210,6 +135,7 @@ hid_t Group::getId() const
return(id);
}
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
// Function: Group::p_setId
///\brief Sets the identifier of this object to a new value.
@@ -234,6 +160,7 @@ void Group::p_setId(const hid_t new_id)
// reset object's id to the given id
id = new_id;
}
+#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
// Function: Group::close