summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--c++/src/H5CommonFG.cpp5
-rw-r--r--c++/src/H5File.h4
-rw-r--r--c++/src/H5Group.cpp93
-rw-r--r--c++/src/H5Group.h3
-rw-r--r--c++/src/H5Location.cpp17
-rw-r--r--c++/src/H5Location.h3
-rw-r--r--c++/src/H5Object.cpp15
7 files changed, 71 insertions, 69 deletions
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp
index c9c203a..af5ba0e 100644
--- a/c++/src/H5CommonFG.cpp
+++ b/c++/src/H5CommonFG.cpp
@@ -13,8 +13,8 @@
#include <string>
-#include "H5Include.h"
#include "H5private.h" // for HDstrcpy
+#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5DataSpace.h"
@@ -64,7 +64,8 @@ DataType CommonFG::openDataType(const char* name) const
throwException("openDataType", "H5Topen2 failed");
// No failure, create and return the DataType object
- DataType data_type(type_id);
+ DataType data_type;
+ f_DataType_setId(&data_type, type_id);
return(data_type);
}
diff --git a/c++/src/H5File.h b/c++/src/H5File.h
index b428a40..0f921ae 100644
--- a/c++/src/H5File.h
+++ b/c++/src/H5File.h
@@ -21,7 +21,7 @@ namespace H5 {
\brief Class H5File represents an HDF5 file and inherits from class Group
as file is a root group.
- Inheritance: Group -> H5Object -> H5Location -> IdComponent
+ Inheritance: Group -> CommonFG/H5Object -> H5Location -> IdComponent
*/
class H5_DLLCPP H5File : public Group {
public:
@@ -92,7 +92,7 @@ class H5_DLLCPP H5File : public Group {
// Throw file exception.
virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const;
- // for CommonFG to get the file id.
+ // For CommonFG to get the file id.
virtual hid_t getLocId() const;
// Default constructor
diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp
index 994d9ff..c0e0dd1 100644
--- a/c++/src/H5Group.cpp
+++ b/c++/src/H5Group.cpp
@@ -62,44 +62,6 @@ Group::Group(const Group& original) : H5Object(), CommonFG(), id(original.id)
}
//--------------------------------------------------------------------------
-// Function: Group::getObjId
-///\brief Opens an object via object header.
-///\param obj_name - IN: Path to the object
-///\param plist - IN: Access property list for the link pointing to
-/// the object
-///\exception H5::FileIException or H5::GroupIException
-///\par Description
-/// This function opens an object in a group or file, using
-/// H5Oopen. Thus, an object can be opened without knowing
-/// the object's type.
-// Programmer Binh-Minh Ribler - March, 2017
-//--------------------------------------------------------------------------
-hid_t Group::getObjId(const char* obj_name, const PropList& plist) const
-{
- hid_t ret_value = H5Oopen(getId(), obj_name, plist.getId());
- if (ret_value < 0)
- {
- throwException("Group::getObjId", "H5Oopen failed");
- }
- return(ret_value);
-}
-
-//--------------------------------------------------------------------------
-// Function: Group::getObjId
-///\brief This is an overloaded member function, provided for convenience.
-/// It takes a reference to a \c H5std_string for the object's name.
-///\param obj_name - IN: Path to the object
-///\param plist - IN: Access property list for the link pointing to
-/// the object
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - March, 2017
-//--------------------------------------------------------------------------
-hid_t Group::getObjId(const H5std_string& obj_name, const PropList& plist) const
-{
- return(getObjId(obj_name.c_str(), plist));
-}
-
-//--------------------------------------------------------------------------
// Function: Group::closeObjId
///\brief Closes an object, which was opened with Group::getObjId
///\exception H5::FileIException or H5::GroupIException
@@ -181,6 +143,61 @@ Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const
*/
//--------------------------------------------------------------------------
+// Function: Group::getNumObjs
+///\brief Returns the number of objects in this group.
+///\return Number of objects
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - January, 2003
+//--------------------------------------------------------------------------
+hsize_t Group::getNumObjs() const
+{
+ H5G_info_t ginfo; // Group information
+
+ herr_t ret_value = H5Gget_info(getId(), &ginfo);
+ if(ret_value < 0)
+ throwException("getNumObjs", "H5Gget_info failed");
+ return (ginfo.nlinks);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::getObjId
+///\brief Opens an object via object header.
+///\param obj_name - IN: Path to the object
+///\param plist - IN: Access property list for the link pointing to
+/// the object
+///\exception H5::FileIException or H5::GroupIException
+///\par Description
+/// This function opens an object in a group or file, using
+/// H5Oopen. Thus, an object can be opened without knowing
+/// the object's type.
+// Programmer Binh-Minh Ribler - March, 2017
+//--------------------------------------------------------------------------
+hid_t Group::getObjId(const char* obj_name, const PropList& plist) const
+{
+ hid_t ret_value = H5Oopen(getId(), obj_name, plist.getId());
+ if (ret_value < 0)
+ {
+ throwException("Group::getObjId", "H5Oopen failed");
+ }
+ return(ret_value);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::getObjId
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes a reference to a \c H5std_string for the object's name.
+///\param obj_name - IN: Path to the object
+///\param plist - IN: Access property list for the link pointing to
+/// the object
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - March, 2017
+//--------------------------------------------------------------------------
+hid_t Group::getObjId(const H5std_string& obj_name, const PropList& plist) const
+{
+ return(getObjId(obj_name.c_str(), plist));
+}
+
+//--------------------------------------------------------------------------
// Function: Group::getId
///\brief Get the id of this group
///\return Group identifier
diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h
index a7e1f7c..e5fa174 100644
--- a/c++/src/H5Group.h
+++ b/c++/src/H5Group.h
@@ -53,6 +53,9 @@ class H5_DLLCPP Group : public H5Object, public CommonFG {
// Removed in 1.10.1, because H5Location is baseclass
// Group(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
+ // Returns the number of objects in this group.
+ hsize_t getNumObjs() const;
+
// Opens an object within a group or a file, i.e., root group.
hid_t getObjId(const char* name, const PropList& plist = PropList::DEFAULT) const;
hid_t getObjId(const H5std_string& name, const PropList& plist = PropList::DEFAULT) const;
diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp
index e820b0d..a81e300 100644
--- a/c++/src/H5Location.cpp
+++ b/c++/src/H5Location.cpp
@@ -1282,23 +1282,6 @@ int H5Location::iterateElems(const H5std_string& name, int *idx, H5G_iterate_t o
#endif /* H5_NO_DEPRECATED_SYMBOLS */
//--------------------------------------------------------------------------
-// Function: H5Location::getNumObjs
-///\brief Returns the number of objects in this group.
-///\return Number of objects
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - January, 2003
-//--------------------------------------------------------------------------
-hsize_t H5Location::getNumObjs() const
-{
- H5G_info_t ginfo; // Group information
-
- herr_t ret_value = H5Gget_info(getId(), &ginfo);
- if(ret_value < 0)
- throwException("getNumObjs", "H5Gget_info failed");
- return (ginfo.nlinks);
-}
-
-//--------------------------------------------------------------------------
// Function: H5Location::getObjnameByIdx
///\brief Returns the name of an object in this group, given the
/// object's index.
diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h
index a57d3ed..41f7ca0 100644
--- a/c++/src/H5Location.h
+++ b/c++/src/H5Location.h
@@ -113,9 +113,6 @@ class H5_DLLCPP H5Location : public IdComponent {
H5std_string getLinkval(const char* link_name, size_t size=0) const;
H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const;
- // Returns the number of objects in this group.
- hsize_t getNumObjs() const;
-
// Retrieves the name of an object in this group, given the
// object's index.
H5std_string getObjnameByIdx(hsize_t idx) const;
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp
index 865d04f..81e61e8 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -44,10 +44,10 @@ namespace H5 {
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;
+ 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;
}
//--------------------------------------------------------------------------
@@ -81,6 +81,7 @@ H5Object::H5Object() : H5Location() {}
// This constructor is no longer appropriate because the data member "id" had
// been moved to the sub-classes. It is removed from 1.8.15 because it is
// a noop and it can be generated by the compiler if needed.
+// Removed in 1.10.1 - Aug 2016
//--------------------------------------------------------------------------
// H5Object::H5Object(const H5Object& original) : H5Location() {}
@@ -148,7 +149,7 @@ Attribute H5Object::createAttribute(const char* name, const DataType& data_type,
//--------------------------------------------------------------------------
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));
+ return(createAttribute(name.c_str(), data_type, data_space, create_plist));
}
//--------------------------------------------------------------------------
@@ -183,7 +184,7 @@ Attribute H5Object::openAttribute(const char* name) const
//--------------------------------------------------------------------------
Attribute H5Object::openAttribute(const H5std_string& name) const
{
- return(openAttribute( name.c_str()));
+ return(openAttribute(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -239,7 +240,7 @@ int H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_dat
// 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));
+ userAttrOpWrpr, static_cast<void *>(userData));
// release memory
delete userData;