summaryrefslogtreecommitdiffstats
path: root/c++
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2016-08-22 06:29:29 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2016-08-22 06:29:29 (GMT)
commitb1c4fd77d9c4507d723016f464e6aed61dfc9307 (patch)
tree47ca174cba673f69f03a5c92654a86f7fa7be539 /c++
parentae18cf66d8b1da0d728f55db50142665c152e26d (diff)
downloadhdf5-b1c4fd77d9c4507d723016f464e6aed61dfc9307.zip
hdf5-b1c4fd77d9c4507d723016f464e6aed61dfc9307.tar.gz
hdf5-b1c4fd77d9c4507d723016f464e6aed61dfc9307.tar.bz2
[svn-r30311] Purpose: Fix bug HDFFR-9920 cont.
trunk: Description: Continued rearranging the classes to model the relationship of HDF5 objects more accurately. The changes included: - in the baseclass list of Attribute, changed "public IdComponent" to "public H5Location", because location sometime can be specified with attribute - moved H5A wrappers in H5Location to H5Object because H5A functions can't be called on attribute id - removed the stubs Attribute::iterateAttrs and Attribute::renameAttr - removed Attribute::getFileName and Attribute::flush, because H5Location has them - result of the modified partial class diagram, regarding Attribute IdComponent | H5Location AbstractDs / \ / H5Object Attribute Platforms tested: Linux/32 2.6 (jam) Linux/64 (platypus) Darwin (osx1010test)
Diffstat (limited to 'c++')
-rw-r--r--c++/src/H5AbstractDs.cpp2
-rw-r--r--c++/src/H5ArrayType.cpp2
-rw-r--r--c++/src/H5AtomType.cpp2
-rw-r--r--c++/src/H5Attribute.cpp55
-rw-r--r--c++/src/H5Attribute.h19
-rw-r--r--c++/src/H5CommonFG.cpp1
-rw-r--r--c++/src/H5CommonFG.h3
-rw-r--r--c++/src/H5CompType.cpp2
-rw-r--r--c++/src/H5DataSet.cpp2
-rw-r--r--c++/src/H5DataType.cpp2
-rw-r--r--c++/src/H5DcreatProp.cpp2
-rw-r--r--c++/src/H5EnumType.cpp2
-rw-r--r--c++/src/H5File.cpp2
-rw-r--r--c++/src/H5FloatType.cpp2
-rw-r--r--c++/src/H5Group.cpp20
-rw-r--r--c++/src/H5IntType.cpp2
-rw-r--r--c++/src/H5Library.cpp1
-rw-r--r--c++/src/H5Location.cpp274
-rw-r--r--c++/src/H5Location.h43
-rw-r--r--c++/src/H5Object.cpp274
-rw-r--r--c++/src/H5Object.h68
-rw-r--r--c++/src/H5PredType.cpp1
-rw-r--r--c++/src/H5StrType.cpp2
-rw-r--r--c++/src/H5VarLenType.cpp2
24 files changed, 374 insertions, 411 deletions
diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp
index adac056..f0579fc 100644
--- a/c++/src/H5AbstractDs.cpp
+++ b/c++/src/H5AbstractDs.cpp
@@ -19,12 +19,12 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5AbstractDs.h"
#include "H5DataSpace.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
-//#include "H5CommonFG.h"
#include "H5Alltypes.h"
#ifndef H5_NO_NAMESPACE
diff --git a/c++/src/H5ArrayType.cpp b/c++/src/H5ArrayType.cpp
index 9d2c14f..d7d1a35 100644
--- a/c++/src/H5ArrayType.cpp
+++ b/c++/src/H5ArrayType.cpp
@@ -19,10 +19,10 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
-//#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5ArrayType.h"
diff --git a/c++/src/H5AtomType.cpp b/c++/src/H5AtomType.cpp
index 3f8355b..6308821 100644
--- a/c++/src/H5AtomType.cpp
+++ b/c++/src/H5AtomType.cpp
@@ -19,10 +19,10 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
-//#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5AtomType.h"
diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp
index f07f34b..5454583 100644
--- a/c++/src/H5Attribute.cpp
+++ b/c++/src/H5Attribute.cpp
@@ -24,13 +24,13 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5AbstractDs.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
-//#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5DataSpace.h"
#include "H5Group.h"
@@ -53,7 +53,7 @@ class H5_DLLCPP H5Object; // forward declaration for UserData4Aiterate
///\brief Default constructor: Creates a stub attribute
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-Attribute::Attribute() : AbstractDs(), IdComponent(), id(H5I_INVALID_HID) {}
+Attribute::Attribute() : AbstractDs(), H5Location(), id(H5I_INVALID_HID) {}
//--------------------------------------------------------------------------
// Function: Attribute copy constructor
@@ -61,7 +61,7 @@ Attribute::Attribute() : AbstractDs(), IdComponent(), id(H5I_INVALID_HID) {}
///\param original - IN: Original Attribute object to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Attribute::Attribute(const Attribute& original) : AbstractDs(), IdComponent(), id(original.id)
+Attribute::Attribute(const Attribute& original) : AbstractDs(), H5Location(), id(original.id)
{
incRefCount(); // increment number of references to this id
}
@@ -74,7 +74,7 @@ Attribute::Attribute(const Attribute& original) : AbstractDs(), IdComponent(), i
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Attribute::Attribute(const hid_t existing_id) : AbstractDs(), IdComponent(), id(existing_id)
+Attribute::Attribute(const hid_t existing_id) : AbstractDs(), H5Location(), id(existing_id)
{
incRefCount(); // increment number of references to this id
}
@@ -283,23 +283,6 @@ DataSpace Attribute::getSpace() const
}
//--------------------------------------------------------------------------
-// Function: Attribute::getFileName
-///\brief Gets the name of the file, in which this attribute belongs.
-///\return File name
-///\exception H5::IdComponentException
-// Programmer Binh-Minh Ribler - Jul, 2004
-//--------------------------------------------------------------------------
-H5std_string Attribute::getFileName() const
-{
- try {
- return(p_get_file_name());
- }
- catch (IdComponentException& E) {
- throw FileIException("Attribute::getFileName", E.getDetailMsg());
- }
-}
-
-//--------------------------------------------------------------------------
// Function: Attribute::getName
///\brief Gets the name of this attribute, returning its length.
///\param attr_name - OUT: Buffer for the name string as char*
@@ -487,31 +470,6 @@ 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 - 2012
-// Modification
-// Sep 2012 - 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
///\brief Get the id of this attribute
///\return Attribute identifier
@@ -521,6 +479,11 @@ void Attribute::flush(H5F_scope_t scope) const
// addition, member IdComponent::id is moved into subclasses, and
// IdComponent::getId now becomes pure virtual function.
// Programmer Binh-Minh Ribler - May, 2008
+// Modification
+// Aug 2016 - BMR
+// Note that Attribute is now inheriting from H5Location, because
+// an attribute id can be used to specify a location in HDF5
+// library.
//--------------------------------------------------------------------------
hid_t Attribute::getId() const
{
diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h
index f5ee4a9..6590c23 100644
--- a/c++/src/H5Attribute.h
+++ b/c++/src/H5Attribute.h
@@ -26,10 +26,10 @@ namespace H5 {
An attribute has many characteristics similar to a dataset, thus both
Attribute and DataSet are derivatives of AbstractDs. Attribute also
- inherits from IdComponent because an attribute is an HDF5 component that
- is identified by an identifier.
+ inherits from H5Location because an attribute can be used to specify
+ a location.
*/
-class H5_DLLCPP Attribute : public AbstractDs, public IdComponent {
+class H5_DLLCPP Attribute : public AbstractDs, public H5Location {
public:
// Copy constructor: makes a copy of an existing Attribute object.
@@ -44,9 +44,6 @@ class H5_DLLCPP Attribute : public AbstractDs, public IdComponent {
// Closes this attribute.
virtual void close();
- // Gets the name of the file, in which this attribute belongs.
- H5std_string getFileName() const;
-
// Gets the name of this attribute.
ssize_t getName(char* attr_name, size_t buf_size = 0) const;
H5std_string getName(size_t len) const;
@@ -73,10 +70,6 @@ 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"); }
@@ -105,12 +98,6 @@ class H5_DLLCPP Attribute : public AbstractDs, public IdComponent {
void p_read_variable_len(const DataType& mem_type, H5std_string& strg) const;
void p_read_fixed_len(const DataType& mem_type, H5std_string& strg) const;
- // do not inherit H5Object::iterateAttrs
- int iterateAttrs() { return 0; }
-
- // do not inherit H5Object::renameAttr
- void renameAttr() {}
-
// Friend function to set Attribute id. For library use only.
friend void f_Attribute_setId(Attribute* attr, hid_t new_id);
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp
index 4bde850..0c18293 100644
--- a/c++/src/H5CommonFG.cpp
+++ b/c++/src/H5CommonFG.cpp
@@ -19,6 +19,7 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h
index b34a583..956be21 100644
--- a/c++/src/H5CommonFG.h
+++ b/c++/src/H5CommonFG.h
@@ -37,6 +37,9 @@ class H5_DLLCPP CommonFG {
// Noop destructor.
virtual ~CommonFG();
+ protected:
+ virtual void p_setId(const hid_t new_id) = 0;
+
#endif // DOXYGEN_SHOULD_SKIP_THIS
}; // end of CommonFG declaration
diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp
index 07a0460..6105273 100644
--- a/c++/src/H5CompType.cpp
+++ b/c++/src/H5CompType.cpp
@@ -19,10 +19,10 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
-//#include "H5CommonFG.h"
#include "H5Alltypes.h"
#include "H5AbstractDs.h"
#include "H5DxferProp.h"
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index e549c09..4b5d0b7 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -24,6 +24,7 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5PropList.h"
#include "H5OcreatProp.h"
@@ -31,7 +32,6 @@
#include "H5DcreatProp.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
-//#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5DataSpace.h"
#include "H5AbstractDs.h"
diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp
index 9df9dc2..b784dd4 100644
--- a/c++/src/H5DataType.cpp
+++ b/c++/src/H5DataType.cpp
@@ -25,13 +25,13 @@
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5DataSpace.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
-//#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5AtomType.h"
#include "H5PredType.h"
diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp
index 47e71db..06b5024 100644
--- a/c++/src/H5DcreatProp.cpp
+++ b/c++/src/H5DcreatProp.cpp
@@ -20,9 +20,9 @@
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5OcreatProp.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5DcreatProp.h"
-//#include "H5CommonFG.h"
#include "H5DataType.h"
#ifndef H5_NO_NAMESPACE
diff --git a/c++/src/H5EnumType.cpp b/c++/src/H5EnumType.cpp
index 00186e1..f0a2138 100644
--- a/c++/src/H5EnumType.cpp
+++ b/c++/src/H5EnumType.cpp
@@ -19,13 +19,13 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5AbstractDs.h"
#include "H5DxferProp.h"
#include "H5DataSpace.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
-//#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5DataSet.h"
#include "H5AtomType.h"
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp
index e6ca725..a81efd8 100644
--- a/c++/src/H5File.cpp
+++ b/c++/src/H5File.cpp
@@ -24,13 +24,13 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
#include "H5OcreatProp.h"
#include "H5DxferProp.h"
#include "H5DcreatProp.h"
-//#include "H5CommonFG.h"
#include "H5Group.h"
#include "H5AbstractDs.h"
#include "H5DataSpace.h"
diff --git a/c++/src/H5FloatType.cpp b/c++/src/H5FloatType.cpp
index 6078514..ed17aeb 100644
--- a/c++/src/H5FloatType.cpp
+++ b/c++/src/H5FloatType.cpp
@@ -19,10 +19,10 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
-//#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5AbstractDs.h"
#include "H5DxferProp.h"
diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp
index b4990be..d93d3a1 100644
--- a/c++/src/H5Group.cpp
+++ b/c++/src/H5Group.cpp
@@ -24,6 +24,7 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5AbstractDs.h"
#include "H5FaccProp.h"
@@ -33,31 +34,12 @@
#include "H5DxferProp.h"
#include "H5DataSpace.h"
#include "H5DataSet.h"
-//#include "H5CommonFG.h"
#include "H5Attribute.h"
#include "H5Group.h"
#include "H5File.h"
#include "H5Alltypes.h"
#include "H5private.h" // for HDstrcpy
- /* #include "H5Include.h"
-#include "H5Exception.h"
-#include "H5IdComponent.h"
-#include "H5PropList.h"
-#include "H5Object.h"
-#include "H5FaccProp.h"
-#include "H5FcreatProp.h"
-#include "H5OcreatProp.h"
-#include "H5DxferProp.h"
-#include "H5DcreatProp.h"
-#include "H5CommonFG.h"
-#include "Group.h"
-#include "H5AbstractDs.h"
-#include "H5DataSpace.h"
-#include "H5DataSet.h"
-#include "H5File.h"
-#include "H5Alltypes.h"
- */
#ifndef H5_NO_NAMESPACE
namespace H5 {
#ifndef H5_NO_STD
diff --git a/c++/src/H5IntType.cpp b/c++/src/H5IntType.cpp
index 40f9c82..780e44d 100644
--- a/c++/src/H5IntType.cpp
+++ b/c++/src/H5IntType.cpp
@@ -19,10 +19,10 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
-//#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5AbstractDs.h"
#include "H5DxferProp.h"
diff --git a/c++/src/H5Library.cpp b/c++/src/H5Library.cpp
index 471dbad..30f68e2 100644
--- a/c++/src/H5Library.cpp
+++ b/c++/src/H5Library.cpp
@@ -25,6 +25,7 @@
#include "H5FcreatProp.h"
#include "H5OcreatProp.h"
#include "H5DxferProp.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5DataType.h"
#include "H5DcreatProp.h"
diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp
index a538daf..4048d94 100644
--- a/c++/src/H5Location.cpp
+++ b/c++/src/H5Location.cpp
@@ -26,7 +26,6 @@
#include "H5DxferProp.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
-//#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5DataSpace.h"
#include "H5AbstractDs.h"
@@ -41,21 +40,6 @@ namespace H5 {
#endif
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-// userAttrOpWrpr simply interfaces between the user's function and the
-// C library function H5Aiterate2; used to resolve the different prototype
-// problem. May be moved to Iterator later.
-extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name,
- const H5A_info_t *ainfo, void *op_data)
-{
- H5std_string s_attr_name = H5std_string( attr_name );
-#ifdef NO_STATIC_CAST
- UserData4Aiterate* myData = (UserData4Aiterate *) op_data;
-#else
- UserData4Aiterate* myData = reinterpret_cast<UserData4Aiterate *> (op_data);
-#endif
- myData->op( *myData->location, s_attr_name, myData->opData );
- return 0;
-}
//--------------------------------------------------------------------------
// Function: H5Location default constructor (protected)
@@ -96,264 +80,6 @@ H5Location::H5Location() : IdComponent() {}
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: H5Location::createAttribute
-///\brief Creates an attribute for a group, dataset, or named datatype.
-///\param name - IN: Name of the attribute
-///\param data_type - IN: Datatype for the attribute
-///\param data_space - IN: Dataspace for the attribute - only simple
-/// dataspaces are allowed at this time
-///\param create_plist - IN: Creation property list - default to
-/// PropList::DEFAULT
-///\return Attribute instance
-///\exception H5::AttributeIException
-///\par Description
-/// The attribute name specified in \a name must be unique.
-/// Attempting to create an attribute with the same name as an
-/// existing attribute will raise an exception, leaving the
-/// pre-existing attribute intact. To overwrite an existing
-/// attribute with a new attribute of the same name, first
-/// delete the existing one with \c H5Location::removeAttr, then
-/// recreate it with this function.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-Attribute H5Location::createAttribute( const char* name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist ) const
-{
- hid_t type_id = data_type.getId();
- hid_t space_id = data_space.getId();
- hid_t plist_id = create_plist.getId();
- hid_t attr_id = H5Acreate2(getId(), name, type_id, space_id, plist_id, H5P_DEFAULT );
-
- // If the attribute id is valid, create and return the Attribute object
- if( attr_id > 0 )
- {
- Attribute attr;
- f_Attribute_setId(&attr, attr_id);
- return( attr );
- }
- else
- throw AttributeIException(inMemFunc("createAttribute"), "H5Acreate2 failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::createAttribute
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes
-/// a reference to an \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-Attribute H5Location::createAttribute( const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist ) const
-{
- return( createAttribute( name.c_str(), data_type, data_space, create_plist ));
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::openAttribute
-///\brief Opens an attribute given its name.
-///\param name - IN: Name of the attribute
-///\return Attribute instance
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-Attribute H5Location::openAttribute( const char* name ) const
-{
- hid_t attr_id = H5Aopen(getId(), name, H5P_DEFAULT);
- if( attr_id > 0 )
- {
- Attribute attr;
- f_Attribute_setId(&attr, attr_id);
- return( attr );
- }
- else
- {
- throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen failed");
- }
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::openAttribute
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes
-/// a reference to an \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-Attribute H5Location::openAttribute( const H5std_string& name ) const
-{
- return( openAttribute( name.c_str()) );
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::openAttribute
-///\brief Opens an attribute given its index.
-///\param idx - IN: Index of the attribute, a 0-based, non-negative integer
-///\return Attribute instance
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-Attribute H5Location::openAttribute( const unsigned int idx ) const
-{
- hid_t attr_id = H5Aopen_by_idx(getId(), ".", H5_INDEX_CRT_ORDER,
- H5_ITER_INC, static_cast<hsize_t>(idx), H5P_DEFAULT, H5P_DEFAULT);
- if( attr_id > 0 )
- {
- Attribute attr;
- f_Attribute_setId(&attr, attr_id);
- return(attr);
- }
- else
- {
- throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen_by_idx failed");
- }
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::iterateAttrs
-///\brief Iterates a user's function over all the attributes of an H5
-/// object, which may be a group, dataset or named datatype.
-///\param user_op - IN: User's function to operate on each attribute
-///\param _idx - IN/OUT: Starting (IN) and ending (OUT) attribute indices
-///\param op_data - IN: User's data to pass to user's operator function
-///\return Returned value of the last operator if it was non-zero, or
-/// zero if all attributes were processed
-///\exception H5::AttributeIException
-///\par Description
-/// The signature of user_op is
-/// void (*)(H5::H5Location&, H5std_string, void*).
-/// For information, please refer to the C layer Reference Manual
-/// at:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Iterate
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-int H5Location::iterateAttrs( attr_operator_t user_op, unsigned *_idx, void *op_data )
-{
- // store the user's function and data
- UserData4Aiterate* userData = new UserData4Aiterate;
- userData->opData = op_data;
- userData->op = user_op;
- userData->location = this;
-
- // call the C library routine H5Aiterate2 to iterate the attributes
- hsize_t idx = _idx ? static_cast<hsize_t>(*_idx) : 0;
- int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx,
- userAttrOpWrpr, reinterpret_cast<void *>(userData));
-
- // release memory
- delete userData;
-
- if( ret_value >= 0 ) {
- /* Pass back update index value to calling code */
- if (_idx)
- *_idx = static_cast<unsigned>(idx);
-
- return( ret_value );
- }
- else // raise exception when H5Aiterate returns a negative value
- throw AttributeIException(inMemFunc("iterateAttrs"), "H5Aiterate2 failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::getNumAttrs
-///\brief Returns the number of attributes attached to this HDF5 object.
-///\return Number of attributes
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-int H5Location::getNumAttrs() const
-{
- H5O_info_t oinfo; /* Object info */
-
- if(H5Oget_info(getId(), &oinfo) < 0)
- throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed");
- else
- return(static_cast<int>(oinfo.num_attrs));
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::attrExists
-///\brief Checks whether the named attribute exists at this location.
-///\param name - IN: Name of the attribute to be queried
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2013
-//--------------------------------------------------------------------------
-bool H5Location::attrExists(const char* name) const
-{
- // Call C routine H5Aexists to determine whether an attribute exists
- // at this location, which could be specified by a file, group, dataset,
- // or named datatype.
- herr_t ret_value = H5Aexists(getId(), name);
- if( ret_value > 0 )
- return true;
- else if(ret_value == 0)
- return false;
- else // Raise exception when H5Aexists returns a negative value
- throw AttributeIException(inMemFunc("attrExists"), "H5Aexists failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::attrExists
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes
-/// a reference to an \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-bool H5Location::attrExists(const H5std_string& name) const
-{
- return(attrExists(name.c_str()));
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::removeAttr
-///\brief Removes the named attribute from this object.
-///\param name - IN: Name of the attribute to be removed
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void H5Location::removeAttr( const char* name ) const
-{
- herr_t ret_value = H5Adelete(getId(), name);
- if( ret_value < 0 )
- throw AttributeIException(inMemFunc("removeAttr"), "H5Adelete failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::removeAttr
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes
-/// a reference to an \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void H5Location::removeAttr( const H5std_string& name ) const
-{
- removeAttr( name.c_str() );
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::renameAttr
-///\brief Renames the named attribute from this object.
-///\param oldname - IN: Name of the attribute to be renamed
-///\param newname - IN: New name ame of the attribute
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - Mar, 2005
-//--------------------------------------------------------------------------
-void H5Location::renameAttr(const char* oldname, const char* newname) const
-{
- herr_t ret_value = H5Arename(getId(), oldname, newname);
- if (ret_value < 0)
- throw AttributeIException(inMemFunc("renameAttr"), "H5Arename failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::renameAttr
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes
-/// a reference to an \c H5std_string for the names.
-// Programmer Binh-Minh Ribler - Mar, 2005
-//--------------------------------------------------------------------------
-void H5Location::renameAttr(const H5std_string& oldname, const H5std_string& newname) const
-{
- renameAttr (oldname.c_str(), newname.c_str());
-}
-
-//--------------------------------------------------------------------------
// Function: H5Location::flush
///\brief Flushes all buffers associated with a location to disk.
///\param scope - IN: Specifies the scope of the flushing action,
diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h
index 9e4ec05..9000c5c 100644
--- a/c++/src/H5Location.h
+++ b/c++/src/H5Location.h
@@ -23,20 +23,21 @@
namespace H5 {
#endif
-class H5_DLLCPP H5Location; // forward declaration for UserData4Aiterate
+//class H5_DLLCPP H5Location; // forward declaration for UserData4Aiterate
// Define the operator function pointer for H5Aiterate().
-typedef void (*attr_operator_t)( H5Location& loc/*in*/,
- const H5std_string attr_name/*in*/,
- void *operator_data/*in,out*/);
+//typedef void (*attr_operator_t)( H5Location& loc/*in*/,
+ //const H5std_string attr_name/*in*/,
+ //void *operator_data/*in,out*/);
//! User data for attribute iteration
-class UserData4Aiterate {
+ /* class UserData4Aiterate {
public:
attr_operator_t op;
void* opData;
H5Location* location;
};
+ */
/*! \class H5Location
\brief H5Location is an abstract base class, added in version 1.8.12.
@@ -49,29 +50,12 @@ class UserData4Aiterate {
// a location can be a file, group, dataset, or named datatype. -BMR, 2013-10-1
class H5_DLLCPP H5Location : public IdComponent {
public:
- // Creates an attribute for the specified object at this location
- // PropList is currently not used, so always be default.
- Attribute createAttribute( const char* name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT ) const;
- Attribute createAttribute( const H5std_string& name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT ) const;
-
- // Given its name, opens the attribute that belongs to an object at
- // this location.
- Attribute openAttribute( const char* name ) const;
- Attribute openAttribute( const H5std_string& name ) const;
-
- // Given its index, opens the attribute that belongs to an object at
- // this location.
- Attribute openAttribute( const unsigned int idx ) const;
-
// Flushes all buffers associated with this location to disk.
void flush( H5F_scope_t scope ) const;
// Gets the name of the file, specified by this location.
H5std_string getFileName() const;
- // Determines the number of attributes at this location.
- int getNumAttrs() const;
-
#ifndef H5_NO_DEPRECATED_SYMBOLS
// Retrieves the type of object that an object reference points to.
H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
@@ -82,21 +66,6 @@ class H5_DLLCPP H5Location : public IdComponent {
// Note: getRefObjType deprecates getObjType, but getObjType's name is
// misleading, so getRefObjType is used in the new function instead.
- // Iterate user's function over the attributes at this location.
- int iterateAttrs(attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL);
-
- // Checks whether the named attribute exists at this location.
- bool attrExists(const char* name) const;
- bool attrExists(const H5std_string& name) const;
-
- // Renames the named attribute to a new name.
- void renameAttr(const char* oldname, const char* newname) const;
- void renameAttr(const H5std_string& oldname, const H5std_string& newname) const;
-
- // Removes the named attribute from this location.
- void removeAttr(const char* name) const;
- void removeAttr(const H5std_string& name) const;
-
// Sets the comment for an HDF5 object specified by its name.
void setComment(const char* name, const char* comment) const;
void setComment(const H5std_string& name, const H5std_string& comment) const;
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp
index 27a0070..0cb392d 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -19,13 +19,13 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
-//#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5DataSpace.h"
#include "H5AbstractDs.h"
@@ -40,6 +40,19 @@ namespace H5 {
#endif
#ifndef DOXYGEN_SHOULD_SKIP_THIS
+// userAttrOpWrpr simply interfaces between the user's function and the
+// C library function H5Aiterate2; used to resolve the different prototype
+// problem. May be moved to Iterator later.
+extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name,
+ const H5A_info_t *ainfo, void *op_data)
+{
+ H5std_string s_attr_name = H5std_string( attr_name );
+ UserData4Aiterate* myData = reinterpret_cast<UserData4Aiterate *> (op_data);
+ myData->op( *myData->location, s_attr_name, myData->opData );
+ return 0;
+}
+#endif
+
//--------------------------------------------------------------------------
// Function: H5Object default constructor (protected)
// Programmer Binh-Minh Ribler - 2000
@@ -74,6 +87,264 @@ H5Object::H5Object() : H5Location() {}
//--------------------------------------------------------------------------
// H5Object::H5Object(const H5Object& original) : H5Location() {}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::createAttribute
+///\brief Creates an attribute for a group, dataset, or named datatype.
+///\param name - IN: Name of the attribute
+///\param data_type - IN: Datatype for the attribute
+///\param data_space - IN: Dataspace for the attribute - only simple
+/// dataspaces are allowed at this time
+///\param create_plist - IN: Creation property list - default to
+/// PropList::DEFAULT
+///\return Attribute instance
+///\exception H5::AttributeIException
+///\par Description
+/// The attribute name specified in \a name must be unique.
+/// Attempting to create an attribute with the same name as an
+/// existing attribute will raise an exception, leaving the
+/// pre-existing attribute intact. To overwrite an existing
+/// attribute with a new attribute of the same name, first
+/// delete the existing one with \c H5Object::removeAttr, then
+/// recreate it with this function.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+Attribute H5Object::createAttribute( const char* name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist ) const
+{
+ hid_t type_id = data_type.getId();
+ hid_t space_id = data_space.getId();
+ hid_t plist_id = create_plist.getId();
+ hid_t attr_id = H5Acreate2(getId(), name, type_id, space_id, plist_id, H5P_DEFAULT );
+
+ // If the attribute id is valid, create and return the Attribute object
+ if( attr_id > 0 )
+ {
+ Attribute attr;
+ f_Attribute_setId(&attr, attr_id);
+ return( attr );
+ }
+ else
+ throw AttributeIException(inMemFunc("createAttribute"), "H5Acreate2 failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::createAttribute
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes
+/// a reference to an \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+Attribute H5Object::createAttribute( const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist ) const
+{
+ return( createAttribute( name.c_str(), data_type, data_space, create_plist ));
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::openAttribute
+///\brief Opens an attribute given its name.
+///\param name - IN: Name of the attribute
+///\return Attribute instance
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+Attribute H5Object::openAttribute( const char* name ) const
+{
+ hid_t attr_id = H5Aopen(getId(), name, H5P_DEFAULT);
+ if( attr_id > 0 )
+ {
+ Attribute attr;
+ f_Attribute_setId(&attr, attr_id);
+ return( attr );
+ }
+ else
+ {
+ throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen failed");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::openAttribute
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes
+/// a reference to an \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+Attribute H5Object::openAttribute( const H5std_string& name ) const
+{
+ return( openAttribute( name.c_str()) );
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::openAttribute
+///\brief Opens an attribute given its index.
+///\param idx - IN: Index of the attribute, a 0-based, non-negative integer
+///\return Attribute instance
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+Attribute H5Object::openAttribute( const unsigned int idx ) const
+{
+ hid_t attr_id = H5Aopen_by_idx(getId(), ".", H5_INDEX_CRT_ORDER,
+ H5_ITER_INC, static_cast<hsize_t>(idx), H5P_DEFAULT, H5P_DEFAULT);
+ if( attr_id > 0 )
+ {
+ Attribute attr;
+ f_Attribute_setId(&attr, attr_id);
+ return(attr);
+ }
+ else
+ {
+ throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen_by_idx failed");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::iterateAttrs
+///\brief Iterates a user's function over all the attributes of an H5
+/// object, which may be a group, dataset or named datatype.
+///\param user_op - IN: User's function to operate on each attribute
+///\param _idx - IN/OUT: Starting (IN) and ending (OUT) attribute indices
+///\param op_data - IN: User's data to pass to user's operator function
+///\return Returned value of the last operator if it was non-zero, or
+/// zero if all attributes were processed
+///\exception H5::AttributeIException
+///\par Description
+/// The signature of user_op is
+/// void (*)(H5::H5Location&, H5std_string, void*).
+/// For information, please refer to the C layer Reference Manual
+/// at:
+/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Iterate
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+int H5Object::iterateAttrs( attr_operator_t user_op, unsigned *_idx, void *op_data )
+{
+ // store the user's function and data
+ UserData4Aiterate* userData = new UserData4Aiterate;
+ userData->opData = op_data;
+ userData->op = user_op;
+ userData->location = this;
+
+ // call the C library routine H5Aiterate2 to iterate the attributes
+ hsize_t idx = _idx ? static_cast<hsize_t>(*_idx) : 0;
+ int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx,
+ userAttrOpWrpr, reinterpret_cast<void *>(userData));
+
+ // release memory
+ delete userData;
+
+ if( ret_value >= 0 ) {
+ /* Pass back update index value to calling code */
+ if (_idx)
+ *_idx = static_cast<unsigned>(idx);
+
+ return( ret_value );
+ }
+ else // raise exception when H5Aiterate returns a negative value
+ throw AttributeIException(inMemFunc("iterateAttrs"), "H5Aiterate2 failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::getNumAttrs
+///\brief Returns the number of attributes attached to this HDF5 object.
+///\return Number of attributes
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+int H5Object::getNumAttrs() const
+{
+ H5O_info_t oinfo; /* Object info */
+
+ if(H5Oget_info(getId(), &oinfo) < 0)
+ throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed");
+ else
+ return(static_cast<int>(oinfo.num_attrs));
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::attrExists
+///\brief Checks whether the named attribute exists at this location.
+///\param name - IN: Name of the attribute to be queried
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2013
+//--------------------------------------------------------------------------
+bool H5Object::attrExists(const char* name) const
+{
+ // Call C routine H5Aexists to determine whether an attribute exists
+ // at this location, which could be specified by a file, group, dataset,
+ // or named datatype.
+ herr_t ret_value = H5Aexists(getId(), name);
+ if( ret_value > 0 )
+ return true;
+ else if(ret_value == 0)
+ return false;
+ else // Raise exception when H5Aexists returns a negative value
+ throw AttributeIException(inMemFunc("attrExists"), "H5Aexists failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::attrExists
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes
+/// a reference to an \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+bool H5Object::attrExists(const H5std_string& name) const
+{
+ return(attrExists(name.c_str()));
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::removeAttr
+///\brief Removes the named attribute from this object.
+///\param name - IN: Name of the attribute to be removed
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void H5Object::removeAttr( const char* name ) const
+{
+ herr_t ret_value = H5Adelete(getId(), name);
+ if( ret_value < 0 )
+ throw AttributeIException(inMemFunc("removeAttr"), "H5Adelete failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::removeAttr
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes
+/// a reference to an \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void H5Object::removeAttr( const H5std_string& name ) const
+{
+ removeAttr( name.c_str() );
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::renameAttr
+///\brief Renames the named attribute from this object.
+///\param oldname - IN: Name of the attribute to be renamed
+///\param newname - IN: New name ame of the attribute
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - Mar, 2005
+//--------------------------------------------------------------------------
+void H5Object::renameAttr(const char* oldname, const char* newname) const
+{
+ herr_t ret_value = H5Arename(getId(), oldname, newname);
+ if (ret_value < 0)
+ throw AttributeIException(inMemFunc("renameAttr"), "H5Arename failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::renameAttr
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes
+/// a reference to an \c H5std_string for the names.
+// Programmer Binh-Minh Ribler - Mar, 2005
+//--------------------------------------------------------------------------
+void H5Object::renameAttr(const H5std_string& oldname, const H5std_string& newname) const
+{
+ renameAttr (oldname.c_str(), newname.c_str());
+}
//--------------------------------------------------------------------------
// Function: getObjName
///\brief Given an id, returns the type of the object.
@@ -185,6 +456,7 @@ ssize_t H5Object::getObjName(H5std_string& obj_name, size_t len) const
return(name_size);
}
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
// Function: H5Object destructor
///\brief Noop destructor.
diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h
index 193e5d1..c39de3a 100644
--- a/c++/src/H5Object.h
+++ b/c++/src/H5Object.h
@@ -17,8 +17,8 @@
#ifndef __H5Object_H
#define __H5Object_H
-#include "H5Location.h"
-#include "H5Classes.h" // constains forward class declarations
+//#include "H5Location.h"
+//#include "H5Classes.h" // constains forward class declarations
// H5Object is a baseclass. It has these subclasses:
// Group, DataSet, and DataType.
@@ -38,6 +38,21 @@
namespace H5 {
#endif
+class H5_DLLCPP H5Object;
+
+// Define the operator function pointer for H5Aiterate().
+typedef void (*attr_operator_t)( H5Object& loc/*in*/,
+ const H5std_string attr_name/*in*/,
+ void *operator_data/*in,out*/);
+
+// User data for attribute iteration
+class UserData4Aiterate {
+ public:
+ attr_operator_t op;
+ void* opData;
+ H5Object* location;
+};
+
/*! \class H5Object
\brief Class H5Object is a bridge between H5Location and DataSet, DataType,
and Group.
@@ -46,6 +61,45 @@ namespace H5 {
*/
class H5_DLLCPP H5Object : public H5Location {
public:
+// Rearranging classes (HDFFV-9920) moved H5A wrappers back into H5Object.
+// That way, C functions that takes attribute id can be in
+// H5Location and those that cannot take attribute id can be in H5Object.
+
+ // Creates an attribute for the specified object
+ // PropList is currently not used, so always be default.
+ Attribute createAttribute( const char* name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT ) const;
+ Attribute createAttribute( const H5std_string& name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT ) const;
+
+ // Given its name, opens the attribute that belongs to an object at
+ // this location.
+ Attribute openAttribute( const char* name ) const;
+ Attribute openAttribute( const H5std_string& name ) const;
+
+ // Given its index, opens the attribute that belongs to an object at
+ // this location.
+ Attribute openAttribute( const unsigned int idx ) const;
+
+ // Iterate user's function over the attributes of this object.
+ int iterateAttrs(attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL);
+
+ // Determines the number of attributes belong to this object.
+ int getNumAttrs() const;
+
+ // Checks whether the named attribute exists for this object.
+ bool attrExists(const char* name) const;
+ bool attrExists(const H5std_string& name) const;
+
+ // Renames the named attribute to a new name.
+ void renameAttr(const char* oldname, const char* newname) const;
+ void renameAttr(const H5std_string& oldname, const H5std_string& newname) const;
+
+ // Removes the named attribute from this object.
+ void removeAttr(const char* name) const;
+ void removeAttr(const H5std_string& name) const;
+
+ // Returns an identifier.
+ virtual hid_t getId() const = 0;
+
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// Gets the name of this HDF5 object, i.e., Group, DataSet, or
// DataType. These should have const but are retiring anyway.
@@ -53,9 +107,6 @@ class H5_DLLCPP H5Object : public H5Location {
ssize_t getObjName(H5std_string& obj_name, size_t len = 0) const;
H5std_string getObjName() const;
- // Noop destructor.
- virtual ~H5Object();
-
protected:
// Default constructor
H5Object();
@@ -73,6 +124,13 @@ class H5_DLLCPP H5Object : public H5Location {
// Copy constructor: makes copy of an H5Object object.
// H5Object(const H5Object& original);
+ // Sets the identifier of this object to a new value. - this one
+ // doesn't increment reference count
+ virtual void p_setId(const hid_t new_id) = 0;
+
+ // Noop destructor.
+ virtual ~H5Object();
+
#endif // DOXYGEN_SHOULD_SKIP_THIS
}; /* end class H5Object */
diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp
index fb29f1e..3fe9a8a 100644
--- a/c++/src/H5PredType.cpp
+++ b/c++/src/H5PredType.cpp
@@ -19,6 +19,7 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5DataType.h"
#include "H5AtomType.h"
diff --git a/c++/src/H5StrType.cpp b/c++/src/H5StrType.cpp
index c8bea14..8e1672b 100644
--- a/c++/src/H5StrType.cpp
+++ b/c++/src/H5StrType.cpp
@@ -19,10 +19,10 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
-//#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5AtomType.h"
#include "H5AbstractDs.h"
diff --git a/c++/src/H5VarLenType.cpp b/c++/src/H5VarLenType.cpp
index 13006dc..67334d3 100644
--- a/c++/src/H5VarLenType.cpp
+++ b/c++/src/H5VarLenType.cpp
@@ -19,10 +19,10 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
-//#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5VarLenType.h"