summaryrefslogtreecommitdiffstats
path: root/c++
diff options
context:
space:
mode:
Diffstat (limited to 'c++')
-rw-r--r--c++/src/H5AbstractDs.cpp2
-rw-r--r--c++/src/H5Alltypes.h2
-rw-r--r--c++/src/H5ArrayType.cpp42
-rw-r--r--c++/src/H5ArrayType.h4
-rw-r--r--c++/src/H5AtomType.cpp2
-rw-r--r--c++/src/H5Attribute.cpp67
-rw-r--r--c++/src/H5Attribute.h19
-rw-r--r--c++/src/H5CommonFG.cpp1231
-rw-r--r--c++/src/H5CommonFG.h137
-rw-r--r--c++/src/H5CompType.cpp2
-rw-r--r--c++/src/H5DataSet.cpp39
-rw-r--r--c++/src/H5DataSet.h6
-rw-r--r--c++/src/H5DataSpace.cpp11
-rw-r--r--c++/src/H5DataSpace.h4
-rw-r--r--c++/src/H5DataType.cpp25
-rw-r--r--c++/src/H5DataType.h6
-rw-r--r--c++/src/H5DcreatProp.cpp14
-rw-r--r--c++/src/H5DcreatProp.h12
-rw-r--r--c++/src/H5DxferProp.cpp17
-rw-r--r--c++/src/H5DxferProp.h12
-rw-r--r--c++/src/H5EnumType.cpp2
-rw-r--r--c++/src/H5FaccProp.cpp43
-rw-r--r--c++/src/H5FaccProp.h11
-rw-r--r--c++/src/H5File.cpp23
-rw-r--r--c++/src/H5File.h12
-rw-r--r--c++/src/H5FloatType.cpp2
-rw-r--r--c++/src/H5Group.cpp1283
-rw-r--r--c++/src/H5Group.h148
-rw-r--r--c++/src/H5IntType.cpp2
-rw-r--r--c++/src/H5Library.cpp1
-rw-r--r--c++/src/H5Location.cpp282
-rw-r--r--c++/src/H5Location.h43
-rw-r--r--c++/src/H5Object.cpp278
-rw-r--r--c++/src/H5Object.h70
-rw-r--r--c++/src/H5PredType.cpp1
-rw-r--r--c++/src/H5StrType.cpp2
-rw-r--r--c++/src/H5VarLenType.cpp2
-rw-r--r--c++/test/CMakeLists.txt7
-rw-r--r--c++/test/CMakeTests.cmake15
-rw-r--r--c++/test/h5cpputil.h15
-rw-r--r--c++/test/tattr.cpp12
-rw-r--r--c++/test/testhdf5.cpp3
-rw-r--r--c++/test/tfile.cpp69
43 files changed, 2012 insertions, 1968 deletions
diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp
index 51d5f88..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/H5Alltypes.h b/c++/src/H5Alltypes.h
index b1d792d..df7213a 100644
--- a/c++/src/H5Alltypes.h
+++ b/c++/src/H5Alltypes.h
@@ -24,6 +24,6 @@
#include "H5IntType.h"
#include "H5FloatType.h"
#include "H5StrType.h"
-#include "H5CompType.h"
#include "H5ArrayType.h"
#include "H5VarLenType.h"
+#include "H5CompType.h"
diff --git a/c++/src/H5ArrayType.cpp b/c++/src/H5ArrayType.cpp
index e11227a..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"
@@ -80,10 +80,9 @@ ArrayType::ArrayType(const DataType& base_type, int ndims, const hsize_t* dims)
///\param rhs - IN: Reference to the existing array datatype
///\return Reference to ArrayType instance
///\exception H5::DataTypeIException
-/// std::bad_alloc
// Description
// Closes the id on the lhs object first with setId, then copies
-// each data member from the rhs object.
+// each data member from the rhs object. (Issue HDFFV-9562)
// Programmer Binh-Minh Ribler - Mar 2016
// Modification
//--------------------------------------------------------------------------
@@ -120,24 +119,7 @@ int ArrayType::getArrayNDims() const
int ndims = H5Tget_array_ndims(id);
if (ndims < 0)
{
- throw DataTypeIException("ArrayType::setArrayInfo", "H5Tget_array_ndims failed");
- }
-
- return(ndims);
-}
-//---------------------------- Deprecated ----------------------------------
-// Function: ArrayType::getArrayNDims
-// This non-const version of the above method is here for compatibility
-// purposes and may be removed in the future.
-// -BMR, Apr 2016
-//--------------------------------------------------------------------------
-int ArrayType::getArrayNDims()
-{
- // Get the rank of the array type specified by id from the C API
- int ndims = H5Tget_array_ndims(id);
- if (ndims < 0)
- {
- throw DataTypeIException("ArrayType::setArrayInfo", "H5Tget_array_ndims failed");
+ throw DataTypeIException("ArrayType::getArrayNDims", "H5Tget_array_ndims failed");
}
return(ndims);
@@ -159,23 +141,7 @@ int ArrayType::getArrayDims(hsize_t* dims) const
// Get the dimensions
int ndims = H5Tget_array_dims2(id, dims);
if (ndims < 0)
- throw DataTypeIException("ArrayType::setArrayInfo", "H5Tget_array_dims2 failed");
-
- // Return the number of dimensions
- return(ndims);
-}
-//---------------------------- Deprecated ----------------------------------
-// Function: ArrayType::getArrayDims
-// This non-const version of the above method is here for compatibility
-// purposes and may be removed in the future.
-// -BMR, Apr 2016
-//--------------------------------------------------------------------------
-int ArrayType::getArrayDims(hsize_t* dims)
-{
- // Get the dimensions
- int ndims = H5Tget_array_dims2(id, dims);
- if (ndims < 0)
- throw DataTypeIException("ArrayType::setArrayInfo", "H5Tget_array_dims2 failed");
+ throw DataTypeIException("ArrayType::getArrayDims", "H5Tget_array_dims2 failed");
// Return the number of dimensions
return(ndims);
diff --git a/c++/src/H5ArrayType.h b/c++/src/H5ArrayType.h
index eee430e..fb6c711 100644
--- a/c++/src/H5ArrayType.h
+++ b/c++/src/H5ArrayType.h
@@ -36,11 +36,11 @@ class H5_DLLCPP ArrayType : public DataType {
// Returns the number of dimensions of this array datatype.
int getArrayNDims() const;
- int getArrayNDims(); // deprecated
+ //int getArrayNDims(); // removed 1.8.18 and 1.10.1
// Returns the sizes of dimensions of this array datatype.
int getArrayDims(hsize_t* dims) const;
- int getArrayDims(hsize_t* dims); // deprecated
+ //int getArrayDims(hsize_t* dims); // removed 1.8.18 and 1.10.1
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("ArrayType"); }
diff --git a/c++/src/H5AtomType.cpp b/c++/src/H5AtomType.cpp
index 90c2ae3..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 301aaf1..5454583 100644
--- a/c++/src/H5Attribute.cpp
+++ b/c++/src/H5Attribute.cpp
@@ -24,15 +24,16 @@
#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"
#include "H5File.h"
#include "H5Attribute.h"
#include "H5private.h" // for HDfree
@@ -52,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
@@ -60,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
}
@@ -73,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
}
@@ -282,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*
@@ -462,12 +446,13 @@ ssize_t Attribute::getName(H5std_string& attr_name, size_t len) const
// Programmer Binh-Minh Ribler - Nov, 2001
// Modification
// Modified to call its replacement. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07
+// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
+// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-ssize_t Attribute::getName( size_t len, H5std_string& attr_name ) const
-{
- return (getName(attr_name, len));
-}
+//ssize_t Attribute::getName( size_t len, H5std_string& attr_name ) const
+//{
+// return (getName(attr_name, len));
+//}
//--------------------------------------------------------------------------
// Function: Attribute::getStorageSize
@@ -485,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
@@ -519,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 339af54..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"
@@ -42,7 +43,7 @@
// to call the right getId() - although, as the structure of the
// library at this time, getId() is basically the IdComponent::getId()
// - when a failure returned by the C API, the functions will call
-// throwException, which is a pure virtual function and is implemented
+// throwwException, which is a pure virtual function and is implemented
// by H5File to throw a FileIException and by Group to throw a
// GroupIException.
// December 2000
@@ -52,1204 +53,6 @@ namespace H5 {
using namespace std;
#endif
-//--------------------------------------------------------------------------
-// Function: CommonFG::createGroup
-///\brief Creates a new group at this location which can be a file
-/// or another group.
-///\param name - IN: Name of the group to create
-///\param size_hint - IN: Indicates the number of bytes to reserve for
-/// the names that will appear in the group
-///\return Group instance
-///\exception H5::FileIException or H5::GroupIException
-///\par Description
-/// The optional \a size_hint specifies how much file space to
-/// reserve for storing the names that will appear in this new
-/// group. If a non-positive value is provided for the \a size_hint
-/// then a default size is chosen.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
- Group CommonFG::createGroup( const char* name, size_t size_hint ) const
-{
- // Group creation property list for size hint
- hid_t gcpl_id = 0;
-
- // Set the local heap size hint
- if (size_hint > 0)
- {
- // If the creation of the property list failed, throw an exception
- if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
- throwException("createGroup", "H5Pcreate failed");
-
- if (H5Pset_local_heap_size_hint(gcpl_id, size_hint) < 0) {
- H5Pclose(gcpl_id);
- throwException("createGroup", "H5Pset_local_heap_size_hint failed");
- }
- }
-
- // Call C routine H5Gcreate2 to create the named group, giving the
- // location id which can be a file id or a group id
- hid_t group_id = H5Gcreate2( getLocId(), name, H5P_DEFAULT, gcpl_id, H5P_DEFAULT );
-
- // Close the group creation property list, if necessary
- if(gcpl_id > 0)
- H5Pclose(gcpl_id);
-
- // If the creation of the group failed, throw an exception
- if( group_id < 0 )
- throwException("createGroup", "H5Gcreate2 failed");
-
- // No failure, create and return the Group object
- Group group;
- CommonFG *ptr = &group;
- ptr->p_setId(group_id);
- return( group );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::createGroup
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-Group CommonFG::createGroup( const H5std_string& name, size_t size_hint ) const
-{
- return( createGroup( name.c_str(), size_hint ));
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openGroup
-///\brief Opens an existing group in a location which can be a file
-/// or another group.
-///\param name - IN: Name of the group to open
-///\return Group instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-Group CommonFG::openGroup( const char* name ) const
-{
- // Call C routine H5Gopen2 to open the named group, giving the
- // location id which can be a file id or a group id
- hid_t group_id = H5Gopen2( getLocId(), name, H5P_DEFAULT );
-
- // If the opening of the group failed, throw an exception
- if( group_id < 0 )
- throwException("openGroup", "H5Gopen2 failed");
-
- // No failure, create and return the Group object
- Group group;
- CommonFG *ptr = &group;
- ptr->p_setId(group_id);
- return( group );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openGroup
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-Group CommonFG::openGroup( const H5std_string& name ) const
-{
- return( openGroup( name.c_str() ));
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::createDataSet
-///\brief Creates a new dataset at this location.
-///\param name - IN: Name of the dataset to create
-///\param data_type - IN: Datatype of the dataset
-///\param data_space - IN: Dataspace for the dataset
-///\param create_plist - IN: Creation properly list for the dataset
-///\return DataSet instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-DataSet CommonFG::createDataSet( const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist ) const
-{
- // Obtain identifiers for C API
- hid_t type_id = data_type.getId();
- hid_t space_id = data_space.getId();
- hid_t create_plist_id = create_plist.getId();
-
- // Call C routine H5Dcreate2 to create the named dataset
- hid_t dataset_id = H5Dcreate2( getLocId(), name, type_id, space_id, H5P_DEFAULT, create_plist_id, H5P_DEFAULT );
-
- // If the creation of the dataset failed, throw an exception
- if( dataset_id < 0 )
- throwException("createDataSet", "H5Dcreate2 failed");
-
- // No failure, create and return the DataSet object
- DataSet dataset;
- f_DataSet_setId(&dataset, dataset_id);
- return( dataset );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::createDataSet
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-DataSet CommonFG::createDataSet( const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist ) const
-{
- return( createDataSet( name.c_str(), data_type, data_space, create_plist ));
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openDataSet
-///\brief Opens an existing dataset at this location.
-///\param name - IN: Name of the dataset to open
-///\return DataSet instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-DataSet CommonFG::openDataSet( const char* name ) const
-{
- // Call C function H5Dopen2 to open the specified dataset, giving
- // the location id and the dataset's name
- hid_t dataset_id = H5Dopen2( getLocId(), name, H5P_DEFAULT );
-
- // If the dataset's opening failed, throw an exception
- if(dataset_id < 0)
- throwException("openDataSet", "H5Dopen2 failed");
-
- // No failure, create and return the DataSet object
- DataSet dataset;
- f_DataSet_setId(&dataset, dataset_id);
- return( dataset );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openDataSet
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-DataSet CommonFG::openDataSet( const H5std_string& name ) const
-{
- return( openDataSet( name.c_str() ));
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::link
-///\brief Creates a link of the specified type from \a new_name to
-/// \a curr_name.
-///\param link_type - IN: Link type; possible values are
-/// \li \c H5G_LINK_HARD
-/// \li \c H5G_LINK_SOFT
-///\param curr_name - IN: Name of the existing object if link is a hard
-/// link; can be anything for the soft link
-///\param new_name - IN: New name for the object
-///\exception H5::FileIException or H5::GroupIException
-///\par Description
-/// Note that both names are interpreted relative to the
-/// specified location.
-/// For information on creating hard link and soft link, please
-/// refer to the C layer Reference Manual at:
-/// http://hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-CreateHard and
-/// http://hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-CreateSoft
-// Programmer Binh-Minh Ribler - 2000
-// Modification
-// 2007: QAK modified to use H5L APIs - BMR
-//--------------------------------------------------------------------------
-void CommonFG::link( H5L_type_t link_type, const char* curr_name, const char* new_name ) const
-{
- herr_t ret_value = -1;
-
- switch(link_type) {
- case H5L_TYPE_HARD:
- ret_value = H5Lcreate_hard( getLocId(), curr_name, H5L_SAME_LOC, new_name, H5P_DEFAULT, H5P_DEFAULT );
- break;
-
- case H5L_TYPE_SOFT:
- ret_value = H5Lcreate_soft( curr_name, getLocId(), new_name, H5P_DEFAULT, H5P_DEFAULT );
- break;
-
- case H5L_TYPE_ERROR:
- case H5L_TYPE_EXTERNAL:
- case H5L_TYPE_MAX:
- default:
- throwException("link", "unknown link type");
- break;
- } /* end switch */
-
- if( ret_value < 0 )
- throwException("link", "creating link failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::link
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a curr_name and \a new_name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void CommonFG::link( H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name ) const
-{
- link( link_type, curr_name.c_str(), new_name.c_str() );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::unlink
-///\brief Removes the specified name at this location.
-///\param name - IN: Name of the object to be removed
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-// Modification
-// 2007: QAK modified to use H5L APIs - BMR
-//--------------------------------------------------------------------------
-void CommonFG::unlink( const char* name ) const
-{
- herr_t ret_value = H5Ldelete( getLocId(), name, H5P_DEFAULT );
- if( ret_value < 0 )
- throwException("unlink", "H5Ldelete failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::unlink
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void CommonFG::unlink( const H5std_string& name ) const
-{
- unlink( name.c_str() );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::move
-///\brief Renames an object at this location.
-///\param src - IN: Object's original name
-///\param dst - IN: Object's new name
-///\exception H5::FileIException or H5::GroupIException
-///\note
-/// Exercise care in moving groups as it is possible to render
-/// data in a file inaccessible with Group::move. Please refer
-/// to the Group Interface in the HDF5 User's Guide for details at:
-/// https://www.hdfgroup.org/HDF5/doc/UG/HDF5_Users_Guide-Responsive%20HTML5/index.html#t=HDF5_Users_Guide%2FGroups%2FHDF5_Groups.htm
-// Programmer Binh-Minh Ribler - 2000
-// Modification
-// 2007: QAK modified to use H5L APIs - BMR
-//--------------------------------------------------------------------------
-void CommonFG::move( const char* src, const char* dst ) const
-{
- herr_t ret_value = H5Lmove( getLocId(), src, H5L_SAME_LOC, dst, H5P_DEFAULT, H5P_DEFAULT );
- if( ret_value < 0 )
- throwException("move", "H5Lmove failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::move
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a src and \a dst.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void CommonFG::move( const H5std_string& src, const H5std_string& dst ) const
-{
- move( src.c_str(), dst.c_str() );
-}
-
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-//--------------------------------------------------------------------------
-// Function: CommonFG::getObjinfo
-///\brief Returns information about an object.
-///\param name - IN: Name of the object
-///\param follow_link - IN: Link flag
-///\param statbuf - OUT: Buffer to return information about the object
-///\exception H5::FileIException or H5::GroupIException
-///\par Description
-/// For more information, please refer to the C layer Reference
-/// Manual at:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5G.html#Group-GetObjinfo
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void CommonFG::getObjinfo( const char* name, hbool_t follow_link, H5G_stat_t& statbuf ) const
-{
- herr_t ret_value = H5Gget_objinfo( getLocId(), name, follow_link, &statbuf );
- if( ret_value < 0 )
- throwException("getObjinfo", "H5Gget_objinfo failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::getObjinfo
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void CommonFG::getObjinfo( const H5std_string& name, hbool_t follow_link, H5G_stat_t& statbuf ) const
-{
- getObjinfo( name.c_str(), follow_link, statbuf );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::getObjinfo
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above functions in that it doesn't have
-/// the paramemter \a follow_link.
-// Programmer Binh-Minh Ribler - Nov, 2005
-// Note: need to modify to use H5Oget_info and H5Lget_info - BMR
-//--------------------------------------------------------------------------
-void CommonFG::getObjinfo( const char* name, H5G_stat_t& statbuf ) const
-{
- herr_t ret_value = H5Gget_objinfo( getLocId(), name, 0, &statbuf );
- if( ret_value < 0 )
- throwException("getObjinfo", "H5Gget_objinfo failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::getObjinfo
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - Nov, 2005
-//--------------------------------------------------------------------------
-void CommonFG::getObjinfo( const H5std_string& name, H5G_stat_t& statbuf ) const
-{
- getObjinfo( name.c_str(), statbuf );
-}
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::getLinkval
-///\brief Returns the name of the object that the symbolic link points to.
-///\param name - IN: Symbolic link to the object
-///\param size - IN: Maximum number of characters of value to be returned
-///\return Name of the object
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-H5std_string CommonFG::getLinkval( const char* name, size_t size ) const
-{
- H5L_info_t linkinfo;
- char *value_C; // value in C string
- size_t val_size = size;
- H5std_string value = "";
- herr_t ret_value;
-
- // if user doesn't provide buffer size, determine it
- if (size == 0)
- {
- ret_value = H5Lget_info(getLocId(), name, &linkinfo, H5P_DEFAULT);
- if( ret_value < 0 )
- throwException("getLinkval", "H5Lget_info to find buffer size failed");
-
- val_size = linkinfo.u.val_size;
- }
-
- // if link has value, retrieve the value, otherwise, return null string
- if (val_size > 0)
- {
- value_C = new char[val_size+1]; // temporary C-string for C API
- HDmemset(value_C, 0, val_size+1); // clear buffer
-
- ret_value = H5Lget_val(getLocId(), name, value_C, val_size, H5P_DEFAULT);
- if( ret_value < 0 )
- {
- delete []value_C;
- throwException("getLinkval", "H5Lget_val failed");
- }
-
- value = H5std_string(value_C);
- delete []value_C;
- }
- return(value);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::getLinkval
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-H5std_string CommonFG::getLinkval( const H5std_string& name, size_t size ) const
-{
- return( getLinkval( name.c_str(), size ));
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::mount
-///\brief Mounts the file \a child onto this group.
-///\param name - IN: Name of the group
-///\param child - IN: File to mount
-///\param plist - IN: Property list to use
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2014 (original 2000)
-//--------------------------------------------------------------------------
-void CommonFG::mount(const char* name, const H5File& child, const PropList& plist ) const
-{
- // Obtain identifiers for C API
- hid_t plist_id = plist.getId();
- hid_t child_id = child.getId();
-
- // Call C routine H5Fmount to do the mouting
- herr_t ret_value = H5Fmount( getLocId(), name, child_id, plist_id );
-
- // Raise exception if H5Fmount returns negative value
- if( ret_value < 0 )
- throwException("mount", "H5Fmount failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::mount
-// Purpose This is an overloaded member function, kept for backward
-// compatibility. It differs from the above function in that it
-// misses const's. This wrapper will be removed in future release.
-// Param name - IN: Name of the group
-// Param child - IN: File to mount
-// Param plist - IN: Property list to use
-// Exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-// Modification
-// Modified to call its replacement. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07
-//--------------------------------------------------------------------------
-void CommonFG::mount(const char* name, H5File& child, PropList& plist) const
-{
- mount(name, child, plist);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::mount
-///\brief This is an overloaded member function, provided for convenience.
-/// It takes an \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void CommonFG::mount(const H5std_string& name, const H5File& child, const PropList& plist) const
-{
- mount(name.c_str(), child, plist);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::mount
-// Purpose This is an overloaded member function, kept for backward
-// compatibility. It differs from the above function in that it
-// misses const's. This wrapper will be removed in future release.
-// Programmer Binh-Minh Ribler - 2014
-// Modification
-// Modified to call its replacement. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07
-//--------------------------------------------------------------------------
-void CommonFG::mount(const H5std_string& name, H5File& child, PropList& plist) const
-{
- mount(name.c_str(), child, plist);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::unmount
-///\brief Unmounts the specified file.
-///\param name - IN: Name of the file to unmount
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void CommonFG::unmount( const char* name ) const
-{
- // Call C routine H5Fmount to do the mouting
- herr_t ret_value = H5Funmount( getLocId(), name );
-
- // Raise exception if H5Funmount returns negative value
- if( ret_value < 0 )
- throwException("unmount", "H5Funmount failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::unmount
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void CommonFG::unmount( const H5std_string& name ) const
-{
- unmount( name.c_str() );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openDataType
-///\brief Opens the named generic datatype at this location.
-///\param name - IN: Name of the datatype to open
-///\return DataType instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-DataType CommonFG::openDataType( const char* name ) const
-{
- // Call C function H5Topen2 to open the named datatype in this group,
- // given either the file or group id
- hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
-
- // If the datatype's opening failed, throw an exception
- if( type_id < 0 )
- throwException("openDataType", "H5Topen2 failed");
-
- // No failure, create and return the DataType object
- DataType data_type;
- f_DataType_setId(&data_type, type_id);
- return(data_type);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openDataType
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-DataType CommonFG::openDataType( const H5std_string& name ) const
-{
- return( openDataType( name.c_str()) );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openArrayType
-///\brief Opens the named array datatype at this location.
-///\param name - IN: Name of the array datatype to open
-///\return ArrayType instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - Jul, 2005
-//--------------------------------------------------------------------------
-ArrayType CommonFG::openArrayType( const char* name ) const
-{
- // Call C function H5Topen2 to open the named datatype in this group,
- // given either the file or group id
- hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
-
- // If the datatype's opening failed, throw an exception
- if( type_id < 0 )
- throwException("openArrayType", "H5Topen2 failed");
-
- // No failure, create and return the ArrayType object
- ArrayType array_type;
- f_DataType_setId(&array_type, type_id);
- return(array_type);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openArrayType
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - Jul, 2005
-//--------------------------------------------------------------------------
-ArrayType CommonFG::openArrayType( const H5std_string& name ) const
-{
- return( openArrayType( name.c_str()) );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openCompType
-///\brief Opens the named compound datatype at this location.
-///\param name - IN: Name of the compound datatype to open
-///\return CompType instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-CompType CommonFG::openCompType( const char* name ) const
-{
- // Call C function H5Topen2 to open the named datatype in this group,
- // given either the file or group id
- hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
-
- // If the datatype's opening failed, throw an exception
- if( type_id < 0 )
- throwException("openCompType", "H5Topen2 failed");
-
- // No failure, create and return the CompType object
- CompType comp_type;
- f_DataType_setId(&comp_type, type_id);
- return(comp_type);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openCompType
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-CompType CommonFG::openCompType( const H5std_string& name ) const
-{
- return( openCompType( name.c_str()) );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openEnumType
-///\brief Opens the named enumeration datatype at this location.
-///\param name - IN: Name of the enumeration datatype to open
-///\return EnumType instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-EnumType CommonFG::openEnumType( const char* name ) const
-{
- // Call C function H5Topen2 to open the named datatype in this group,
- // given either the file or group id
- hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
-
- // If the datatype's opening failed, throw an exception
- if( type_id < 0 )
- throwException("openEnumType", "H5Topen2 failed");
-
- // No failure, create and return the EnumType object
- EnumType enum_type;
- f_DataType_setId(&enum_type, type_id);
- return(enum_type);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openEnumType
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-EnumType CommonFG::openEnumType( const H5std_string& name ) const
-{
- return( openEnumType( name.c_str()) );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openIntType
-///\brief Opens the named integer datatype at this location.
-///\param name - IN: Name of the integer datatype to open
-///\return IntType instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-IntType CommonFG::openIntType( const char* name ) const
-{
- // Call C function H5Topen2 to open the named datatype in this group,
- // given either the file or group id
- hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
-
- // If the datatype's opening failed, throw an exception
- if( type_id < 0 )
- throwException("openIntType", "H5Topen2 failed");
-
- // No failure, create and return the IntType object
- IntType int_type;
- f_DataType_setId(&int_type, type_id);
- return(int_type);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openIntType
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-IntType CommonFG::openIntType( const H5std_string& name ) const
-{
- return( openIntType( name.c_str()) );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openFloatType
-///\brief Opens the named floating-point datatype at this location.
-///\param name - IN: Name of the floating-point datatype to open
-///\return FloatType instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-FloatType CommonFG::openFloatType( const char* name ) const
-{
- // Call C function H5Topen2 to open the named datatype in this group,
- // given either the file or group id
- hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
-
- // If the datatype's opening failed, throw an exception
- if( type_id < 0 )
- throwException("openFloatType", "H5Topen2 failed");
-
- // No failure, create and return the FloatType object
- FloatType float_type;
- f_DataType_setId(&float_type, type_id);
- return(float_type);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openFloatType
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-FloatType CommonFG::openFloatType( const H5std_string& name ) const
-{
- return( openFloatType( name.c_str()) );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openStrType
-///\brief Opens the named string datatype at this location.
-///\param name - IN: Name of the string datatype to open
-///\return StrType instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-StrType CommonFG::openStrType( const char* name ) const
-{
- // Call C function H5Topen2 to open the named datatype in this group,
- // given either the file or group id
- hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
-
- // If the datatype's opening failed, throw an exception
- if( type_id < 0 )
- throwException("openStrType", "H5Topen2 failed");
-
- // No failure, create and return the StrType object
- StrType str_type;
- f_DataType_setId(&str_type, type_id);
- return(str_type);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openStrType
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-StrType CommonFG::openStrType( const H5std_string& name ) const
-{
- return( openStrType( name.c_str()) );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openVarLenType
-///\brief Opens the named variable length datatype at this location.
-///\param name - IN: Name of the variable length datatype to open
-///\return VarLenType instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - Jul, 2005
-//--------------------------------------------------------------------------
-VarLenType CommonFG::openVarLenType( const char* name ) const
-{
- // Call C function H5Topen2 to open the named datatype in this group,
- // given either the file or group id
- hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
-
- // If the datatype's opening failed, throw an exception
- if( type_id < 0 )
- throwException("openVarLenType", "H5Topen2 failed");
-
- // No failure, create and return the VarLenType object
- VarLenType varlen_type;
- f_DataType_setId(&varlen_type, type_id);
- return(varlen_type);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::openVarLenType
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - Jul, 2005
-//--------------------------------------------------------------------------
-VarLenType CommonFG::openVarLenType( const H5std_string& name ) const
-{
- return( openVarLenType( name.c_str()) );
-}
-
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-//--------------------------------------------------------------------------
-// Function: CommonFG::iterateElems
-///\brief Iterates a user's function over the entries of a group.
-///\param name - IN : Name of group to iterate over
-///\param idx - IN/OUT: Starting (IN) and ending (OUT) entry indices
-///\param op - IN : User's function to operate on each entry
-///\param op_data - IN/OUT: Data associated with the operation
-///\return The return value of the first operator that returns non-zero,
-/// or zero if all members were processed with no operator
-/// returning non-zero.
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-int CommonFG::iterateElems( const char* name, int *idx, H5G_iterate_t op , void* op_data )
-{
- int ret_value = H5Giterate( getLocId(), name, idx, op, op_data );
- if( ret_value < 0 )
- {
- throwException("iterateElems", "H5Giterate failed");
- }
- return( ret_value );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::iterateElems
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-int CommonFG::iterateElems( const H5std_string& name, int *idx, H5G_iterate_t op , void* op_data )
-{
- return( iterateElems( name.c_str(), idx, op, op_data ));
-}
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::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 CommonFG::getNumObjs() const
-{
- H5G_info_t ginfo; /* Group information */
-
- herr_t ret_value = H5Gget_info(getLocId(), &ginfo);
- if(ret_value < 0)
- throwException("getNumObjs", "H5Gget_info failed");
- return (ginfo.nlinks);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::getObjnameByIdx
-///\brief Returns the name of an object in this group, given the
-/// object's index.
-///\param idx - IN: Transient index of the object
-///\return Object name
-///\exception H5::FileIException or H5::GroupIException
-///\par Description
-/// The value of idx can be any nonnegative number less than the
-/// total number of objects in the group, which is returned by
-/// the function \c CommonFG::getNumObjs. Note that this is a
-/// transient index; thus, an object may have a different index
-/// each time the group is opened.
-// Programmer Binh-Minh Ribler - Mar, 2005
-//--------------------------------------------------------------------------
-H5std_string CommonFG::getObjnameByIdx(hsize_t idx) const
-{
- // call H5Lget_name_by_idx with name as NULL to get its length
- ssize_t name_len = H5Lget_name_by_idx(getLocId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, NULL, 0, H5P_DEFAULT);
- if(name_len < 0)
- throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
-
- // now, allocate C buffer to get the name
- char* name_C = new char[name_len+1];
- HDmemset(name_C, 0, name_len+1); // clear buffer
-
- name_len = H5Lget_name_by_idx(getLocId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name_C, name_len+1, H5P_DEFAULT);
-
- if (name_len < 0)
- {
- delete []name_C;
- throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
- }
-
- // clean up and return the string
- H5std_string name = H5std_string(name_C);
- delete []name_C;
- return (name);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::getObjnameByIdx
-///\brief Retrieves the name of an object in this group, given the
-/// object's index.
-///\param idx - IN: Transient index of the object
-///\param name - IN/OUT: Retrieved name of the object
-///\param size - IN: Length to retrieve
-///\return Actual size of the object name or 0, if object has no name
-///\exception H5::FileIException or H5::GroupIException
-///\par Description
-/// The value of idx can be any nonnegative number less than the
-/// total number of objects in the group, which is returned by
-/// the function \c CommonFG::getNumObjs. Note that this is a
-/// transient index; thus, an object may have a different index
-/// each time the group is opened.
-// Programmer Binh-Minh Ribler - January, 2003
-//--------------------------------------------------------------------------
-ssize_t CommonFG::getObjnameByIdx(hsize_t idx, char* name, size_t size) const
-{
- ssize_t name_len = H5Lget_name_by_idx(getLocId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name, size, H5P_DEFAULT);
- if(name_len < 0)
- throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
-
- return (name_len);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::getObjnameByIdx
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - January, 2003
-//--------------------------------------------------------------------------
-ssize_t CommonFG::getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const
-{
- char* name_C = new char[size+1]; // temporary C-string for object name
- HDmemset(name_C, 0, size+1); // clear buffer
-
- // call overloaded function to get the name
- ssize_t name_len = getObjnameByIdx(idx, name_C, size+1);
- if(name_len < 0)
- {
- delete []name_C;
- throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
- }
-
- // clean up and return the string
- name = H5std_string(name_C);
- delete []name_C;
- return (name_len);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::childObjType
-///\brief Returns the type of an object in this file/group, given the
-/// object's name.
-///\param objname - IN: Name of the object
-///\return Object type, which can have the following values for group,
-/// dataset, and named datatype
-/// \li \c H5O_TYPE_GROUP
-/// \li \c H5O_TYPE_DATASET
-/// \li \c H5O_TYPE_NAMED_DATATYPE
-/// Refer to the C API documentation for more details:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfo
-///\exception H5::FileIException or H5::GroupIException
-/// Exception will be thrown when:
-/// - an error returned by the C API
-/// - object type is not one of the valid values above
-// Programmer Binh-Minh Ribler - April, 2014
-//--------------------------------------------------------------------------
-H5O_type_t CommonFG::childObjType(const char* objname) const
-{
- H5O_info_t objinfo;
- H5O_type_t objtype = H5O_TYPE_UNKNOWN;
-
- // Use C API to get information of the object
- herr_t ret_value = H5Oget_info_by_name(getLocId(), objname, &objinfo, H5P_DEFAULT);
-
- // Throw exception if C API returns failure
- if (ret_value < 0)
- throwException("childObjType", "H5Oget_info_by_name failed");
- // Return a valid type or throw an exception for unknown type
- else
- switch (objinfo.type)
- {
- case H5O_TYPE_GROUP:
- case H5O_TYPE_DATASET:
- case H5O_TYPE_NAMED_DATATYPE:
- objtype = objinfo.type;
- break;
- case H5O_TYPE_UNKNOWN:
- case H5O_TYPE_NTYPES:
- default:
- throwException("childObjType", "Unknown type of object");
- }
- return(objtype);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::childObjType
-///\brief This is an overloaded member function, provided for convenience.
-/// It takes an \a H5std_string for the object's name.
-///\brief Returns the type of an object in this group, given the
-/// object's name.
-///\param objname - IN: Name of the object (H5std_string&)
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - April, 2014
-//--------------------------------------------------------------------------
-H5O_type_t CommonFG::childObjType(const H5std_string& objname) const
-{
- // Use overloaded function
- H5O_type_t objtype = childObjType(objname.c_str());
- return(objtype);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::childObjType
-///\brief Returns the type of an object in this file/group, given the
-/// object's index and its type and order.
-///\param index - IN: Position of the object
-///\param index_type - IN: Type of the index, default to H5_INDEX_NAME
-///\param order - IN: Traversing order, default to H5_ITER_INC
-///\param objname - IN: Name of the object, default to "."
-///\return Object type, which can have the following values for group,
-/// dataset, and named datatype
-/// \li \c H5O_TYPE_GROUP
-/// \li \c H5O_TYPE_DATASET
-/// \li \c H5O_TYPE_NAMED_DATATYPE
-/// Refer to the C API documentation for more details:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfo
-///\exception H5::FileIException or H5::GroupIException
-/// Exception will be thrown when:
-/// - an error returned by the C API
-/// - object type is not one of the valid values above
-// Developer's Notes:
-// - this overload uses H5Oget_info_by_idx instead of H5Oget_info_by_name
-// like the previous childObjType()
-// - index is the required argument so, first
-// - objname is last because it's more likely the location is already
-// fully specified
-// - Leave property list out for now because C API is not using it, it
-// can be added later when needed.
-// Programmer Binh-Minh Ribler - April, 2014
-//--------------------------------------------------------------------------
-H5O_type_t CommonFG::childObjType(hsize_t index, H5_index_t index_type, H5_iter_order_t order, const char* objname) const
-{
- herr_t ret_value;
- H5O_info_t objinfo;
- H5O_type_t objtype = H5O_TYPE_UNKNOWN;
-
- // Use C API to get information of the object
- ret_value = H5Oget_info_by_idx(getLocId(), objname, index_type, order, index, &objinfo, H5P_DEFAULT);
-
- // Throw exception if C API returns failure
- if (ret_value < 0)
- throwException("childObjType", "H5Oget_info_by_idx failed");
- // Return a valid type or throw an exception for unknown type
- else
- switch (objinfo.type)
- {
- case H5O_TYPE_GROUP:
- case H5O_TYPE_DATASET:
- case H5O_TYPE_NAMED_DATATYPE:
- objtype = objinfo.type;
- break;
- case H5O_TYPE_UNKNOWN:
- case H5O_TYPE_NTYPES:
- default:
- throwException("childObjType", "Unknown type of object");
- }
- return(objtype);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::childObjVersion
-///\brief Returns the object header version of an object in this file/group,
-/// given the object's name.
-///\param objname - IN: Name of the object
-///\return Object version, which can have the following values:
-/// \li \c H5O_VERSION_1
-/// \li \c H5O_VERSION_2
-///\exception H5::FileIException or H5::GroupIException
-/// 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 - April, 2014
-//--------------------------------------------------------------------------
-unsigned CommonFG::childObjVersion(const char* objname) const
-{
- H5O_info_t objinfo;
- unsigned version = 0;
-
- // Use C API to get information of the object
- herr_t ret_value = H5Oget_info_by_name(getLocId(), objname, &objinfo, H5P_DEFAULT);
-
- // Throw exception if C API returns failure
- if (ret_value < 0)
- throwException("childObjVersion", "H5Oget_info_by_name 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)
- throwException("childObjVersion", "Invalid version for object");
- }
- return(version);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::childObjVersion
-///\brief This is an overloaded member function, provided for convenience.
-/// It takes an \a H5std_string for the object's name.
-///\brief Returns the type of an object in this group, given the
-/// object's name.
-///\param objname - IN: Name of the object (H5std_string&)
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - April, 2014
-//--------------------------------------------------------------------------
-unsigned CommonFG::childObjVersion(const H5std_string& objname) const
-{
- // Use overloaded function
- unsigned version = childObjVersion(objname.c_str());
- return(version);
-}
-
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-//--------------------------------------------------------------------------
-// Function: CommonFG::getObjTypeByIdx
-///\brief Returns the type of an object in this group, given the
-/// object's index.
-///\param idx - IN: Transient index of the object
-///\return Object type
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - January, 2003
-//--------------------------------------------------------------------------
-H5G_obj_t CommonFG::getObjTypeByIdx(hsize_t idx) const
-{
- H5G_obj_t obj_type = H5Gget_objtype_by_idx(getLocId(), idx);
- if (obj_type == H5G_UNKNOWN)
- throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed");
-
- return (obj_type);
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::getObjTypeByIdx
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function because it also provides
-/// the returned object type in text (char*)
-///\param idx - IN: Transient index of the object
-///\param type_name - OUT: Object type in text
-///\return Object type
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - May, 2010
-// Modification
-// Modified to use the other function. -BMR, 2016/03/07
-//--------------------------------------------------------------------------
-H5G_obj_t CommonFG::getObjTypeByIdx(hsize_t idx, char* type_name) const
-{
- H5std_string stype_name(type_name);
- return(getObjTypeByIdx(idx, stype_name));
-}
-//--------------------------------------------------------------------------
-// Function: CommonFG::getObjTypeByIdx
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function because it also provides
-/// the returned object type in text (H5std_string&)
-///\param idx - IN: Transient index of the object
-///\param type_name - OUT: Object type in text
-///\return Object type
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - January, 2003
-//--------------------------------------------------------------------------
-H5G_obj_t CommonFG::getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const
-{
- H5G_obj_t obj_type = H5Gget_objtype_by_idx(getLocId(), idx);
- switch (obj_type)
- {
- case H5G_LINK: type_name = H5std_string("symbolic link"); break;
- case H5G_GROUP: type_name = H5std_string("group"); break;
- case H5G_DATASET: type_name = H5std_string("dataset"); break;
- case H5G_TYPE: type_name = H5std_string("datatype"); break;
- case H5G_UNKNOWN:
- case H5G_UDLINK:
- case H5G_RESERVED_5:
- case H5G_RESERVED_6:
- case H5G_RESERVED_7:
- default:
- throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed");
- }
- return (obj_type);
-}
-
-#endif // DOXYGEN_SHOULD_SKIP_THIS
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
// Function: CommonFG default constructor
@@ -1265,36 +68,6 @@ CommonFG::CommonFG() {}
//--------------------------------------------------------------------------
CommonFG::~CommonFG() {}
-//--------------------------------------------------------------------------
-// Function: f_DataType_setId - friend
-// Purpose: This function is friend to class H5::DataType so that it
-// can set DataType::id in order to work around a problem
-// described in the JIRA issue HDFFV-7947.
-// Applications shouldn't need to use it.
-// param dtype - IN/OUT: DataType object to be changed
-// param new_id - IN: New id to set
-// Programmer Binh-Minh Ribler - 2015
-//--------------------------------------------------------------------------
-void f_DataType_setId(DataType* dtype, hid_t new_id)
-{
- dtype->p_setId(new_id);
-}
-
-//--------------------------------------------------------------------------
-// Function: f_DataSet_setId - friend
-// Purpose: This function is friend to class H5::DataSet so that it
-// can set DataSet::id in order to work around a problem
-// described in the JIRA issue HDFFV-7947.
-// Applications shouldn't need to use it.
-// param dset - IN/OUT: DataSet object to be changed
-// param new_id - IN: New id to set
-// Programmer Binh-Minh Ribler - 2015
-//--------------------------------------------------------------------------
-void f_DataSet_setId(DataSet* dset, hid_t new_id)
-{
- dset->p_setId(new_id);
-}
-
#endif // DOXYGEN_SHOULD_SKIP_THIS
#ifndef H5_NO_NAMESPACE
diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h
index d36d78c..956be21 100644
--- a/c++/src/H5CommonFG.h
+++ b/c++/src/H5CommonFG.h
@@ -21,145 +21,16 @@
namespace H5 {
#endif
-// Class forwarding
-class Group;
-class H5File;
-class ArrayType;
-class VarLenType;
-
/*! \class CommonFG
- \brief \a CommonFG is an abstract base class of H5File and H5Group.
+ \brief \a CommonFG was an abstract base class of H5File and H5Group.
- It provides common operations of H5File and H5Group.
+ It provided common operations of H5File and H5Group.
+ In release 1.10.1, the class structure is modified.
+ As a result, member functions of CommonFG are moved to Group.
*/
class H5_DLLCPP CommonFG {
public:
- // Creates a new group at this location which can be a file
- // or another group.
- Group createGroup(const char* name, size_t size_hint = 0) const;
- Group createGroup(const H5std_string& name, size_t size_hint = 0) const;
-
- // Opens an existing group in a location which can be a file
- // or another group.
- Group openGroup(const char* name) const;
- Group openGroup(const H5std_string& name) const;
-
- // Creates a new dataset at this location.
- DataSet createDataSet(const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const;
- DataSet createDataSet(const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const;
-
- // Opens an existing dataset at this location.
- DataSet openDataSet(const char* name) const;
- DataSet openDataSet(const H5std_string& name) const;
-
- // Returns the value of a symbolic link.
- 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;
- ssize_t getObjnameByIdx(hsize_t idx, char* name, size_t size) const;
- ssize_t getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const;
-
- // Retrieves the type of an object in this file or group, given the
- // object's name
- H5O_type_t childObjType(const H5std_string& objname) const;
- H5O_type_t childObjType(const char* objname) const;
- H5O_type_t childObjType(hsize_t index, H5_index_t index_type=H5_INDEX_NAME, H5_iter_order_t order=H5_ITER_INC, const char* objname=".") const;
-
- // Returns the object header version of an object in this file or group,
- // given the object's name.
- unsigned childObjVersion(const char* objname) const;
- unsigned childObjVersion(const H5std_string& objname) const;
-
-#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Returns the type of an object in this group, given the
- // object's index.
- H5G_obj_t getObjTypeByIdx(hsize_t idx) const;
- H5G_obj_t getObjTypeByIdx(hsize_t idx, char* type_name) const;
- H5G_obj_t getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const;
-
- // Returns information about an HDF5 object, given by its name,
- // at this location.
- void getObjinfo(const char* name, hbool_t follow_link, H5G_stat_t& statbuf) const;
- void getObjinfo(const H5std_string& name, hbool_t follow_link, H5G_stat_t& statbuf) const;
- void getObjinfo(const char* name, H5G_stat_t& statbuf) const;
- void getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const;
-
- // Iterates over the elements of this group - not implemented in
- // C++ style yet.
- int iterateElems(const char* name, int *idx, H5G_iterate_t op, void *op_data);
- int iterateElems(const H5std_string& name, int *idx, H5G_iterate_t op, void *op_data);
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
- // Creates a link of the specified type from new_name to current_name;
- // both names are interpreted relative to the specified location id.
- void link(H5L_type_t link_type, const char* curr_name, const char* new_name) const;
- void link(H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name) const;
-
- // Removes the specified name at this location.
- void unlink(const char* name) const;
- void unlink(const H5std_string& name) const;
-
- // Mounts the file 'child' onto this location.
- void mount(const char* name, const H5File& child, const PropList& plist) const;
- void mount(const char* name, H5File& child, PropList& plist) const; // backward compatibility
- void mount(const H5std_string& name, const H5File& child, const PropList& plist) const;
- void mount(const H5std_string& name, H5File& child, PropList& plist) const; // backward compatibility
-
- // Unmounts the file named 'name' from this parent location.
- void unmount(const char* name) const;
- void unmount(const H5std_string& name) const;
-
- // Renames an object at this location.
- void move(const char* src, const char* dst) const;
- void move(const H5std_string& src, const H5std_string& dst) const;
-
- // Opens a generic named datatype in this location.
- DataType openDataType(const char* name) const;
- DataType openDataType(const H5std_string& name) const;
-
- // Opens a named array datatype in this location.
- ArrayType openArrayType(const char* name) const;
- ArrayType openArrayType(const H5std_string& name) const;
-
- // Opens a named compound datatype in this location.
- CompType openCompType(const char* name) const;
- CompType openCompType(const H5std_string& name) const;
-
- // Opens a named enumeration datatype in this location.
- EnumType openEnumType(const char* name) const;
- EnumType openEnumType(const H5std_string& name) const;
-
- // Opens a named integer datatype in this location.
- IntType openIntType(const char* name) const;
- IntType openIntType(const H5std_string& name) const;
-
- // Opens a named floating-point datatype in this location.
- FloatType openFloatType(const char* name) const;
- FloatType openFloatType(const H5std_string& name) const;
-
- // Opens a named string datatype in this location.
- StrType openStrType(const char* name) const;
- StrType openStrType(const H5std_string& name) const;
-
- // Opens a named variable length datatype in this location.
- VarLenType openVarLenType(const char* name) const;
- VarLenType openVarLenType(const H5std_string& name) const;
-
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- /// For subclasses, H5File and Group, to return the correct
- /// object id, i.e. file or group id.
- virtual hid_t getLocId() const = 0;
-
-
- /// For subclasses, H5File and Group, to throw appropriate exception.
- virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const = 0;
-
// Default constructor.
CommonFG();
diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp
index 4585516..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 8f5ad6f..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,10 +32,10 @@
#include "H5DcreatProp.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
-#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5DataSpace.h"
#include "H5AbstractDs.h"
+#include "H5Group.h"
#include "H5File.h"
#include "H5Attribute.h"
#include "H5DataSet.h"
@@ -301,6 +302,8 @@ void DataSet::getSpaceStatus(H5D_space_status_t& status) const
//--------------------------------------------------------------------------
// Function: DataSet::getVlenBufSize
///\brief Returns the number of bytes required to store VL data.
+///\param type - IN: Datatype, which is the datatype for the buffer
+///\param space - IN: Selection for the memory buffer
///\return Amount of storage
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
@@ -331,12 +334,13 @@ hsize_t DataSet::getVlenBufSize(const DataType& type, const DataSpace& space ) c
// Programmer Binh-Minh Ribler - 2000
// Modification
// Modified to call its replacement. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07
+// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
+// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-hsize_t DataSet::getVlenBufSize( DataType& type, DataSpace& space ) const
-{
- return(getVlenBufSize(type, space));
-}
+//hsize_t DataSet::getVlenBufSize( DataType& type, DataSpace& space ) const
+//{
+// return(getVlenBufSize(type, space));
+//}
//--------------------------------------------------------------------------
// Function: DataSet::vlenReclaim
@@ -605,7 +609,6 @@ void DataSet::extend( const hsize_t* size ) const
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2014
// Modification
-// Used the non-const version.
//--------------------------------------------------------------------------
void DataSet::fillMemBuf(const void *fill, const DataType& fill_type, void *buf, const DataType& buf_type, const DataSpace& space) const
{
@@ -633,12 +636,13 @@ void DataSet::fillMemBuf(const void *fill, const DataType& fill_type, void *buf,
// Programmer Binh-Minh Ribler - 2000
// Modification
// Modified to call its replacement. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07
+// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
+// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-void DataSet::fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space)
-{
- fillMemBuf(fill, (const DataType)fill_type, buf, (const DataType)buf_type, (const DataSpace)space);
-}
+//void DataSet::fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space)
+//{
+// fillMemBuf(fill, (const DataType)fill_type, buf, (const DataType)buf_type, (const DataSpace)space);
+//}
//--------------------------------------------------------------------------
// Function: DataSet::fillMemBuf
@@ -672,12 +676,13 @@ void DataSet::fillMemBuf(void *buf, const DataType& buf_type, const DataSpace& s
// Programmer Binh-Minh Ribler - 2000
// Modification
// Modified to call its replacement. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07
+// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
+// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space)
-{
- fillMemBuf(buf, (const DataType)buf_type, (const DataSpace)space);
-}
+//void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space)
+//{
+// fillMemBuf(buf, (const DataType)buf_type, (const DataSpace)space);
+//}
//--------------------------------------------------------------------------
// Function: DataSet::getId
diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h
index b2544a2..c97e5b0 100644
--- a/c++/src/H5DataSet.h
+++ b/c++/src/H5DataSet.h
@@ -39,11 +39,11 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
// Fills a selection in memory with a value
void fillMemBuf(const void *fill, const DataType& fill_type, void *buf, const DataType& buf_type, const DataSpace& space) const;
- void fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space); // kept for backward compatibility
+ //void fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space); // removed from 1.8.18 and 1.10.1
// Fills a selection in memory with zero
void fillMemBuf(void *buf, const DataType& buf_type, const DataSpace& space) const;
- void fillMemBuf(void *buf, DataType& buf_type, DataSpace& space); // kept for backward compatibility
+ //void fillMemBuf(void *buf, DataType& buf_type, DataSpace& space); // removed from 1.8.18 and 1.10.1
// Gets the creation property list of this dataset.
DSetCreatPropList getCreatePlist() const;
@@ -65,7 +65,7 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
// Returns the number of bytes required to store VL data.
hsize_t getVlenBufSize(const DataType& type, const DataSpace& space ) const;
- hsize_t getVlenBufSize(DataType& type, DataSpace& space) const; // kept for backward compatibility
+ //hsize_t getVlenBufSize(DataType& type, DataSpace& space) const; // removed from 1.8.18 and 1.10.1
// Reclaims VL datatype memory buffers.
static void vlenReclaim(const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist, void* buf );
diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp
index 7b6289c..b24e94f 100644
--- a/c++/src/H5DataSpace.cpp
+++ b/c++/src/H5DataSpace.cpp
@@ -348,12 +348,13 @@ void DataSpace::extentCopy (const DataSpace& dest_space) const
// Programmer Binh-Minh Ribler - 2000
// Modification
// Modified to call its replacement. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07
+// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
+// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-void DataSpace::extentCopy( DataSpace& dest_space ) const
-{
- extentCopy(dest_space);
-}
+//void DataSpace::extentCopy( DataSpace& dest_space ) const
+//{
+// extentCopy(dest_space);
+//}
//--------------------------------------------------------------------------
// Function: DataSpace::setExtentSimple
diff --git a/c++/src/H5DataSpace.h b/c++/src/H5DataSpace.h
index 4cbe62c..384f1a3 100644
--- a/c++/src/H5DataSpace.h
+++ b/c++/src/H5DataSpace.h
@@ -50,8 +50,8 @@ class H5_DLLCPP DataSpace : public IdComponent {
// Copies the extent of this dataspace.
void extentCopy(const DataSpace& dest_space) const;
- // Kept for backward compatibility only.
- void extentCopy(DataSpace& dest_space) const;
+ // removed from 1.8.18 and 1.10.1
+ //void extentCopy(DataSpace& dest_space) const;
// Gets the bounding box containing the current selection.
void getSelectBounds( hsize_t* start, hsize_t* end ) const;
diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp
index b7d787d..b784dd4 100644
--- a/c++/src/H5DataType.cpp
+++ b/c++/src/H5DataType.cpp
@@ -25,19 +25,20 @@
#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"
#include "H5private.h"
#include "H5AbstractDs.h"
#include "H5DataSet.h"
+#include "H5Group.h"
#include "H5File.h"
#include "H5Attribute.h"
@@ -313,12 +314,13 @@ void DataType::commit(const H5Location& loc, const char* name)
// Programmer Binh-Minh Ribler - Jan, 2007
// Modification
// Planned for removal. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07
+// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
+// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-void DataType::commit(H5Location& loc, const char* name)
-{
- p_commit(loc.getId(), name);
-}
+//void DataType::commit(H5Location& loc, const char* name)
+//{
+// p_commit(loc.getId(), name);
+//}
//--------------------------------------------------------------------------
// Function: DataType::commit
@@ -343,12 +345,13 @@ void DataType::commit(const H5Location& loc, const H5std_string& name)
// Programmer Binh-Minh Ribler - Jan, 2007
// Modification
// Planned for removal. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07
+// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
+// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-void DataType::commit(H5Location& loc, const H5std_string& name)
-{
- p_commit(loc.getId(), name.c_str());
-}
+//void DataType::commit(H5Location& loc, const H5std_string& name)
+//{
+// p_commit(loc.getId(), name.c_str());
+//}
//--------------------------------------------------------------------------
// Function: DataType::committed
diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h
index 5705b83..7584cff 100644
--- a/c++/src/H5DataType.h
+++ b/c++/src/H5DataType.h
@@ -63,9 +63,9 @@ class H5_DLLCPP DataType : public H5Object {
void commit(const H5Location& loc, const char* name);
void commit(const H5Location& loc, const H5std_string& name);
// These two overloaded functions are kept for backward compatibility
- // only; they missed the const.
- void commit(H5Location& loc, const char* name);
- void commit(H5Location& loc, const H5std_string& name);
+ // only; they missed the const - removed from 1.8.18 and 1.10.1
+ //void commit(H5Location& loc, const char* name);
+ //void commit(H5Location& loc, const H5std_string& name);
// Determines whether this datatype is a named datatype or
// a transient datatype.
diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp
index b2a3e96..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
@@ -333,7 +333,7 @@ void DSetCreatPropList::getFillValue( const DataType& fvalue_type, void* value )
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5D_fill_value_t DSetCreatPropList::isFillValueDefined()
+H5D_fill_value_t DSetCreatPropList::isFillValueDefined() const
{
H5D_fill_value_t status;
herr_t ret_value = H5Pfill_value_defined(id, &status);
@@ -517,7 +517,7 @@ void DSetCreatPropList::modifyFilter( H5Z_filter_t filter_id, unsigned int
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-bool DSetCreatPropList::allFiltersAvail()
+bool DSetCreatPropList::allFiltersAvail() const
{
htri_t ret_value = H5Pall_filters_avail(id);
if( ret_value > 0 )
@@ -565,7 +565,7 @@ void DSetCreatPropList::setShuffle() const
/// \li \c H5D_ALLOC_TIME_INCR
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5D_alloc_time_t DSetCreatPropList::getAllocTime()
+H5D_alloc_time_t DSetCreatPropList::getAllocTime() const
{
H5D_alloc_time_t alloc_time;
herr_t ret_value = H5Pget_alloc_time(id, &alloc_time);
@@ -589,7 +589,7 @@ H5D_alloc_time_t DSetCreatPropList::getAllocTime()
/// \li \c H5D_FILL_TIME_ALLOC.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5D_fill_time_t DSetCreatPropList::getFillTime()
+H5D_fill_time_t DSetCreatPropList::getFillTime() const
{
H5D_fill_time_t fill_time;
herr_t ret_value = H5Pget_fill_time(id, &fill_time);
@@ -615,7 +615,7 @@ H5D_fill_time_t DSetCreatPropList::getFillTime()
/// \li \c H5D_ALLOC_TIME_INCR
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::setAllocTime(H5D_alloc_time_t alloc_time)
+void DSetCreatPropList::setAllocTime(H5D_alloc_time_t alloc_time) const
{
herr_t ret_value = H5Pset_alloc_time(id, alloc_time);
if( ret_value < 0 )
@@ -636,7 +636,7 @@ void DSetCreatPropList::setAllocTime(H5D_alloc_time_t alloc_time)
/// \li \c H5D_FILL_TIME_ALLOC.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::setFillTime(H5D_fill_time_t fill_time)
+void DSetCreatPropList::setFillTime(H5D_fill_time_t fill_time) const
{
herr_t ret_value = H5Pset_fill_time(id, fill_time);
if( ret_value < 0 )
diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h
index 51347e8..fed41b4 100644
--- a/c++/src/H5DcreatProp.h
+++ b/c++/src/H5DcreatProp.h
@@ -38,13 +38,13 @@ class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList {
// Queries whether all the filters set in this property list are
// available currently.
- bool allFiltersAvail();
+ bool allFiltersAvail() const;
// Get space allocation time for this property.
- H5D_alloc_time_t getAllocTime();
+ H5D_alloc_time_t getAllocTime() const;
// Set space allocation time for dataset during creation.
- void setAllocTime(H5D_alloc_time_t alloc_time);
+ void setAllocTime(H5D_alloc_time_t alloc_time) const;
// Retrieves the size of the chunks used to store a chunked layout dataset.
int getChunk( int max_ndims, hsize_t* dim ) const;
@@ -59,10 +59,10 @@ class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList {
int getExternalCount() const;
// Gets fill value writing time.
- H5D_fill_time_t getFillTime();
+ H5D_fill_time_t getFillTime() const;
// Sets fill value writing time for dataset.
- void setFillTime(H5D_fill_time_t fill_time);
+ void setFillTime(H5D_fill_time_t fill_time) const;
// Retrieves a dataset fill value.
void getFillValue( const DataType& fvalue_type, void* value ) const;
@@ -88,7 +88,7 @@ class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList {
int getNfilters() const;
// Checks if fill value has been defined for this property.
- H5D_fill_value_t isFillValueDefined();
+ H5D_fill_value_t isFillValueDefined() const;
// Modifies the specified filter.
void modifyFilter( H5Z_filter_t filter_id, unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[] ) const;
diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp
index 49bbfe6..c228b44 100644
--- a/c++/src/H5DxferProp.cpp
+++ b/c++/src/H5DxferProp.cpp
@@ -145,13 +145,12 @@ void DSetMemXferPropList::setBuffer( size_t size, void* tconv, void* bkg ) const
//--------------------------------------------------------------------------
// Function: DSetMemXferPropList::getBuffer
///\brief Reads buffer settings.
-///\param tconv - IN: Pointer to application-allocated type conversion buffer
-///\param bkg - IN: Pointer to application-allocated background buffer
+///\param tconv - OUT: Pointer to application-allocated type conversion buf
+///\param bkg - OUT: Pointer to application-allocated background buffer
///\return Buffer size, in bytes
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-
size_t DSetMemXferPropList::getBuffer( void** tconv, void** bkg ) const
{
size_t buffer_size = H5Pget_buffer( id, tconv, bkg );
@@ -443,7 +442,7 @@ void DSetMemXferPropList::getVlenMemManager( H5MM_allocate_t& alloc_func, void**
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetSmallData
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setSmallDataBlockSize(hsize_t size)
+void DSetMemXferPropList::setSmallDataBlockSize(hsize_t size) const
{
herr_t ret_value = H5Pset_small_data_block_size(id, size);
if (ret_value < 0)
@@ -460,7 +459,7 @@ void DSetMemXferPropList::setSmallDataBlockSize(hsize_t size)
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-hsize_t DSetMemXferPropList::getSmallDataBlockSize()
+hsize_t DSetMemXferPropList::getSmallDataBlockSize() const
{
hsize_t size;
herr_t ret_value = H5Pget_small_data_block_size(id, &size);
@@ -483,7 +482,7 @@ hsize_t DSetMemXferPropList::getSmallDataBlockSize()
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetHyperVectorSize
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setHyperVectorSize(size_t vector_size)
+void DSetMemXferPropList::setHyperVectorSize(size_t vector_size) const
{
herr_t ret_value = H5Pset_hyper_vector_size(id, vector_size);
if (ret_value < 0)
@@ -501,7 +500,7 @@ void DSetMemXferPropList::setHyperVectorSize(size_t vector_size)
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-size_t DSetMemXferPropList::getHyperVectorSize()
+size_t DSetMemXferPropList::getHyperVectorSize() const
{
size_t vector_size;
herr_t ret_value = H5Pget_hyper_vector_size(id, &vector_size);
@@ -531,7 +530,7 @@ size_t DSetMemXferPropList::getHyperVectorSize()
/// \li \c H5Z_DISABLE_EDC
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setEDCCheck(H5Z_EDC_t check)
+void DSetMemXferPropList::setEDCCheck(H5Z_EDC_t check) const
{
herr_t ret_value = H5Pset_edc_check(id, check);
if (ret_value < 0)
@@ -548,7 +547,7 @@ void DSetMemXferPropList::setEDCCheck(H5Z_EDC_t check)
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-H5Z_EDC_t DSetMemXferPropList::getEDCCheck()
+H5Z_EDC_t DSetMemXferPropList::getEDCCheck() const
{
H5Z_EDC_t check = H5Pget_edc_check(id);
if (check < 0)
diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h
index 52a9a48..31fc372 100644
--- a/c++/src/H5DxferProp.h
+++ b/c++/src/H5DxferProp.h
@@ -86,24 +86,24 @@ class H5_DLLCPP DSetMemXferPropList : public PropList {
H5MM_free_t& free, void** free_info ) const;
// Sets the size of a contiguous block reserved for small data.
- void setSmallDataBlockSize(hsize_t size);
+ void setSmallDataBlockSize(hsize_t size) const;
// Returns the current small data block size setting.
- hsize_t getSmallDataBlockSize();
+ hsize_t getSmallDataBlockSize() const;
// Sets number of I/O vectors to be read/written in hyperslab I/O.
- void setHyperVectorSize(size_t vector_size);
+ void setHyperVectorSize(size_t vector_size) const;
// Returns the number of I/O vectors to be read/written in
// hyperslab I/O.
- size_t getHyperVectorSize();
+ size_t getHyperVectorSize() const;
// Enables or disables error-detecting for a dataset reading
// process.
- void setEDCCheck(H5Z_EDC_t check);
+ void setEDCCheck(H5Z_EDC_t check) const;
// Determines whether error-detection is enabled for dataset reads.
- H5Z_EDC_t getEDCCheck();
+ H5Z_EDC_t getEDCCheck() const;
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("DSetMemXferPropList"); }
diff --git a/c++/src/H5EnumType.cpp b/c++/src/H5EnumType.cpp
index b096a36..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/H5FaccProp.cpp b/c++/src/H5FaccProp.cpp
index c284500..972f915 100644
--- a/c++/src/H5FaccProp.cpp
+++ b/c++/src/H5FaccProp.cpp
@@ -330,26 +330,6 @@ void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccP
//--------------------------------------------------------------------------
// Function: FileAccPropList::setSplit
-// Purpose This is an overloaded member function, kept for backward
-// compatibility. It differs from the above function in that it
-// misses const's. This wrapper will be removed in future release.
-// Param meta_plist - IN: File access plist for the metadata file
-// Param raw_plist - IN: File access plist for the raw data file
-// Param meta_ext - IN: Metadata filename extension as \c char*
-// Param raw_ext - IN: Raw data filename extension as \c char*
-// Exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - April, 2004
-// Modification
-// Planned for removal. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07
-//--------------------------------------------------------------------------
-void FileAccPropList::setSplit(FileAccPropList& meta_plist, FileAccPropList& raw_plist, const char* meta_ext, const char* raw_ext ) const
-{
- setSplit(meta_plist, raw_plist, meta_ext, raw_ext);
-}
-
-//--------------------------------------------------------------------------
-// Function: FileAccPropList::setSplit
///\brief This is an overloaded member function, provided for convenience.
/// It takes character arguments as \c H5std_string.
///\param meta_plist - IN: File access plist for the metadata file
@@ -364,25 +344,6 @@ void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccP
setSplit( meta_plist, raw_plist, meta_ext.c_str(), raw_ext.c_str() );
}
-//--------------------------------------------------------------------------
-// Function: FileAccPropList::setSplit
-// Purpose This is an overloaded member function, kept for backward
-// compatibility. It differs from the above function in that it
-// misses const's. This wrapper will be removed in future release.
-// Param meta_plist - IN: File access plist for the metadata file
-// Param raw_plist - IN: File access plist for the raw data file
-// Param meta_ext - IN: Metadata filename extension as \c char*
-// Param raw_ext - IN: Raw data filename extension as \c char*
-// Exception H5::PropListIException
-// Modification
-// Planned for removal. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07
-//--------------------------------------------------------------------------
-void FileAccPropList::setSplit(FileAccPropList& meta_plist, FileAccPropList& raw_plist, const H5std_string& meta_ext, const H5std_string& raw_ext ) const
-{
- setSplit(meta_plist, raw_plist, meta_ext.c_str(), raw_ext.c_str() );
-}
-
// Stream Virtual File Driver had been removed from the main library.
// FileAccPropList::[s,g]etStream are now removed from the C++ API.
// -BMR, March, 2012
@@ -652,7 +613,7 @@ void FileAccPropList::getCache( int& mdc_nelmts, size_t& rdcc_nelmts, size_t& rd
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setFcloseDegree(H5F_close_degree_t degree)
+void FileAccPropList::setFcloseDegree(H5F_close_degree_t degree) const
{
herr_t ret_value = H5Pset_fclose_degree(id, degree);
if( ret_value < 0 )
@@ -668,7 +629,7 @@ void FileAccPropList::setFcloseDegree(H5F_close_degree_t degree)
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-H5F_close_degree_t FileAccPropList::getFcloseDegree()
+H5F_close_degree_t FileAccPropList::getFcloseDegree() const
{
H5F_close_degree_t degree;
herr_t ret_value = H5Pget_fclose_degree(id, &degree);
diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h
index b214447..831488c 100644
--- a/c++/src/H5FaccProp.h
+++ b/c++/src/H5FaccProp.h
@@ -74,13 +74,6 @@ class H5_DLLCPP FileAccPropList : public PropList {
const FileAccPropList& raw_plist,
const H5std_string& meta_ext = ".meta",
const H5std_string& raw_ext = ".raw") const;
- // These two overloaded functions are kept for backward compatibility
- // only; they missed the const's and will be removed in future release.
- void setSplit(FileAccPropList& meta_plist, FileAccPropList& raw_plist,
- const char* meta_ext=".meta", const char* raw_ext=".raw") const;
- void setSplit(FileAccPropList& meta_plist, FileAccPropList& raw_plist,
- const H5std_string& meta_ext=".meta",
- const H5std_string& raw_ext=".raw") const;
// Sets the maximum size of the data sieve buffer.
void setSieveBufSize(size_t bufsize) const;
@@ -119,10 +112,10 @@ class H5_DLLCPP FileAccPropList : public PropList {
void getCache( int& mdc_nelmts, size_t& rdcc_nelmts, size_t& rdcc_nbytes, double& rdcc_w0 ) const;
// Sets the degree for the file close behavior.
- void setFcloseDegree(H5F_close_degree_t degree);
+ void setFcloseDegree(H5F_close_degree_t degree) const;
// Returns the degree for the file close behavior.
- H5F_close_degree_t getFcloseDegree();
+ H5F_close_degree_t getFcloseDegree() const;
// Sets garbage collecting references flag.
void setGcReferences( unsigned gc_ref = 0 ) const;
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp
index 4602c6f..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"
@@ -51,7 +51,7 @@ namespace H5 {
///\brief Default constructor: creates a stub H5File object.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5File::H5File() : H5Location(), CommonFG(), id(H5I_INVALID_HID) {}
+H5File::H5File() : Group(), id(H5I_INVALID_HID) {}
//--------------------------------------------------------------------------
// Function: H5File overloaded constructor
@@ -84,7 +84,7 @@ H5File::H5File() : H5Location(), CommonFG(), id(H5I_INVALID_HID) {}
// to catch then re-throw it. -BMR 2013/03/21
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(), CommonFG(), id(H5I_INVALID_HID)
+H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : Group(), id(H5I_INVALID_HID)
{
try {
p_get_file(name, flags, create_plist, access_plist);
@@ -109,7 +109,7 @@ H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& c
// to catch then re-throw it. -BMR 2013/03/21
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(), CommonFG(), id(H5I_INVALID_HID)
+H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : Group(), id(H5I_INVALID_HID)
{
try {
p_get_file(name.c_str(), flags, create_plist, access_plist);
@@ -166,7 +166,7 @@ void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPro
// constructor is needed by the library in order to return
// an object, H5File doesn't need it. -BMR (HDFFV-8766 partially)
//--------------------------------------------------------------------------
-H5File::H5File(hid_t existing_id) : H5Location(), CommonFG()
+H5File::H5File(hid_t existing_id) : Group()
{
id = existing_id;
incRefCount(); // increment number of references to this id
@@ -181,7 +181,7 @@ H5File::H5File(hid_t existing_id) : H5Location(), CommonFG()
///\param original - IN: H5File instance to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5File::H5File(const H5File& original) : H5Location(), CommonFG()
+H5File::H5File(const H5File& original) : Group()
{
id = original.getId();
incRefCount(); // increment number of references to this id
@@ -477,12 +477,13 @@ void H5File::getVFDHandle(const FileAccPropList& fapl, void **file_handle) const
// Programmer Binh-Minh Ribler - May 2004
// Modification
// Planned for removal. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07
+// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
+// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-void H5File::getVFDHandle(FileAccPropList& fapl, void **file_handle) const
-{
- getVFDHandle((const FileAccPropList)fapl, file_handle);
-}
+//void H5File::getVFDHandle(FileAccPropList& fapl, void **file_handle) const
+//{
+// getVFDHandle((const FileAccPropList)fapl, file_handle);
+//}
//--------------------------------------------------------------------------
// Function: H5File::getVFDHandle
diff --git a/c++/src/H5File.h b/c++/src/H5File.h
index 939ac8e..7ec92fe 100644
--- a/c++/src/H5File.h
+++ b/c++/src/H5File.h
@@ -17,6 +17,7 @@
#ifndef __H5File_H
#define __H5File_H
+
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
@@ -26,7 +27,7 @@ namespace H5 {
It inherits from H5Location and CommonFG.
*/
-class H5_DLLCPP H5File : public H5Location, public CommonFG {
+class H5_DLLCPP H5File : public Group {
public:
// Creates or opens an HDF5 file.
H5File( const char* name, unsigned int flags,
@@ -68,7 +69,7 @@ class H5_DLLCPP H5File : public H5Location, public CommonFG {
// Returns the pointer to the file handle of the low-level file driver.
void getVFDHandle(void **file_handle) const;
void getVFDHandle(const FileAccPropList& fapl, void **file_handle) const;
- void getVFDHandle(FileAccPropList& fapl, void **file_handle) const; // kept for backward compatibility
+ //void getVFDHandle(FileAccPropList& fapl, void **file_handle) const; // removed from 1.8.18 and 1.10.1
// Determines if a file, specified by its name, is in HDF5 format
static bool isHdf5(const char* name );
@@ -80,9 +81,6 @@ class H5_DLLCPP H5File : public H5Location, public CommonFG {
#ifndef DOXYGEN_SHOULD_SKIP_THIS
void reopen(); // obsolete in favor of reOpen()
- // Gets the file id
- virtual hid_t getLocId() const;
-
// Creates an H5File using an existing file id. Not recommended
// in applications.
H5File(hid_t existing_id);
@@ -95,6 +93,9 @@ class H5_DLLCPP H5File : public H5Location, public CommonFG {
// Throw file exception.
virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const;
+ // for CommonFG to get the file id.
+ virtual hid_t getLocId() const;
+
// Default constructor
H5File();
@@ -125,3 +126,4 @@ class H5_DLLCPP H5File : public H5Location, public CommonFG {
}
#endif
#endif // __H5File_H
+
diff --git a/c++/src/H5FloatType.cpp b/c++/src/H5FloatType.cpp
index cdf9872..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 9d27b79..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,11 +34,11 @@
#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
#ifndef H5_NO_NAMESPACE
namespace H5 {
@@ -52,7 +53,7 @@ namespace H5 {
///\brief Default constructor: creates a stub Group.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group::Group() : H5Object(), CommonFG(), id(H5I_INVALID_HID) {}
+Group::Group() : H5Object(), id(H5I_INVALID_HID) {}
//--------------------------------------------------------------------------
// Function: Group copy constructor
@@ -60,7 +61,7 @@ Group::Group() : H5Object(), CommonFG(), id(H5I_INVALID_HID) {}
///\param original - IN: Original group to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group::Group(const Group& original) : H5Object(), CommonFG(), id(original.id)
+Group::Group(const Group& original) : H5Object(), id(original.id)
{
incRefCount(); // increment number of references to this id
}
@@ -70,6 +71,9 @@ Group::Group(const Group& original) : H5Object(), CommonFG(), id(original.id)
///\brief Returns the id of this group.
///\return Id of this group
// Programmer Binh-Minh Ribler - 2000
+// Deprecated:
+// After HDFFV-9920, the Group's methods can use getId() and getLocId()
+// is kept for backward compatibility. Aug 18, 2016 -BMR
//--------------------------------------------------------------------------
hid_t Group::getLocId() const
{
@@ -82,7 +86,7 @@ hid_t Group::getLocId() const
///\param existing_id - IN: Id of an existing group
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group::Group(const hid_t existing_id) : H5Object(), CommonFG(), id(existing_id)
+Group::Group(const hid_t existing_id) : H5Object(), id(existing_id)
{
incRefCount(); // increment number of references to this id
}
@@ -100,7 +104,7 @@ Group::Group(const hid_t existing_id) : H5Object(), CommonFG(), id(existing_id)
/// is a datatype that has been named by DataType::commit.
// Programmer Binh-Minh Ribler - Oct, 2006
//--------------------------------------------------------------------------
-Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), CommonFG(), id(H5I_INVALID_HID)
+Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(H5I_INVALID_HID)
{
id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereference");
}
@@ -115,7 +119,7 @@ Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const
///\exception H5::ReferenceException
// Programmer Binh-Minh Ribler - Oct, 2006
//--------------------------------------------------------------------------
-Group::Group(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), CommonFG(), id(H5I_INVALID_HID)
+Group::Group(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(H5I_INVALID_HID)
{
id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference");
}
@@ -157,7 +161,7 @@ void Group::p_setId(const hid_t new_id)
close();
}
catch (Exception& close_error) {
- throw GroupIException("Group::p_setId", close_error.getDetailMsg());
+ throwException("Group::p_setId", close_error.getDetailMsg());
}
// reset object's id to the given id
id = new_id;
@@ -178,7 +182,7 @@ void Group::close()
herr_t ret_value = H5Gclose( id );
if( ret_value < 0 )
{
- throw GroupIException("Group::close", "H5Gclose failed");
+ throwException("Group::close", "H5Gclose failed");
}
// reset the id
id = H5I_INVALID_HID;
@@ -226,6 +230,1269 @@ Group::~Group()
}
}
+
+// From H5CommonFG.cpp
+// Notes with "***Updated" are new and for Group.cpp
+// Original notes are from December 2000
+//
+// There are a few comments that are common to most of the functions
+// defined in this file so they are listed here.
+// - getLocId is called by all functions, that call a C API, to get
+// the location id, which can be either a file id or a group id.
+// This function is pure virtual and it's up to H5File and Group
+// to call the right getId() - although, as the structure of the
+// library at this time, getId() is basically the IdComponent::getId()
+// ***Updated: after the classes are rearranged (HDFFV-9920), functions
+// in CommonFG are moved to Group, and they can call getId()
+// instead of getLocId(). getLocId() is kept for backward
+// compatibility on user applications. Aug 18, 2016 -BMR
+// - when a failure returned by the C API, the functions will call
+// throwException, which is a pure virtual function and is implemented
+// by H5File to throw a FileIException and by Group to throw a
+// GroupIException.
+// ***Updated: after HDFFV-9920, methods in class Group use throwException
+// to distinguish the FileIException and GroupIException. CommonFG is no
+// longer used in the library. Aug 18, 2016 -BMR
+
+//--------------------------------------------------------------------------
+// Function: Group::createGroup
+///\brief Creates a new group at this location which can be a file
+/// or another group.
+///\param name - IN: Name of the group to create
+///\param size_hint - IN: Indicates the number of bytes to reserve for
+/// the names that will appear in the group
+///\return Group instance
+///\exception H5::FileIException or H5::GroupIException
+///\par Description
+/// The optional \a size_hint specifies how much file space to
+/// reserve for storing the names that will appear in this new
+/// group. If a non-positive value is provided for the \a size_hint
+/// then a default size is chosen.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+Group Group::createGroup( const char* name, size_t size_hint ) const
+{
+ // Group creation property list for size hint
+ hid_t gcpl_id = 0;
+
+ // Set the local heap size hint
+ if (size_hint > 0)
+ {
+ // If the creation of the property list failed, throw an exception
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ throwException("createGroup", "H5Pcreate failed");
+
+ if (H5Pset_local_heap_size_hint(gcpl_id, size_hint) < 0) {
+ H5Pclose(gcpl_id);
+ throwException("createGroup", "H5Pset_local_heap_size_hint failed");
+ }
+ }
+
+ // Call C routine H5Gcreate2 to create the named group, giving the
+ // location id which can be a file id or a group id
+ hid_t group_id = H5Gcreate2(getId(), name, H5P_DEFAULT, gcpl_id, H5P_DEFAULT );
+
+ // Close the group creation property list, if necessary
+ if(gcpl_id > 0)
+ H5Pclose(gcpl_id);
+
+ // If the creation of the group failed, throw an exception
+ if( group_id < 0 )
+ throwException("createGroup", "H5Gcreate2 failed");
+
+ // No failure, create and return the Group object
+ Group group;
+ group.p_setId(group_id);
+ // CommonFG *ptr = &group;
+ // ptr->p_setId(group_id);
+ return( group );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::createGroup
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+Group Group::createGroup( const H5std_string& name, size_t size_hint ) const
+{
+ return( createGroup( name.c_str(), size_hint ));
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openGroup
+///\brief Opens an existing group in a location which can be a file
+/// or another group.
+///\param name - IN: Name of the group to open
+///\return Group instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+Group Group::openGroup( const char* name ) const
+{
+ // Call C routine H5Gopen2 to open the named group, giving the
+ // location id which can be a file id or a group id
+ hid_t group_id = H5Gopen2(getId(), name, H5P_DEFAULT );
+
+ // If the opening of the group failed, throw an exception
+ if( group_id < 0 )
+ throwException("openGroup", "H5Gopen2 failed");
+
+ // No failure, create and return the Group object
+ Group group;
+ group.p_setId(group_id);
+ // CommonFG *ptr = &group;
+ // ptr->p_setId(group_id);
+ return( group );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openGroup
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+Group Group::openGroup( const H5std_string& name ) const
+{
+ return( openGroup( name.c_str() ));
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::createDataSet
+///\brief Creates a new dataset at this location.
+///\param name - IN: Name of the dataset to create
+///\param data_type - IN: Datatype of the dataset
+///\param data_space - IN: Dataspace for the dataset
+///\param create_plist - IN: Creation properly list for the dataset
+///\return DataSet instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+DataSet Group::createDataSet( const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist ) const
+{
+ //cerr << "createDataSet( const char* name" << endl;
+ // Obtain identifiers for C API
+ hid_t type_id = data_type.getId();
+ hid_t space_id = data_space.getId();
+ hid_t create_plist_id = create_plist.getId();
+
+ // Call C routine H5Dcreate2 to create the named dataset
+ hid_t dataset_id = H5Dcreate2(getId(), name, type_id, space_id, H5P_DEFAULT, create_plist_id, H5P_DEFAULT );
+ //cerr << " H5Dcreate2 returns dataset_id " << dataset_id << endl;
+
+ // If the creation of the dataset failed, throw an exception
+ if( dataset_id < 0 )
+ throwException("createDataSet", "H5Dcreate2 failed");
+
+ // No failure, create and return the DataSet object
+ DataSet dataset;
+ f_DataSet_setId(&dataset, dataset_id);
+ return( dataset );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::createDataSet
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+DataSet Group::createDataSet( const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist ) const
+{
+ //cerr << "createDataSet( const H5std_string& name" << endl;
+ return( createDataSet( name.c_str(), data_type, data_space, create_plist ));
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openDataSet
+///\brief Opens an existing dataset at this location.
+///\param name - IN: Name of the dataset to open
+///\return DataSet instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+DataSet Group::openDataSet( const char* name ) const
+{
+ // Call C function H5Dopen2 to open the specified dataset, giving
+ // the location id and the dataset's name
+ hid_t dataset_id = H5Dopen2(getId(), name, H5P_DEFAULT );
+
+ // If the dataset's opening failed, throw an exception
+ if(dataset_id < 0)
+ throwException("openDataSet", "H5Dopen2 failed");
+
+ // No failure, create and return the DataSet object
+ DataSet dataset;
+ f_DataSet_setId(&dataset, dataset_id);
+ return( dataset );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openDataSet
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+DataSet Group::openDataSet( const H5std_string& name ) const
+{
+ return( openDataSet( name.c_str() ));
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::link
+///\brief Creates a link of the specified type from \a new_name to
+/// \a curr_name.
+///\param link_type - IN: Link type; possible values are
+/// \li \c H5G_LINK_HARD
+/// \li \c H5G_LINK_SOFT
+///\param curr_name - IN: Name of the existing object if link is a hard
+/// link; can be anything for the soft link
+///\param new_name - IN: New name for the object
+///\exception H5::FileIException or H5::GroupIException
+///\par Description
+/// Note that both names are interpreted relative to the
+/// specified location.
+/// For information on creating hard link and soft link, please
+/// refer to the C layer Reference Manual at:
+/// http://hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-CreateHard and
+/// http://hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-CreateSoft
+// Programmer Binh-Minh Ribler - 2000
+// Modification
+// 2007: QAK modified to use H5L APIs - BMR
+//--------------------------------------------------------------------------
+void Group::link( H5L_type_t link_type, const char* curr_name, const char* new_name ) const
+{
+ herr_t ret_value = -1;
+
+ switch(link_type) {
+ case H5L_TYPE_HARD:
+ ret_value = H5Lcreate_hard(getId(), curr_name, H5L_SAME_LOC, new_name, H5P_DEFAULT, H5P_DEFAULT );
+ break;
+
+ case H5L_TYPE_SOFT:
+ ret_value = H5Lcreate_soft( curr_name,getId(), new_name, H5P_DEFAULT, H5P_DEFAULT );
+ break;
+
+ case H5L_TYPE_ERROR:
+ case H5L_TYPE_EXTERNAL:
+ case H5L_TYPE_MAX:
+ default:
+ throwException("link", "unknown link type");
+ break;
+ } /* end switch */
+
+ if( ret_value < 0 )
+ throwException("link", "creating link failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::link
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a curr_name and \a new_name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void Group::link( H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name ) const
+{
+ link( link_type, curr_name.c_str(), new_name.c_str() );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::unlink
+///\brief Removes the specified name at this location.
+///\param name - IN: Name of the object to be removed
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+// Modification
+// 2007: QAK modified to use H5L APIs - BMR
+//--------------------------------------------------------------------------
+void Group::unlink( const char* name ) const
+{
+ herr_t ret_value = H5Ldelete(getId(), name, H5P_DEFAULT );
+ if( ret_value < 0 )
+ throwException("unlink", "H5Ldelete failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::unlink
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void Group::unlink( const H5std_string& name ) const
+{
+ unlink( name.c_str() );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::move
+///\brief Renames an object at this location.
+///\param src - IN: Object's original name
+///\param dst - IN: Object's new name
+///\exception H5::FileIException or H5::GroupIException
+///\note
+/// Exercise care in moving groups as it is possible to render
+/// data in a file inaccessible with Group::move. Please refer
+/// to the Group Interface in the HDF5 User's Guide for details at:
+/// https://www.hdfgroup.org/HDF5/doc/UG/HDF5_Users_Guide-Responsive%20HTML5/index.html#t=HDF5_Users_Guide%2FGroups%2FHDF5_Groups.htm
+// Programmer Binh-Minh Ribler - 2000
+// Modification
+// 2007: QAK modified to use H5L APIs - BMR
+//--------------------------------------------------------------------------
+void Group::move( const char* src, const char* dst ) const
+{
+ herr_t ret_value = H5Lmove(getId(), src, H5L_SAME_LOC, dst, H5P_DEFAULT, H5P_DEFAULT );
+ if( ret_value < 0 )
+ throwException("move", "H5Lmove failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::move
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a src and \a dst.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void Group::move( const H5std_string& src, const H5std_string& dst ) const
+{
+ move( src.c_str(), dst.c_str() );
+}
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+//--------------------------------------------------------------------------
+// Function: Group::getObjinfo
+///\brief Returns information about an object.
+///\param name - IN: Name of the object
+///\param follow_link - IN: Link flag
+///\param statbuf - OUT: Buffer to return information about the object
+///\exception H5::FileIException or H5::GroupIException
+///\par Description
+/// For more information, please refer to the C layer Reference
+/// Manual at:
+/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5G.html#Group-GetObjinfo
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void Group::getObjinfo( const char* name, hbool_t follow_link, H5G_stat_t& statbuf ) const
+{
+ herr_t ret_value = H5Gget_objinfo(getId(), name, follow_link, &statbuf );
+ if( ret_value < 0 )
+ throwException("getObjinfo", "H5Gget_objinfo failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::getObjinfo
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void Group::getObjinfo( const H5std_string& name, hbool_t follow_link, H5G_stat_t& statbuf ) const
+{
+ getObjinfo( name.c_str(), follow_link, statbuf );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::getObjinfo
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above functions in that it doesn't have
+/// the paramemter \a follow_link.
+// Programmer Binh-Minh Ribler - Nov, 2005
+// Note: need to modify to use H5Oget_info and H5Lget_info - BMR
+//--------------------------------------------------------------------------
+void Group::getObjinfo( const char* name, H5G_stat_t& statbuf ) const
+{
+ herr_t ret_value = H5Gget_objinfo(getId(), name, 0, &statbuf );
+ if( ret_value < 0 )
+ throwException("getObjinfo", "H5Gget_objinfo failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::getObjinfo
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - Nov, 2005
+//--------------------------------------------------------------------------
+void Group::getObjinfo( const H5std_string& name, H5G_stat_t& statbuf ) const
+{
+ getObjinfo( name.c_str(), statbuf );
+}
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+//--------------------------------------------------------------------------
+// Function: Group::getLinkval
+///\brief Returns the name of the object that the symbolic link points to.
+///\param name - IN: Symbolic link to the object
+///\param size - IN: Maximum number of characters of value to be returned
+///\return Name of the object
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+H5std_string Group::getLinkval( const char* name, size_t size ) const
+{
+ H5L_info_t linkinfo;
+ char *value_C; // value in C string
+ size_t val_size = size;
+ H5std_string value = "";
+ herr_t ret_value;
+
+ // if user doesn't provide buffer size, determine it
+ if (size == 0)
+ {
+ ret_value = H5Lget_info(getLocId(), name, &linkinfo, H5P_DEFAULT);
+ if( ret_value < 0 )
+ throwException("getLinkval", "H5Lget_info to find buffer size failed");
+
+ val_size = linkinfo.u.val_size;
+ }
+
+ // if link has value, retrieve the value, otherwise, return null string
+ if (val_size > 0)
+ {
+ value_C = new char[val_size+1]; // temporary C-string for C API
+ HDmemset(value_C, 0, val_size+1); // clear buffer
+
+ ret_value = H5Lget_val(getLocId(), name, value_C, val_size, H5P_DEFAULT);
+ if( ret_value < 0 )
+ {
+ delete []value_C;
+ throwException("getLinkval", "H5Lget_val failed");
+ }
+
+ value = H5std_string(value_C);
+ delete []value_C;
+ }
+ return(value);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::getLinkval
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+H5std_string Group::getLinkval( const H5std_string& name, size_t size ) const
+{
+ return( getLinkval( name.c_str(), size ));
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::mount
+///\brief Mounts the file \a child onto this group.
+///\param name - IN: Name of the group
+///\param child - IN: File to mount
+///\param plist - IN: Property list to use
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2014 (original 2000)
+//--------------------------------------------------------------------------
+void Group::mount(const char* name, const H5File& child, const PropList& plist ) const
+{
+ // Obtain identifiers for C API
+ hid_t plist_id = plist.getId();
+ hid_t child_id = child.getId();
+
+ // Call C routine H5Fmount to do the mouting
+ herr_t ret_value = H5Fmount(getId(), name, child_id, plist_id );
+
+ // Raise exception if H5Fmount returns negative value
+ if( ret_value < 0 )
+ throwException("mount", "H5Fmount failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::mount
+// Purpose This is an overloaded member function, kept for backward
+// compatibility. It differs from the above function in that it
+// misses const's. This wrapper will be removed in future release.
+// Param name - IN: Name of the group
+// Param child - IN: File to mount
+// Param plist - IN: Property list to use
+// Exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+// Modification
+// Modified to call its replacement. -BMR, 2014/04/16
+// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
+// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
+//--------------------------------------------------------------------------
+//void Group::mount(const char* name, H5File& child, PropList& plist) const
+//{
+// mount(name, child, plist);
+//}
+
+//--------------------------------------------------------------------------
+// Function: Group::mount
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes an \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void Group::mount(const H5std_string& name, const H5File& child, const PropList& plist) const
+{
+ mount(name.c_str(), child, plist);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::mount
+// Purpose This is an overloaded member function, kept for backward
+// compatibility. It differs from the above function in that it
+// misses const's. This wrapper will be removed in future release.
+// Programmer Binh-Minh Ribler - 2014
+// Modification
+// Modified to call its replacement. -BMR, 2014/04/16
+// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
+// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
+//--------------------------------------------------------------------------
+//void Group::mount(const H5std_string& name, H5File& child, PropList& plist) const
+//{
+// mount(name.c_str(), child, plist);
+//}
+
+//--------------------------------------------------------------------------
+// Function: Group::unmount
+///\brief Unmounts the specified file.
+///\param name - IN: Name of the file to unmount
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void Group::unmount( const char* name ) const
+{
+ // Call C routine H5Fmount to do the mouting
+ herr_t ret_value = H5Funmount(getId(), name );
+
+ // Raise exception if H5Funmount returns negative value
+ if( ret_value < 0 )
+ throwException("unmount", "H5Funmount failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::unmount
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void Group::unmount( const H5std_string& name ) const
+{
+ unmount( name.c_str() );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openDataType
+///\brief Opens the named generic datatype at this location.
+///\param name - IN: Name of the datatype to open
+///\return DataType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+DataType Group::openDataType( const char* name ) const
+{
+ // Call C function H5Topen2 to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
+
+ // If the datatype's opening failed, throw an exception
+ if( type_id < 0 )
+ throwException("openDataType", "H5Topen2 failed");
+
+ // No failure, create and return the DataType object
+ DataType data_type;
+ f_DataType_setId(&data_type, type_id);
+ return(data_type);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openDataType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+DataType Group::openDataType( const H5std_string& name ) const
+{
+ return( openDataType( name.c_str()) );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openArrayType
+///\brief Opens the named array datatype at this location.
+///\param name - IN: Name of the array datatype to open
+///\return ArrayType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - Jul, 2005
+//--------------------------------------------------------------------------
+ArrayType Group::openArrayType( const char* name ) const
+{
+ // Call C function H5Topen2 to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
+
+ // If the datatype's opening failed, throw an exception
+ if( type_id < 0 )
+ throwException("openArrayType", "H5Topen2 failed");
+
+ // No failure, create and return the ArrayType object
+ ArrayType array_type;
+ f_DataType_setId(&array_type, type_id);
+ return(array_type);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openArrayType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - Jul, 2005
+//--------------------------------------------------------------------------
+ArrayType Group::openArrayType( const H5std_string& name ) const
+{
+ return( openArrayType( name.c_str()) );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openCompType
+///\brief Opens the named compound datatype at this location.
+///\param name - IN: Name of the compound datatype to open
+///\return CompType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+CompType Group::openCompType( const char* name ) const
+{
+ // Call C function H5Topen2 to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
+
+ // If the datatype's opening failed, throw an exception
+ if( type_id < 0 )
+ throwException("openCompType", "H5Topen2 failed");
+
+ // No failure, create and return the CompType object
+ CompType comp_type;
+ f_DataType_setId(&comp_type, type_id);
+ return(comp_type);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openCompType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+CompType Group::openCompType( const H5std_string& name ) const
+{
+ return( openCompType( name.c_str()) );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openEnumType
+///\brief Opens the named enumeration datatype at this location.
+///\param name - IN: Name of the enumeration datatype to open
+///\return EnumType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+EnumType Group::openEnumType( const char* name ) const
+{
+ // Call C function H5Topen2 to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
+
+ // If the datatype's opening failed, throw an exception
+ if( type_id < 0 )
+ throwException("openEnumType", "H5Topen2 failed");
+
+ // No failure, create and return the EnumType object
+ EnumType enum_type;
+ f_DataType_setId(&enum_type, type_id);
+ return(enum_type);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openEnumType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+EnumType Group::openEnumType( const H5std_string& name ) const
+{
+ return( openEnumType( name.c_str()) );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openIntType
+///\brief Opens the named integer datatype at this location.
+///\param name - IN: Name of the integer datatype to open
+///\return IntType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+IntType Group::openIntType( const char* name ) const
+{
+ // Call C function H5Topen2 to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
+
+ // If the datatype's opening failed, throw an exception
+ if( type_id < 0 )
+ throwException("openIntType", "H5Topen2 failed");
+
+ // No failure, create and return the IntType object
+ IntType int_type;
+ f_DataType_setId(&int_type, type_id);
+ return(int_type);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openIntType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+IntType Group::openIntType( const H5std_string& name ) const
+{
+ return( openIntType( name.c_str()) );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openFloatType
+///\brief Opens the named floating-point datatype at this location.
+///\param name - IN: Name of the floating-point datatype to open
+///\return FloatType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+FloatType Group::openFloatType( const char* name ) const
+{
+ // Call C function H5Topen2 to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
+
+ // If the datatype's opening failed, throw an exception
+ if( type_id < 0 )
+ throwException("openFloatType", "H5Topen2 failed");
+
+ // No failure, create and return the FloatType object
+ FloatType float_type;
+ f_DataType_setId(&float_type, type_id);
+ return(float_type);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openFloatType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+FloatType Group::openFloatType( const H5std_string& name ) const
+{
+ return( openFloatType( name.c_str()) );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openStrType
+///\brief Opens the named string datatype at this location.
+///\param name - IN: Name of the string datatype to open
+///\return StrType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+StrType Group::openStrType( const char* name ) const
+{
+ // Call C function H5Topen2 to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
+
+ // If the datatype's opening failed, throw an exception
+ if( type_id < 0 )
+ throwException("openStrType", "H5Topen2 failed");
+
+ // No failure, create and return the StrType object
+ StrType str_type;
+ f_DataType_setId(&str_type, type_id);
+ return(str_type);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openStrType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+StrType Group::openStrType( const H5std_string& name ) const
+{
+ return( openStrType( name.c_str()) );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openVarLenType
+///\brief Opens the named variable length datatype at this location.
+///\param name - IN: Name of the variable length datatype to open
+///\return VarLenType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - Jul, 2005
+//--------------------------------------------------------------------------
+VarLenType Group::openVarLenType( const char* name ) const
+{
+ // Call C function H5Topen2 to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
+
+ // If the datatype's opening failed, throw an exception
+ if( type_id < 0 )
+ throwException("openVarLenType", "H5Topen2 failed");
+
+ // No failure, create and return the VarLenType object
+ VarLenType varlen_type;
+ f_DataType_setId(&varlen_type, type_id);
+ return(varlen_type);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::openVarLenType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - Jul, 2005
+//--------------------------------------------------------------------------
+VarLenType Group::openVarLenType( const H5std_string& name ) const
+{
+ return( openVarLenType( name.c_str()) );
+}
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+//--------------------------------------------------------------------------
+// Function: Group::iterateElems
+///\brief Iterates a user's function over the entries of a group.
+///\param name - IN : Name of group to iterate over
+///\param idx - IN/OUT: Starting (IN) and ending (OUT) entry indices
+///\param op - IN : User's function to operate on each entry
+///\param op_data - IN/OUT: Data associated with the operation
+///\return The return value of the first operator that returns non-zero,
+/// or zero if all members were processed with no operator
+/// returning non-zero.
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+int Group::iterateElems( const char* name, int *idx, H5G_iterate_t op , void* op_data )
+{
+ int ret_value = H5Giterate(getId(), name, idx, op, op_data );
+ if( ret_value < 0 )
+ {
+ throwException("iterateElems", "H5Giterate failed");
+ }
+ return( ret_value );
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::iterateElems
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+int Group::iterateElems( const H5std_string& name, int *idx, H5G_iterate_t op , void* op_data )
+{
+ return( iterateElems( name.c_str(), idx, op, op_data ));
+}
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+//--------------------------------------------------------------------------
+// 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(getLocId(), &ginfo);
+ if(ret_value < 0)
+ throwException("getNumObjs", "H5Gget_info failed");
+ return (ginfo.nlinks);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::getObjnameByIdx
+///\brief Returns the name of an object in this group, given the
+/// object's index.
+///\param idx - IN: Transient index of the object
+///\return Object name
+///\exception H5::FileIException or H5::GroupIException
+///\par Description
+/// The value of idx can be any nonnegative number less than the
+/// total number of objects in the group, which is returned by
+/// the function \c Group::getNumObjs. Note that this is a
+/// transient index; thus, an object may have a different index
+/// each time the group is opened.
+// Programmer Binh-Minh Ribler - Mar, 2005
+//--------------------------------------------------------------------------
+H5std_string Group::getObjnameByIdx(hsize_t idx) const
+{
+ // call H5Lget_name_by_idx with name as NULL to get its length
+ ssize_t name_len = H5Lget_name_by_idx(getLocId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, NULL, 0, H5P_DEFAULT);
+ if(name_len < 0)
+ throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
+
+ // now, allocate C buffer to get the name
+ char* name_C = new char[name_len+1];
+ HDmemset(name_C, 0, name_len+1); // clear buffer
+
+ name_len = H5Lget_name_by_idx(getLocId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name_C, name_len+1, H5P_DEFAULT);
+
+ if (name_len < 0)
+ {
+ delete []name_C;
+ throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
+ }
+
+ // clean up and return the string
+ H5std_string name = H5std_string(name_C);
+ delete []name_C;
+ return (name);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::getObjnameByIdx
+///\brief Retrieves the name of an object in this group, given the
+/// object's index.
+///\param idx - IN: Transient index of the object
+///\param name - IN/OUT: Retrieved name of the object
+///\param size - IN: Length to retrieve
+///\return Actual size of the object name or 0, if object has no name
+///\exception H5::FileIException or H5::GroupIException
+///\par Description
+/// The value of idx can be any nonnegative number less than the
+/// total number of objects in the group, which is returned by
+/// the function \c Group::getNumObjs. Note that this is a
+/// transient index; thus, an object may have a different index
+/// each time the group is opened.
+// Programmer Binh-Minh Ribler - January, 2003
+//--------------------------------------------------------------------------
+ssize_t Group::getObjnameByIdx(hsize_t idx, char* name, size_t size) const
+{
+ ssize_t name_len = H5Lget_name_by_idx(getLocId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name, size, H5P_DEFAULT);
+ if(name_len < 0)
+ throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
+
+ return (name_len);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::getObjnameByIdx
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - January, 2003
+//--------------------------------------------------------------------------
+ssize_t Group::getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const
+{
+ char* name_C = new char[size+1]; // temporary C-string for object name
+ HDmemset(name_C, 0, size+1); // clear buffer
+
+ // call overloaded function to get the name
+ ssize_t name_len = getObjnameByIdx(idx, name_C, size+1);
+ if(name_len < 0)
+ {
+ delete []name_C;
+ throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
+ }
+
+ // clean up and return the string
+ name = H5std_string(name_C);
+ delete []name_C;
+ return (name_len);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::childObjType
+///\brief Returns the type of an object in this file/group, given the
+/// object's name.
+///\param objname - IN: Name of the object
+///\return Object type, which can have the following values for group,
+/// dataset, and named datatype
+/// \li \c H5O_TYPE_GROUP
+/// \li \c H5O_TYPE_DATASET
+/// \li \c H5O_TYPE_NAMED_DATATYPE
+/// Refer to the C API documentation for more details:
+/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfo
+///\exception H5::FileIException or H5::GroupIException
+/// Exception will be thrown when:
+/// - an error returned by the C API
+/// - object type is not one of the valid values above
+// Programmer Binh-Minh Ribler - April, 2014
+//--------------------------------------------------------------------------
+H5O_type_t Group::childObjType(const char* objname) const
+{
+ H5O_info_t objinfo;
+ H5O_type_t objtype = H5O_TYPE_UNKNOWN;
+
+ // Use C API to get information of the object
+ herr_t ret_value = H5Oget_info_by_name(getLocId(), objname, &objinfo, H5P_DEFAULT);
+
+ // Throw exception if C API returns failure
+ if (ret_value < 0)
+ throwException("childObjType", "H5Oget_info_by_name failed");
+ // Return a valid type or throw an exception for unknown type
+ else
+ switch (objinfo.type)
+ {
+ case H5O_TYPE_GROUP:
+ case H5O_TYPE_DATASET:
+ case H5O_TYPE_NAMED_DATATYPE:
+ objtype = objinfo.type;
+ break;
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ throwException("childObjType", "Unknown type of object");
+ }
+ return(objtype);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::childObjType
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes an \a H5std_string for the object's name.
+///\brief Returns the type of an object in this group, given the
+/// object's name.
+///\param objname - IN: Name of the object (H5std_string&)
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - April, 2014
+//--------------------------------------------------------------------------
+H5O_type_t Group::childObjType(const H5std_string& objname) const
+{
+ // Use overloaded function
+ H5O_type_t objtype = childObjType(objname.c_str());
+ return(objtype);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::childObjType
+///\brief Returns the type of an object in this file/group, given the
+/// object's index and its type and order.
+///\param index - IN: Position of the object
+///\param index_type - IN: Type of the index, default to H5_INDEX_NAME
+///\param order - IN: Traversing order, default to H5_ITER_INC
+///\param objname - IN: Name of the object, default to "."
+///\return Object type, which can have the following values for group,
+/// dataset, and named datatype
+/// \li \c H5O_TYPE_GROUP
+/// \li \c H5O_TYPE_DATASET
+/// \li \c H5O_TYPE_NAMED_DATATYPE
+/// Refer to the C API documentation for more details:
+/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfo
+///\exception H5::FileIException or H5::GroupIException
+/// Exception will be thrown when:
+/// - an error returned by the C API
+/// - object type is not one of the valid values above
+// Developer's Notes:
+// - this overload uses H5Oget_info_by_idx instead of H5Oget_info_by_name
+// like the previous childObjType()
+// - index is the required argument so, first
+// - objname is last because it's more likely the location is already
+// fully specified
+// - Leave property list out for now because C API is not using it, it
+// can be added later when needed.
+// Programmer Binh-Minh Ribler - April, 2014
+//--------------------------------------------------------------------------
+H5O_type_t Group::childObjType(hsize_t index, H5_index_t index_type, H5_iter_order_t order, const char* objname) const
+{
+ herr_t ret_value;
+ H5O_info_t objinfo;
+ H5O_type_t objtype = H5O_TYPE_UNKNOWN;
+
+ // Use C API to get information of the object
+ ret_value = H5Oget_info_by_idx(getLocId(), objname, index_type, order, index, &objinfo, H5P_DEFAULT);
+
+ // Throw exception if C API returns failure
+ if (ret_value < 0)
+ throwException("childObjType", "H5Oget_info_by_idx failed");
+ // Return a valid type or throw an exception for unknown type
+ else
+ switch (objinfo.type)
+ {
+ case H5O_TYPE_GROUP:
+ case H5O_TYPE_DATASET:
+ case H5O_TYPE_NAMED_DATATYPE:
+ objtype = objinfo.type;
+ break;
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ throwException("childObjType", "Unknown type of object");
+ }
+ return(objtype);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::childObjVersion
+///\brief Returns the object header version of an object in this file/group,
+/// given the object's name.
+///\param objname - IN: Name of the object
+///\return Object version, which can have the following values:
+/// \li \c H5O_VERSION_1
+/// \li \c H5O_VERSION_2
+///\exception H5::FileIException or H5::GroupIException
+/// 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 - April, 2014
+//--------------------------------------------------------------------------
+unsigned Group::childObjVersion(const char* objname) const
+{
+ H5O_info_t objinfo;
+ unsigned version = 0;
+
+ // Use C API to get information of the object
+ herr_t ret_value = H5Oget_info_by_name(getLocId(), objname, &objinfo, H5P_DEFAULT);
+
+ // Throw exception if C API returns failure
+ if (ret_value < 0)
+ throwException("childObjVersion", "H5Oget_info_by_name 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)
+ throwException("childObjVersion", "Invalid version for object");
+ }
+ return(version);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::childObjVersion
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes an \a H5std_string for the object's name.
+///\brief Returns the type of an object in this group, given the
+/// object's name.
+///\param objname - IN: Name of the object (H5std_string&)
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - April, 2014
+//--------------------------------------------------------------------------
+unsigned Group::childObjVersion(const H5std_string& objname) const
+{
+ // Use overloaded function
+ unsigned version = childObjVersion(objname.c_str());
+ return(version);
+}
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+//--------------------------------------------------------------------------
+// Function: Group::getObjTypeByIdx
+///\brief Returns the type of an object in this group, given the
+/// object's index.
+///\param idx - IN: Transient index of the object
+///\return Object type
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - January, 2003
+//--------------------------------------------------------------------------
+H5G_obj_t Group::getObjTypeByIdx(hsize_t idx) const
+{
+ H5G_obj_t obj_type = H5Gget_objtype_by_idx(getLocId(), idx);
+ if (obj_type == H5G_UNKNOWN)
+ throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed");
+
+ return (obj_type);
+}
+
+//--------------------------------------------------------------------------
+// Function: Group::getObjTypeByIdx
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function because it also provides
+/// the returned object type in text (char*)
+///\param idx - IN: Transient index of the object
+///\param type_name - OUT: Object type in text
+///\return Object type
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - May, 2010
+// Modification
+// Modified to use the other function. -BMR, 2016/03/07
+//--------------------------------------------------------------------------
+H5G_obj_t Group::getObjTypeByIdx(hsize_t idx, char* type_name) const
+{
+ H5std_string stype_name(type_name);
+ return(getObjTypeByIdx(idx, stype_name));
+}
+//--------------------------------------------------------------------------
+// Function: Group::getObjTypeByIdx
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function because it also provides
+/// the returned object type in text (H5std_string&)
+///\param idx - IN: Transient index of the object
+///\param type_name - OUT: Object type in text
+///\return Object type
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - January, 2003
+//--------------------------------------------------------------------------
+H5G_obj_t Group::getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const
+{
+ H5G_obj_t obj_type = H5Gget_objtype_by_idx(getLocId(), idx);
+ switch (obj_type)
+ {
+ case H5G_LINK: type_name = H5std_string("symbolic link"); break;
+ case H5G_GROUP: type_name = H5std_string("group"); break;
+ case H5G_DATASET: type_name = H5std_string("dataset"); break;
+ case H5G_TYPE: type_name = H5std_string("datatype"); break;
+ case H5G_UNKNOWN:
+ case H5G_UDLINK:
+ case H5G_RESERVED_5:
+ case H5G_RESERVED_6:
+ case H5G_RESERVED_7:
+ default:
+ throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed");
+ }
+ return (obj_type);
+}
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+//--------------------------------------------------------------------------
+// Function: f_DataType_setId - friend
+// Purpose: This function is friend to class H5::DataType so that it
+// can set DataType::id in order to work around a problem
+// described in the JIRA issue HDFFV-7947.
+// Applications shouldn't need to use it.
+// param dtype - IN/OUT: DataType object to be changed
+// param new_id - IN: New id to set
+// Programmer Binh-Minh Ribler - 2015
+//--------------------------------------------------------------------------
+void f_DataType_setId(DataType* dtype, hid_t new_id)
+{
+ dtype->p_setId(new_id);
+}
+
+//--------------------------------------------------------------------------
+// Function: f_DataSet_setId - friend
+// Purpose: This function is friend to class H5::DataSet so that it
+// can set DataSet::id in order to work around a problem
+// described in the JIRA issue HDFFV-7947.
+// Applications shouldn't need to use it.
+// param dset - IN/OUT: DataSet object to be changed
+// param new_id - IN: New id to set
+// Programmer Binh-Minh Ribler - 2015
+//--------------------------------------------------------------------------
+void f_DataSet_setId(DataSet* dset, hid_t new_id)
+{
+ dset->p_setId(new_id);
+}
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
#ifndef H5_NO_NAMESPACE
} // end namespace
#endif
diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h
index 1bd9882..e8527d8 100644
--- a/c++/src/H5Group.h
+++ b/c++/src/H5Group.h
@@ -14,8 +14,8 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#ifndef __H5Group_H
-#define __H5Group_H
+#ifndef __Group_H
+#define __Group_H
#ifndef H5_NO_NAMESPACE
namespace H5 {
@@ -26,8 +26,147 @@ namespace H5 {
It inherits many operations from H5Location and CommonFG.
*/
-class H5_DLLCPP Group : public H5Object, public CommonFG {
+// Class forwarding
+//class Group;
+//class H5File;
+class ArrayType;
+class VarLenType;
+
+/*! \class CommonFG
+ \brief \a CommonFG is an abstract base class of H5File and Group.
+
+ It provides common operations of H5File and Group.
+*/
+class H5_DLLCPP Group : public H5Object {
public:
+ // Group constructor to create a group or file (aka root group).
+ Group(const char* name, size_t size_hint = 0);
+ Group(const H5std_string& name, size_t size_hint = 0);
+
+ // Group constructor to open a group or file (aka root group).
+ Group(const char* name);
+ Group(const H5std_string& name);
+
+// From CommonFG
+ // Creates a new group at this location which can be a file
+ // or another group.
+ Group createGroup(const char* name, size_t size_hint = 0) const;
+ Group createGroup(const H5std_string& name, size_t size_hint = 0) const;
+
+ // Opens an existing group in a location which can be a file
+ // or another group.
+ Group openGroup(const char* name) const;
+ Group openGroup(const H5std_string& name) const;
+
+ // Creates a new dataset in this group.
+ DataSet createDataSet(const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const;
+ DataSet createDataSet(const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const;
+
+ // Opens an existing dataset at this location.
+ DataSet openDataSet(const char* name) const;
+ DataSet openDataSet(const H5std_string& name) const;
+
+ // Returns the value of a symbolic link.
+ 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;
+ ssize_t getObjnameByIdx(hsize_t idx, char* name, size_t size) const;
+ ssize_t getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const;
+
+ // Retrieves the type of an object in this file or group, given the
+ // object's name
+ H5O_type_t childObjType(const H5std_string& objname) const;
+ H5O_type_t childObjType(const char* objname) const;
+ H5O_type_t childObjType(hsize_t index, H5_index_t index_type=H5_INDEX_NAME, H5_iter_order_t order=H5_ITER_INC, const char* objname=".") const;
+
+ // Returns the object header version of an object in this file or group,
+ // given the object's name.
+ unsigned childObjVersion(const char* objname) const;
+ unsigned childObjVersion(const H5std_string& objname) const;
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ // Returns the type of an object in this group, given the
+ // object's index.
+ H5G_obj_t getObjTypeByIdx(hsize_t idx) const;
+ H5G_obj_t getObjTypeByIdx(hsize_t idx, char* type_name) const;
+ H5G_obj_t getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const;
+
+ // Returns information about an HDF5 object, given by its name,
+ // at this location.
+ void getObjinfo(const char* name, hbool_t follow_link, H5G_stat_t& statbuf) const;
+ void getObjinfo(const H5std_string& name, hbool_t follow_link, H5G_stat_t& statbuf) const;
+ void getObjinfo(const char* name, H5G_stat_t& statbuf) const;
+ void getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const;
+
+ // Iterates over the elements of this group - not implemented in
+ // C++ style yet.
+ int iterateElems(const char* name, int *idx, H5G_iterate_t op, void *op_data);
+ int iterateElems(const H5std_string& name, int *idx, H5G_iterate_t op, void *op_data);
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+ // Creates a link of the specified type from new_name to current_name;
+ // both names are interpreted relative to the specified location id.
+ void link(H5L_type_t link_type, const char* curr_name, const char* new_name) const;
+ void link(H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name) const;
+
+ // Removes the specified name at this location.
+ void unlink(const char* name) const;
+ void unlink(const H5std_string& name) const;
+
+ // Mounts the file 'child' onto this location.
+ void mount(const char* name, const H5File& child, const PropList& plist) const;
+ //void mount(const char* name, H5File& child, PropList& plist) const; // removed from 1.8.18 and 1.10.1
+ void mount(const H5std_string& name, const H5File& child, const PropList& plist) const;
+ //void mount(const H5std_string& name, H5File& child, PropList& plist) const; // removed from 1.8.18 and 1.10.1
+
+ // Unmounts the file named 'name' from this parent location.
+ void unmount(const char* name) const;
+ void unmount(const H5std_string& name) const;
+
+ // Renames an object at this location.
+ void move(const char* src, const char* dst) const;
+ void move(const H5std_string& src, const H5std_string& dst) const;
+
+ // Opens a generic named datatype in this location.
+ DataType openDataType(const char* name) const;
+ DataType openDataType(const H5std_string& name) const;
+
+ // Opens a named array datatype in this location.
+ ArrayType openArrayType(const char* name) const;
+ ArrayType openArrayType(const H5std_string& name) const;
+
+ // Opens a named compound datatype in this location.
+ CompType openCompType(const char* name) const;
+ CompType openCompType(const H5std_string& name) const;
+
+ // Opens a named enumeration datatype in this location.
+ EnumType openEnumType(const char* name) const;
+ EnumType openEnumType(const H5std_string& name) const;
+
+ // Opens a named integer datatype in this location.
+ IntType openIntType(const char* name) const;
+ IntType openIntType(const H5std_string& name) const;
+
+ // Opens a named floating-point datatype in this location.
+ FloatType openFloatType(const char* name) const;
+ FloatType openFloatType(const H5std_string& name) const;
+
+ // Opens a named string datatype in this location.
+ StrType openStrType(const char* name) const;
+ StrType openStrType(const H5std_string& name) const;
+
+ // Opens a named variable length datatype in this location.
+ VarLenType openVarLenType(const char* name) const;
+ VarLenType openVarLenType(const H5std_string& name) const;
+
+// end from CommonFG
+
// Close this group.
virtual void close();
@@ -68,7 +207,8 @@ class H5_DLLCPP Group : public H5Object, public CommonFG {
private:
hid_t id; // HDF5 group id
};
+
#ifndef H5_NO_NAMESPACE
}
#endif
-#endif // __H5Group_H
+#endif // __Group_H
diff --git a/c++/src/H5IntType.cpp b/c++/src/H5IntType.cpp
index 5719eed..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 c4debba..4048d94 100644
--- a/c++/src/H5Location.cpp
+++ b/c++/src/H5Location.cpp
@@ -26,10 +26,10 @@
#include "H5DxferProp.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
-#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5DataSpace.h"
#include "H5AbstractDs.h"
+#include "H5Group.h"
#include "H5File.h"
#include "H5DataSet.h"
#include "H5Attribute.h"
@@ -40,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)
@@ -74,8 +59,9 @@ H5Location::H5Location() : IdComponent() {}
// been moved to the sub-classes. It will be removed in 1.10 release. If its
// removal does not raise any problems in 1.10, it will be removed from 1.8 in
// subsequent releases.
+// Removed in 1.10.1 - Aug 2016
//--------------------------------------------------------------------------
-H5Location::H5Location(const hid_t object_id) : IdComponent() {}
+// H5Location::H5Location(const hid_t object_id) : IdComponent() {}
//--------------------------------------------------------------------------
// Function: H5Location copy constructor
@@ -94,264 +80,6 @@ H5Location::H5Location(const hid_t object_id) : 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,
@@ -563,8 +291,8 @@ H5std_string H5Location::getComment(const char* name, size_t buf_size) const
HDmemset(comment_C, 0, tmp_len+1); // clear buffer
// Used overloaded function
- ssize_t comment_len = getComment(name, tmp_len+1, comment_C);
- if (comment_len < 0)
+ ssize_t temp_len = getComment(name, tmp_len+1, comment_C);
+ if (temp_len < 0)
{
delete []comment_C;
throw LocationException("H5Location::getComment", "H5Oget_comment_by_name failed");
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 3cce9fe..0cb392d 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -19,16 +19,17 @@
#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"
+#include "H5Group.h"
#include "H5File.h"
#include "H5DataSet.h"
#include "H5Attribute.h"
@@ -39,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
@@ -56,8 +70,9 @@ H5Object::H5Object() : H5Location() {}
// been moved to the sub-classes. It will be removed in 1.10 release. If its
// removal does not raise any problems in 1.10, it will be removed from 1.8 in
// subsequent releases.
+// Removed in 1.10.1 - Aug 2016
//--------------------------------------------------------------------------
-H5Object::H5Object(const hid_t object_id) : H5Location() {}
+//H5Object::H5Object(const hid_t object_id) : H5Location() {}
//--------------------------------------------------------------------------
// Function: H5Object copy constructor
@@ -72,6 +87,264 @@ H5Object::H5Object(const hid_t object_id) : 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.
@@ -183,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 f8ac792..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,16 +61,52 @@ 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.
+ // DataType. These should have const but are retiring anyway.
ssize_t getObjName(char *obj_name, size_t buf_size = 0) const;
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 3cfa342..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 2fab1f3..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"
diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt
index dffe7a4..9d98d11 100644
--- a/c++/test/CMakeLists.txt
+++ b/c++/test/CMakeLists.txt
@@ -48,11 +48,4 @@ set_target_properties (cpp_testhdf5 PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
-add_custom_command (
- TARGET cpp_testhdf5
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_CPP_TEST_SOURCE_DIR}/th5s.h5 ${PROJECT_BINARY_DIR}/th5s.h5
-)
-
include (CMakeTests.cmake)
diff --git a/c++/test/CMakeTests.cmake b/c++/test/CMakeTests.cmake
index c725f69..91c36b0 100644
--- a/c++/test/CMakeTests.cmake
+++ b/c++/test/CMakeTests.cmake
@@ -1,3 +1,5 @@
+HDFTEST_COPY_FILE("${HDF5_CPP_TEST_SOURCE_DIR}/th5s.h5" "${PROJECT_BINARY_DIR}/th5s.h5" "cpp_testhdf5_files")
+add_custom_target(cpp_testhdf5_files ALL COMMENT "Copying files needed by cpp_testhdf5 tests" DEPENDS ${cpp_testhdf5_files_list})
##############################################################################
##############################################################################
@@ -8,7 +10,7 @@
add_test (
NAME CPP_testhdf5-clear-objects
COMMAND ${CMAKE_COMMAND}
- -E remove
+ -E remove
tattr_basic.h5
tattr_compound.h5
tattr_dtype.h5
@@ -30,17 +32,18 @@ if (HDF5_TEST_VFD)
multi
family
)
-
+
if (DIRECT_VFD)
set (VFD_LIST ${VFD_LIST} direct)
endif (DIRECT_VFD)
MACRO (ADD_VFD_TEST vfdname resultcode)
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdname}")
add_test (
NAME CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects
COMMAND ${CMAKE_COMMAND}
- -E remove
+ -E remove
tattr_basic.h5
tattr_compound.h5
tattr_dtype.h5
@@ -49,21 +52,21 @@ if (HDF5_TEST_VFD)
tfattrs.h5
)
add_test (
- NAME CPP_VFD-${vfdname}-cpp_testhdf5
+ NAME CPP_VFD-${vfdname}-cpp_testhdf5
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:cpp_testhdf5>"
-D "TEST_ARGS:STRING="
-D "TEST_VFD:STRING=${vfdname}"
-D "TEST_EXPECT=${resultcode}"
-D "TEST_OUTPUT=cpp_testhdf5"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}"
-P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
)
set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES DEPENDS CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects)
set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES TIMEOUT 30)
endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
ENDMACRO (ADD_VFD_TEST)
-
+
# Run test with different Virtual File Driver
foreach (vfd ${VFD_LIST})
ADD_VFD_TEST (${vfd} 0)
diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h
index b615194..50cde99 100644
--- a/c++/test/h5cpputil.h
+++ b/c++/test/h5cpputil.h
@@ -89,7 +89,7 @@ template <class Type1, class Type2>
{
cerr << endl;
cerr << "*** UNEXPECTED VALUE: " << file_name << ":line " << line
- << ":" << msg << " different: " << x << ", should be " << value
+ << ": " << msg << " different: " << x << ", should be " << value
<< endl;
IncTestNumErrs();
throw TestFailedException(file_name, msg);
@@ -127,6 +127,19 @@ template <class Type1, class Type2>
}
}
+template <class Type1, class Type2>
+ void verify_val(Type1 x, Type2 value, float epsilon, const char* msg, int line, const char* file_name)
+{
+ if (x == value)
+ {
+ cerr << endl;
+ cerr << "*** UNEXPECTED FLOAT VALUE: " << file_name << ":line " << line
+ << ": " << msg << " different: " << x << ", should be " << value
+ << " (epsilon=" << epsilon << ")" << endl;
+ IncTestNumErrs();
+ throw TestFailedException(file_name, msg);
+ }
+}
/* Prototypes for the test routines */
#ifdef __cplusplus
diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp
index e8c2a78..2dfa562 100644
--- a/c++/test/tattr.cpp
+++ b/c++/test/tattr.cpp
@@ -830,6 +830,9 @@ static void test_attr_scalar_write()
** test_attr_scalar_read(): Test scalar attribute reading functionality.
**
****************************************************************/
+/* Epsilon for floating-point comparisons */
+#define FP_EPSILON 0.000001F
+
static void test_attr_scalar_read()
{
// Output message about test being performed
@@ -852,7 +855,8 @@ static void test_attr_scalar_read()
// Read attribute information
float read_data2=0.0; // Buffer for reading 1st attribute
ds_attr.read(PredType::NATIVE_FLOAT,&read_data2);
- verify_val(read_data2, attr_data5, "Attribute::read", __LINE__, __FILE__);
+ if (HDfabs(read_data2 - attr_data5) > FP_EPSILON)
+ verify_val(read_data2, attr_data5, FP_EPSILON, "Attribute::read", __LINE__, __FILE__);
// Get the dataspace of the attribute
DataSpace att_space = ds_attr.getSpace();
@@ -1714,7 +1718,7 @@ static void test_attr_corder_create_basic(FileCreatPropList& fcpl,
// Get creation order indexing on object
unsigned crt_order_flags = 0;
crt_order_flags = dcpl.getAttrCrtOrder();
- verify_val(crt_order_flags, 0, "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__);
+ verify_val(crt_order_flags, (unsigned)0, "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__);
// Setting invalid combination of a attribute order creation order
// indexing on should fail
@@ -1731,7 +1735,7 @@ static void test_attr_corder_create_basic(FileCreatPropList& fcpl,
// verify them
dcpl.setAttrCrtOrder(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED);
crt_order_flags = dcpl.getAttrCrtOrder();
- verify_val(crt_order_flags, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__);
+ verify_val(crt_order_flags, (unsigned)(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__);
// Create dataspace for dataset
DataSpace ds_space(H5S_SCALAR);
@@ -1766,7 +1770,7 @@ static void test_attr_corder_create_basic(FileCreatPropList& fcpl,
// Query the attribute creation properties
crt_order_flags = dcpl.getAttrCrtOrder();
- verify_val(crt_order_flags, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__);
+ verify_val(crt_order_flags, (unsigned)(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__);
PASSED();
} // end try block
diff --git a/c++/test/testhdf5.cpp b/c++/test/testhdf5.cpp
index b3415f1..b17d942 100644
--- a/c++/test/testhdf5.cpp
+++ b/c++/test/testhdf5.cpp
@@ -132,6 +132,9 @@ Comment out tests that are not done yet */
if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP"))
TestCleanup();
+ /* Release test infrastructure */
+ TestShutdown();
+
return (GetTestNumErrs());
}
diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp
index 763f9f0..0eabfb9 100644
--- a/c++/test/tfile.cpp
+++ b/c++/test/tfile.cpp
@@ -515,8 +515,6 @@ static void test_file_name()
} // test_file_name()
-#define NUM_OBJS 4
-#define NUM_ATTRS 3
const int RANK1 = 1;
const int ATTR1_DIM1 = 3;
const H5std_string FILE5("tfattrs.h5");
@@ -742,6 +740,70 @@ static void test_libver_bounds()
} /* end test_libver_bounds() */
/*-------------------------------------------------------------------------
+ * Function: test_commonfg
+ *
+ * Purpose: Verify that a file created and modified with the
+ * specified libver bounds has the specified object header
+ * versions for the right objects.
+ *
+ * Return: None
+ *
+ * Programmer: Binh-Minh Ribler (use C version)
+ * March, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static void test_commonfg()
+{
+ // Output message about test being performed
+ SUBTEST("Root group");
+
+ try {
+ // Create a file using default properties.
+ H5File file4(FILE4, H5F_ACC_TRUNC);
+
+ // Try opening the root group.
+ Group rootgroup(file4.openGroup(ROOTGROUP));
+
+ // Create a group in the root group.
+ Group group(rootgroup.createGroup(GROUPNAME, 0));
+
+ // Create the data space.
+ hsize_t dims[RANK] = {NX, NY};
+ DataSpace space(RANK, dims);
+
+ // Create a new dataset.
+ DataSet dataset(group.createDataSet (DSETNAME, PredType::NATIVE_INT, space));
+
+ // Get and verify file name via a dataset.
+ H5std_string file_name = dataset.getFileName();
+ verify_val(file_name, FILE4, "DataSet::getFileName", __LINE__, __FILE__);
+
+ // Create an attribute for the dataset.
+ Attribute attr(dataset.createAttribute(DATTRNAME, PredType::NATIVE_INT, space));
+
+ // Get and verify file name via an attribute.
+ file_name = attr.getFileName();
+ verify_val(file_name, FILE4, "Attribute::getFileName", __LINE__, __FILE__);
+
+ // Create an attribute for the file via root group.
+ Attribute rootg_attr(rootgroup.createAttribute(FATTRNAME, PredType::NATIVE_INT, space));
+
+ // Get and verify file name via an attribute.
+ file_name = attr.getFileName();
+ verify_val(file_name, FILE4, "Attribute::getFileName", __LINE__, __FILE__);
+
+ PASSED();
+ } // end of try block
+
+ catch (Exception& E)
+ {
+ issue_fail_msg("test_commonfg()", __LINE__, __FILE__, E.getCDetailMsg());
+ }
+
+} /* end test_commonfg() */
+
+/*-------------------------------------------------------------------------
* Function: test_file
*
* Purpose: Main file testing routine
@@ -769,6 +831,7 @@ void test_file()
test_file_name(); // Test getting file's name
test_file_attribute(); // Test file attribute feature
test_libver_bounds(); // Test format version
+ test_commonfg();
} // test_file()
@@ -793,7 +856,7 @@ void cleanup_file()
HDremove(FILE1.c_str());
HDremove(FILE2.c_str());
HDremove(FILE3.c_str());
- HDremove(FILE4.c_str());
+// HDremove(FILE4.c_str());
HDremove(FILE5.c_str());
HDremove(FILE6.c_str());
} // cleanup_file