summaryrefslogtreecommitdiffstats
path: root/c++/src/H5Object.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'c++/src/H5Object.cpp')
-rw-r--r--c++/src/H5Object.cpp52
1 files changed, 51 insertions, 1 deletions
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp
index ab79d9d..66699d4 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -15,6 +15,7 @@
#include <string>
+#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -29,11 +30,11 @@
#include "H5DataType.h"
#include "H5DataSpace.h"
#include "H5AbstractDs.h"
+#include "H5CommonFG.h"
#include "H5Group.h"
#include "H5File.h"
#include "H5DataSet.h"
#include "H5Attribute.h"
-#include "H5private.h" // for HDmemset
namespace H5 {
@@ -86,6 +87,21 @@ H5Object::H5Object() : H5Location() {}
// H5Object::H5Object(const H5Object& original) : H5Location() {}
//--------------------------------------------------------------------------
+// Function: f_Attribute_setId - friend
+// Purpose: This function is friend to class H5::Attribute so that it
+// can set Attribute::id in order to work around a problem
+// described in the JIRA issue HDFFV-7947.
+// Applications shouldn't need to use it.
+// param attr - IN/OUT: Attribute object to be changed
+// param new_id - IN: New id to set
+// Programmer Binh-Minh Ribler - 2015
+//--------------------------------------------------------------------------
+void f_Attribute_setId(Attribute* attr, hid_t new_id)
+{
+ attr->p_setId(new_id);
+}
+
+//--------------------------------------------------------------------------
// Function: H5Object::createAttribute
///\brief Creates an attribute for a group, dataset, or named datatype.
///\param name - IN: Name of the attribute
@@ -241,6 +257,40 @@ int H5Object::iterateAttrs( attr_operator_t user_op, unsigned *_idx, void *op_da
}
//--------------------------------------------------------------------------
+// Function: H5Object::objVersion
+///\brief Returns the header version of this HDF5 object.
+///\return Object version, which can have the following values:
+/// \li \c H5O_VERSION_1
+/// \li \c H5O_VERSION_2
+///\exception H5::ObjHeaderIException
+/// Exception will be thrown when:
+/// - an error returned by the C API
+/// - version number is not one of the valid values above
+// Programmer Binh-Minh Ribler - December, 2016
+//--------------------------------------------------------------------------
+ /* unsigned H5Object::objVersion() const
+{
+ H5O_info_t objinfo;
+ unsigned version = 0;
+
+ // Use C API to get information of the object
+ herr_t ret_value = H5Oget_info(getId(), &objinfo);
+
+ // Throw exception if C API returns failure
+ if (ret_value < 0)
+ throw Exception(inMemFunc("objVersion"), "H5Oget_info failed");
+ // Return a valid version or throw an exception for invalid value
+ else
+ {
+ version = objinfo.hdr.version;
+ if (version != H5O_VERSION_1 && version != H5O_VERSION_2)
+ throw ObjHeaderIException("objVersion", "Invalid version for object");
+ }
+ return(version);
+}
+ */
+
+//--------------------------------------------------------------------------
// Function: H5Object::getNumAttrs
///\brief Returns the number of attributes attached to this HDF5 object.
///\return Number of attributes