summaryrefslogtreecommitdiffstats
path: root/c++/src
diff options
context:
space:
mode:
Diffstat (limited to 'c++/src')
-rw-r--r--c++/src/CMakeLists.txt2
-rw-r--r--c++/src/H5AbstractDs.cpp5
-rw-r--r--c++/src/H5AbstractDs.h2
-rw-r--r--c++/src/H5ArrayType.h2
-rw-r--r--c++/src/H5AtomType.h2
-rw-r--r--c++/src/H5Attribute.cpp25
-rw-r--r--c++/src/H5Attribute.h6
-rw-r--r--c++/src/H5Classes.h1
-rw-r--r--c++/src/H5CompType.h20
-rw-r--r--c++/src/H5Cpp.h1
-rw-r--r--c++/src/H5CppDoc.h2
-rw-r--r--c++/src/H5DataSet.cpp48
-rw-r--r--c++/src/H5DataSet.h9
-rw-r--r--c++/src/H5DataSpace.h2
-rw-r--r--c++/src/H5DataType.cpp45
-rw-r--r--c++/src/H5DataType.h7
-rw-r--r--c++/src/H5DcreatProp.h2
-rw-r--r--c++/src/H5DxferProp.h2
-rw-r--r--c++/src/H5EnumType.h2
-rw-r--r--c++/src/H5FaccProp.h2
-rw-r--r--c++/src/H5FcreatProp.h2
-rw-r--r--c++/src/H5File.cpp237
-rw-r--r--c++/src/H5File.h33
-rw-r--r--c++/src/H5FloatType.h2
-rw-r--r--c++/src/H5Group.cpp47
-rw-r--r--c++/src/H5Group.h7
-rw-r--r--c++/src/H5IdComponent.h2
-rw-r--r--c++/src/H5IntType.h2
-rw-r--r--c++/src/H5Location.cpp669
-rw-r--r--c++/src/H5Location.h146
-rw-r--r--c++/src/H5Object.cpp514
-rw-r--r--c++/src/H5Object.h93
-rw-r--r--c++/src/H5PredType.h2
-rw-r--r--c++/src/H5PropList.h2
-rw-r--r--c++/src/H5StrType.h2
-rw-r--r--c++/src/H5VarLenType.h2
-rw-r--r--c++/src/Makefile.am17
-rw-r--r--c++/src/Makefile.in32
38 files changed, 936 insertions, 1062 deletions
diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt
index 375bd4a..d983d1e 100644
--- a/c++/src/CMakeLists.txt
+++ b/c++/src/CMakeLists.txt
@@ -40,6 +40,7 @@ SET (CPP_SRCS
${HDF5_CPP_SRC_SOURCE_DIR}/H5IdComponent.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5IntType.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5Library.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5Location.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5Object.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5PredType.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5PropList.cpp
@@ -74,6 +75,7 @@ SET (CPP_HDRS
${HDF5_CPP_SRC_SOURCE_DIR}/H5Include.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5IntType.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5Library.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5Location.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5Object.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5PredType.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5PropList.h
diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp
index 9cf1ee8..e6cacf9 100644
--- a/c++/src/H5AbstractDs.cpp
+++ b/c++/src/H5AbstractDs.cpp
@@ -25,11 +25,6 @@
#include "H5CommonFG.h"
#include "H5Alltypes.h"
-#include <iostream> // remove when done
-
- using std::cerr;
- using std::endl;
-
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
diff --git a/c++/src/H5AbstractDs.h b/c++/src/H5AbstractDs.h
index 1d04d6c..354b47b 100644
--- a/c++/src/H5AbstractDs.h
+++ b/c++/src/H5AbstractDs.h
@@ -65,7 +65,7 @@ class H5_DLLCPP AbstractDs {
// dataset - pure virtual.
virtual hsize_t getStorageSize() const = 0;
- // Returns this class name
+ ///\brief Returns this class name.
virtual H5std_string fromClass() const = 0;
// Copy constructor
diff --git a/c++/src/H5ArrayType.h b/c++/src/H5ArrayType.h
index d50017a..7daafed 100644
--- a/c++/src/H5ArrayType.h
+++ b/c++/src/H5ArrayType.h
@@ -36,7 +36,7 @@ class H5_DLLCPP ArrayType : public DataType {
// Returns the sizes of dimensions of this array datatype.
int getArrayDims(hsize_t* dims);
- // Returns this class name
+ ///\brief Returns this class name.
virtual H5std_string fromClass () const { return("ArrayType"); }
// Copy constructor: makes copy of the original object.
diff --git a/c++/src/H5AtomType.h b/c++/src/H5AtomType.h
index 1ddfd7d..25770f5 100644
--- a/c++/src/H5AtomType.h
+++ b/c++/src/H5AtomType.h
@@ -57,7 +57,7 @@ class H5_DLLCPP AtomType : public DataType {
// Sets the total size for an atomic datatype.
void setSize( size_t size ) const;
- // Returns this class name
+ ///\brief Returns this class name.
virtual H5std_string fromClass () const { return("AtomType"); }
// Copy constructor - makes copy of the original object
diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp
index 226ae5c..120ed39 100644
--- a/c++/src/H5Attribute.cpp
+++ b/c++/src/H5Attribute.cpp
@@ -385,6 +385,31 @@ 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
// Purpose: Get the id of this attribute
// Description:
diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h
index 284e5bc..dd37a99 100644
--- a/c++/src/H5Attribute.h
+++ b/c++/src/H5Attribute.h
@@ -51,7 +51,11 @@ 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;
- // Returns this class name
+ // 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"); }
// Creates a copy of an existing attribute using the attribute id
diff --git a/c++/src/H5Classes.h b/c++/src/H5Classes.h
index f691548..c3b61ca 100644
--- a/c++/src/H5Classes.h
+++ b/c++/src/H5Classes.h
@@ -22,6 +22,7 @@ namespace H5 {
#endif
class Exception;
class IdComponent;
+ class H5Location;
class H5Object;
class PropList;
class FileCreatPropList;
diff --git a/c++/src/H5CompType.h b/c++/src/H5CompType.h
index ae030ee..9b2b572 100644
--- a/c++/src/H5CompType.h
+++ b/c++/src/H5CompType.h
@@ -26,12 +26,21 @@ namespace H5 {
class H5_DLLCPP CompType : public DataType {
public:
+ // Default constructor
+ CompType();
+
+ // Creates a compound datatype using an existing id
+ CompType( const hid_t existing_id );
+
// Creates a new compound datatype, given the type's size
CompType( size_t size ); // H5Tcreate
// Gets the compound datatype of the specified dataset
CompType( const DataSet& dataset ); // H5Dget_type
+ // Copy constructor - makes a copy of original object
+ CompType( const CompType& original );
+
// Returns the type class of the specified member of this compound
// datatype. It provides to the user a way of knowing what type
// to create another datatype of the same class
@@ -88,18 +97,9 @@ class H5_DLLCPP CompType : public DataType {
// Recursively removes padding from within this compound datatype.
void pack() const;
- // Returns this class name
+ ///\brief Returns this class name.
virtual H5std_string fromClass () const { return("CompType"); }
- // Default constructor
- CompType();
-
- // Creates a compound datatype using an existing id
- CompType( const hid_t existing_id );
-
- // Copy constructor - makes a copy of original object
- CompType( const CompType& original );
-
// Noop destructor.
virtual ~CompType();
diff --git a/c++/src/H5Cpp.h b/c++/src/H5Cpp.h
index 75d82ba..ddf4f19 100644
--- a/c++/src/H5Cpp.h
+++ b/c++/src/H5Cpp.h
@@ -22,6 +22,7 @@
#include "H5IdComponent.h"
#include "H5DataSpace.h"
#include "H5PropList.h"
+#include "H5Location.h"
#include "H5Object.h"
#include "H5AbstractDs.h"
#include "H5Attribute.h"
diff --git a/c++/src/H5CppDoc.h b/c++/src/H5CppDoc.h
index b974238..ab3fa79 100644
--- a/c++/src/H5CppDoc.h
+++ b/c++/src/H5CppDoc.h
@@ -30,7 +30,7 @@
* It is assumed that the user has knowledge of the HDF5 file format
* and its components. If you are not familiar with HDF5 file format,
* and would like to find out more, please refer to the HDF5 documentation
- * at http://hdf.ncsa.uiuc.edu/HDF5/doc/H5.intro.html
+ * at http://www.hdfgroup.org/HDF5/doc/index.html
*
* Because the HDF5 library maps very well to
* the object oriented design approach, classes in the C++ API can
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index f7aaa72..6a1524d 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -644,54 +644,6 @@ void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space)
}
}
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-//--------------------------------------------------------------------------
-// Function: DataSet::getObjType
-///\brief Retrieves the type of object that an object reference points to.
-///\param ref_type - IN: Type of reference to query, valid values are:
-/// \li \c H5R_OBJECT - Reference is an object reference.
-/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference.
-///\param ref - IN: Reference to query
-///\return An object type, which can be one of the following:
-/// \li \c H5G_LINK (0) - Object is a symbolic link.
-/// \li \c H5G_GROUP (1) - Object is a group.
-/// \li \c H5G_DATASET (2) - Object is a dataset.
-/// \li \c H5G_TYPE (3) - Object is a named datatype
-///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - May, 2004
-//--------------------------------------------------------------------------
-H5G_obj_t DataSet::getObjType(void *ref, H5R_type_t ref_type) const
-{
- try {
- return(p_get_obj_type(ref, ref_type));
- }
- catch (IdComponentException E) {
- throw DataSetIException("DataSet::getObjType", E.getDetailMsg());
- }
-}
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
-//--------------------------------------------------------------------------
-// Function: DataSet::getRegion
-///\brief Retrieves a dataspace with the region pointed to selected.
-///\param ref - IN: Reference to get region of
-///\param ref_type - IN: Type of reference to get region of - default
-/// to H5R_DATASET_REGION
-///\return DataSpace instance
-///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - May, 2004
-//--------------------------------------------------------------------------
-DataSpace DataSet::getRegion(void *ref, H5R_type_t ref_type) const
-{
- try {
- DataSpace dataspace(p_get_region(ref, ref_type));
- return(dataspace);
- }
- catch (IdComponentException E) {
- throw DataSetIException("DataSet::getRegion", E.getDetailMsg());
- }
-}
-
//--------------------------------------------------------------------------
// Function: DataSet::getId
///\brief Get the id of this dataset.
diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h
index 3d9183d..54e9d6f 100644
--- a/c++/src/H5DataSet.h
+++ b/c++/src/H5DataSet.h
@@ -76,15 +76,10 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
// Iterates the selected elements in the specified dataspace - not implemented in C++ style yet
int iterateElems( void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data = NULL );
-#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;
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
// Retrieves a dataspace with the region pointed to selected.
DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const;
- // Returns this class name
+ ///\brief Returns this class name.
virtual H5std_string fromClass () const { return("DataSet"); }
// Creates a dataset by way of dereference.
@@ -110,6 +105,7 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
private:
hid_t id; // HDF5 dataset id
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
// This function contains the common code that is used by
// getTypeClass and various API functions getXxxType
// defined in AbstractDs for generic datatype and specific
@@ -123,6 +119,7 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
protected:
// Sets the dataset id.
virtual void p_setId(const hid_t new_id);
+#endif // DOXYGEN_SHOULD_SKIP_THIS
};
#ifndef H5_NO_NAMESPACE
}
diff --git a/c++/src/H5DataSpace.h b/c++/src/H5DataSpace.h
index 80842f7..9afb8ab 100644
--- a/c++/src/H5DataSpace.h
+++ b/c++/src/H5DataSpace.h
@@ -103,7 +103,7 @@ class H5_DLLCPP DataSpace : public IdComponent {
// Sets or resets the size of this dataspace.
void setExtentSimple( int rank, const hsize_t *current_size, const hsize_t *maximum_size = NULL ) const;
- // Returns this class name
+ ///\brief Returns this class name.
virtual H5std_string fromClass () const { return("DataSpace"); }
// Creates a DataSpace object using an existing dataspace id.
diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp
index 3edb163..99525bc 100644
--- a/c++/src/H5DataType.cpp
+++ b/c++/src/H5DataType.cpp
@@ -679,51 +679,6 @@ bool DataType::isVariableStr() const
}
}
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-//--------------------------------------------------------------------------
-// Function: DataType::getObjType
-///\brief Retrieves the type of object that an object reference points to.
-///\param ref - IN: Reference to query
-///\param ref_type - IN: Type of reference to query
-///\return Object type, which can be one of the following:
-/// \li \c H5G_LINK Object is a symbolic link.
-/// \li \c H5G_GROUP Object is a group.
-/// \li \c H5G_DATASET Object is a dataset.
-/// \li \c H5G_TYPE Object is a named datatype
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - May, 2004
-//--------------------------------------------------------------------------
-H5G_obj_t DataType::getObjType(void *ref, H5R_type_t ref_type) const
-{
- try {
- return(p_get_obj_type(ref, ref_type));
- }
- catch (IdComponentException E) {
- throw DataTypeIException(inMemFunc("getObjType"), E.getDetailMsg());
- }
-}
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
-//--------------------------------------------------------------------------
-// Function: DataType::getRegion
-///\brief Retrieves a dataspace with the region pointed to selected.
-///\param ref - IN: Reference to get region of
-///\param ref_type - IN: Type of reference to get region of - default
-///\return DataSpace instance
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - May, 2004
-//--------------------------------------------------------------------------
-DataSpace DataType::getRegion(void *ref, H5R_type_t ref_type) const
-{
- try {
- DataSpace dataspace(p_get_region(ref, ref_type));
- return(dataspace);
- }
- catch (IdComponentException E) {
- throw DataTypeIException(inMemFunc("getRegion"), E.getDetailMsg());
- }
-}
-
//--------------------------------------------------------------------------
// Function: DataType::getId
// Purpose: Get the id of this attribute
diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h
index 48aeaf8..98514bb 100644
--- a/c++/src/H5DataType.h
+++ b/c++/src/H5DataType.h
@@ -101,15 +101,10 @@ class H5_DLLCPP DataType : public H5Object {
// Checks whether this datatype is a variable-length string.
bool isVariableStr() 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;
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
// Retrieves a dataspace with the region pointed to selected.
DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const;
- // Returns this class name
+ ///\brief Returns this class name.
virtual H5std_string fromClass () const { return("DataType"); }
// Creates a copy of an existing DataType using its id
diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h
index b7f5823..ac7664e 100644
--- a/c++/src/H5DcreatProp.h
+++ b/c++/src/H5DcreatProp.h
@@ -107,7 +107,7 @@ class H5_DLLCPP DSetCreatPropList : public PropList {
// Sets SZIP compression method.
void setSzip(unsigned int options_mask, unsigned int pixels_per_block) const;
- // Returns this class name
+ ///\brief Returns this class name.
virtual H5std_string fromClass () const { return("DSetCreatPropList"); }
// Copy constructor: creates a copy of a DSetCreatPropList object.
diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h
index 11e15fc..66216d8 100644
--- a/c++/src/H5DxferProp.h
+++ b/c++/src/H5DxferProp.h
@@ -92,7 +92,7 @@ class H5_DLLCPP DSetMemXferPropList : public PropList {
// Determines whether error-detection is enabled for dataset reads.
H5Z_EDC_t getEDCCheck();
- // Returns this class name.
+ ///\brief Returns this class name.
virtual H5std_string fromClass () const { return("DSetMemXferPropList"); }
// Copy constructor: makes a copy of a DSetMemXferPropList object.
diff --git a/c++/src/H5EnumType.h b/c++/src/H5EnumType.h
index 2a2c263..914eb66 100644
--- a/c++/src/H5EnumType.h
+++ b/c++/src/H5EnumType.h
@@ -57,7 +57,7 @@ class H5_DLLCPP EnumType : public DataType {
void valueOf( const char* name, void *value ) const;
void valueOf( const H5std_string& name, void *value ) const;
- // Returns this class name
+ ///\brief Returns this class name.
virtual H5std_string fromClass () const { return("EnumType"); }
// Default constructor
diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h
index 7f133bb..0c2cc21 100644
--- a/c++/src/H5FaccProp.h
+++ b/c++/src/H5FaccProp.h
@@ -123,7 +123,7 @@ class H5_DLLCPP FileAccPropList : public PropList {
// Returns garbage collecting references setting.
unsigned getGcReferences() const;
- // Returns this class name
+ ///\brief Returns this class name.
virtual H5std_string fromClass () const { return("FileAccPropList"); }
// Copy constructor: creates a copy of a FileAccPropList object.
diff --git a/c++/src/H5FcreatProp.h b/c++/src/H5FcreatProp.h
index 1aa102f..61074ea 100644
--- a/c++/src/H5FcreatProp.h
+++ b/c++/src/H5FcreatProp.h
@@ -62,7 +62,7 @@ class H5_DLLCPP FileCreatPropList : public PropList {
// indexing chunked datasets.
void setIstorek( unsigned ik ) const;
- // Returns this class name
+ ///\brief Returns this class name.
virtual H5std_string fromClass () const { return("FileCreatPropList"); }
// Copy constructor: creates a copy of a FileCreatPropList object.
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp
index da0241f..92c4d32 100644
--- a/c++/src/H5File.cpp
+++ b/c++/src/H5File.cpp
@@ -50,7 +50,7 @@ namespace H5 {
///\brief Default constructor: creates a stub H5File object.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5File::H5File() : IdComponent(), id(0) {}
+H5File::H5File() : H5Location(), id(0) {}
//--------------------------------------------------------------------------
// Function: H5File overloaded constructor
@@ -79,7 +79,7 @@ H5File::H5File() : IdComponent(), id(0) {}
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-Create
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : IdComponent(0)
+H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(0)
{
p_get_file(name, flags, create_plist, access_plist);
}
@@ -97,7 +97,7 @@ H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& c
/// FileCreatPropList::DEFAULT
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : IdComponent(0)
+H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(0)
{
p_get_file(name.c_str(), flags, create_plist, access_plist);
}
@@ -140,34 +140,15 @@ void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPro
///\param original - IN: H5File instance to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5File::H5File(const H5File& original) : IdComponent(original)
+H5File::H5File(const H5File& original) : H5Location(original)
{
id = original.getId();
incRefCount(); // increment number of references to this id
}
//--------------------------------------------------------------------------
-// Function: H5File::flush
-///\brief Flushes all buffers associated with a file 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::FileIException
-// Programmer Binh-Minh Ribler - Dec. 2005
-//--------------------------------------------------------------------------
-void H5File::flush(H5F_scope_t scope) const
-{
- herr_t ret_value = H5Fflush( id, scope );
- if( ret_value < 0 )
- {
- throw FileIException("H5File::flush", "H5Fflush failed");
- }
-}
-
-//--------------------------------------------------------------------------
// Function: H5File::isHdf5
-///\brief Determines whether a file in HDF5 format.
+///\brief Determines whether a file in HDF5 format. (Static)
///\param name - IN: Name of the file
///\return true if the file is in HDF5 format, and false, otherwise
///\exception H5::FileIException
@@ -191,7 +172,7 @@ bool H5File::isHdf5(const char* name)
//--------------------------------------------------------------------------
// Function: H5File::isHdf5
///\brief This is an overloaded member function, provided for convenience.
-/// It takes an \c H5std_string for \a name.
+/// It takes an \c H5std_string for \a name. (Static)
///\param name - IN: Name of the file - \c H5std_string
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
@@ -269,8 +250,8 @@ void H5File::reOpen()
throw FileIException("H5File::reOpen", close_error.getDetailMsg());
}
- // call C routine to reopen the file - Note: not sure about this
- // does id need to be closed later? which id to be the parameter?
+ // call C routine to reopen the file - Note: not sure about this,
+ // which id to be the parameter when closing?
id = H5Freopen( id );
if( id < 0 ) // Raise exception when H5Freopen returns a neg value
throw FileIException("H5File::reOpen", "H5Freopen failed");
@@ -278,12 +259,10 @@ void H5File::reOpen()
//--------------------------------------------------------------------------
// Function: H5File::reopen
-///\brief Reopens this file.
-///
-///\exception H5::FileIException
-///\par Description
-/// This function will be replaced by the above function \c reOpen
-/// in future releases.
+// Purpose: Reopens this file.
+// Exception H5::FileIException
+// Description
+// This function is replaced by the above function reOpen.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void H5File::reopen()
@@ -490,70 +469,6 @@ void H5File::getVFDHandle(void **file_handle) const
}
//--------------------------------------------------------------------------
-// Function: H5File::getFileName
-///\brief Gets the name of this file.
-///\return File name
-///\exception H5::FileIException
-// Programmer Binh-Minh Ribler - Jul, 2004
-//--------------------------------------------------------------------------
-H5std_string H5File::getFileName() const
-{
- try {
- return(p_get_file_name());
- }
- catch (IdComponentException E) {
- throw FileIException("H5File::getFileName", E.getDetailMsg());
- }
-}
-
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-//--------------------------------------------------------------------------
-// Function: H5File::getObjType
-///\brief Retrieves the type of object that an object reference points to.
-///\param ref - IN: Reference to query
-///\param ref_type - IN: Type of reference, valid values are:
-/// \li \c H5R_OBJECT - Reference is an object reference
-/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference
-///\return Object type, which can be one of the following:
-/// \li \c H5G_LINK - Object is a symbolic link.
-/// \li \c H5G_GROUP - Object is a group.
-/// \li \c H5G_DATASET - Object is a dataset.
-/// \li \c H5G_TYPE - Object is a named datatype
-///\exception H5::FileIException
-// Programmer Binh-Minh Ribler - May, 2004
-//--------------------------------------------------------------------------
-H5G_obj_t H5File::getObjType(void *ref, H5R_type_t ref_type) const
-{
- try {
- return(p_get_obj_type(ref, ref_type));
- }
- catch (IdComponentException E) {
- throw FileIException("H5File::getObjType", E.getDetailMsg());
- }
-}
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
-//--------------------------------------------------------------------------
-// Function: H5File::getRegion
-///\brief Retrieves a dataspace with the region pointed to selected.
-///\param ref - IN: Reference to get region of
-///\param ref_type - IN: Type of reference to get region of - default
-///\return DataSpace instance
-///\exception H5::FileIException
-// Programmer Binh-Minh Ribler - May, 2004
-//--------------------------------------------------------------------------
-DataSpace H5File::getRegion(void *ref, H5R_type_t ref_type) const
-{
- try {
- DataSpace dataspace(p_get_region(ref, ref_type));
- return(dataspace);
- }
- catch (IdComponentException E) {
- throw FileIException("H5File::getRegion", E.getDetailMsg());
- }
-}
-
-//--------------------------------------------------------------------------
// Function: H5File::getFileSize
///\brief Returns the file size of the HDF5 file.
///\return File size
@@ -575,134 +490,6 @@ hsize_t H5File::getFileSize() const
}
//--------------------------------------------------------------------------
-// Function: H5File::p_reference (protected)
-// Purpose Creates a reference to an HDF5 object or a dataset region.
-// Parameters
-// name - IN: Name of the object to be referenced
-// dataspace - IN: Dataspace with selection
-// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION
-// Exception H5::IdComponentException
-// Programmer Binh-Minh Ribler - May, 2004
-//--------------------------------------------------------------------------
-void H5File::p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const
-{
- herr_t ret_value = H5Rcreate(ref, getId(), name, ref_type, space_id);
- if (ret_value < 0)
- {
- throw IdComponentException("", "H5Rcreate failed");
- }
-}
-
-//--------------------------------------------------------------------------
-// Function: H5File::reference
-///\brief Creates a reference to an HDF5 object or a dataset region.
-///\param ref - IN: Reference pointer
-///\param name - IN: Name of the object to be referenced
-///\param dataspace - IN: Dataspace with selection
-///\param ref_type - IN: Type of reference to query, valid values are:
-/// \li \c H5R_OBJECT - Reference is an object reference
-/// \li \c H5R_DATASET_REGION - Reference is a dataset region
-/// reference - this is the default
-///\exception H5::IdComponentException
-// Programmer Binh-Minh Ribler - May, 2004
-//--------------------------------------------------------------------------
-void H5File::reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type) const
-{
- try {
- p_reference(ref, name, dataspace.getId(), ref_type);
- }
- catch (IdComponentException E) {
- throw IdComponentException("H5File::reference", E.getDetailMsg());
- }
-}
-
-//--------------------------------------------------------------------------
-// Function: H5File::reference
-///\brief This is an overloaded function, provided for your convenience.
-/// It differs from the above function in that it only creates
-/// a reference to an HDF5 object, not to a dataset region.
-///\param ref - IN: Reference pointer
-///\param name - IN: Name of the object to be referenced - \c char pointer
-///\exception H5::IdComponentException
-///\par Description
-// This function passes H5R_OBJECT and -1 to the protected
-// function for it to pass to the C API H5Rcreate
-// to create a reference to the named object.
-// Programmer Binh-Minh Ribler - May, 2004
-//--------------------------------------------------------------------------
-void H5File::reference(void* ref, const char* name) const
-{
- try {
- p_reference(ref, name, -1, H5R_OBJECT);
- }
- catch (IdComponentException E) {
- throw IdComponentException("H5File::reference", E.getDetailMsg());
- }
-}
-//--------------------------------------------------------------------------
-// Function: H5File::reference
-///\brief This is an overloaded function, provided for your convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for the object's name.
-///\param ref - IN: Reference pointer
-///\param name - IN: Name of the object to be referenced - \c H5std_string
-// Programmer Binh-Minh Ribler - May, 2004
-//--------------------------------------------------------------------------
-void H5File::reference(void* ref, const H5std_string& name) const
-{
- reference(ref, name.c_str());
-}
-
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-//--------------------------------------------------------------------------
-// Function: H5File::p_get_obj_type (protected)
-// Purpose Retrieves the type of object that an object reference points to.
-// Parameters
-// ref - IN: Reference to query
-// ref_type - IN: Type of reference to query
-// Return An object type, which can be one of the following:
-// H5G_LINK Object is a symbolic link.
-// H5G_GROUP Object is a group.
-// H5G_DATASET Object is a dataset.
-// H5G_TYPE Object is a named datatype
-// Exception H5::IdComponentException
-// Programmer Binh-Minh Ribler - May, 2004
-//--------------------------------------------------------------------------
-H5G_obj_t H5File::p_get_obj_type(void *ref, H5R_type_t ref_type) const
-{
- H5G_obj_t obj_type = H5Rget_obj_type1(getId(), ref_type, ref);
-
- if (obj_type == H5G_UNKNOWN)
- {
- throw IdComponentException("", "H5Rget_obj_type failed");
- }
- return(obj_type);
-}
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
-
-//--------------------------------------------------------------------------
-// Function: H5File::p_get_region (protected)
-// Purpose Retrieves a dataspace with the region pointed to selected.
-// Parameters
-// ref_type - IN: Type of reference to get region of - default
-// to H5R_DATASET_REGION
-// ref - IN: Reference to get region of
-// Return Dataspace id
-// Exception H5::IdComponentException
-// Programmer Binh-Minh Ribler - May, 2004
-//--------------------------------------------------------------------------
-hid_t H5File::p_get_region(void *ref, H5R_type_t ref_type) const
-{
- hid_t space_id = H5Rget_region(getId(), ref_type, ref);
- if (space_id < 0)
- {
- throw IdComponentException("", "H5Rget_region failed");
- }
- return(space_id);
-}
-
-//--------------------------------------------------------------------------
// Function: H5File::getLocId
// Purpose: Get the id of this file
// Description
diff --git a/c++/src/H5File.h b/c++/src/H5File.h
index b69c963..cfb6bdf 100644
--- a/c++/src/H5File.h
+++ b/c++/src/H5File.h
@@ -21,7 +21,7 @@
namespace H5 {
#endif
-class H5_DLLCPP H5File : public IdComponent, public CommonFG {
+class H5_DLLCPP H5File : public H5Location, public CommonFG {
public:
// Creates or opens an HDF5 file.
H5File( const char* name, unsigned int flags,
@@ -40,18 +40,12 @@ class H5_DLLCPP H5File : public IdComponent, public CommonFG {
// Close this file.
virtual void close();
- // Flushes all buffers associated with this file to disk
- void flush(H5F_scope_t scope) const;
-
// Gets the access property list of this file.
FileAccPropList getAccessPlist() const;
// Gets the creation property list of this file.
FileCreatPropList getCreatePlist() const;
- // Gets the name of this file.
- H5std_string getFileName() const;
-
// Retrieves the file size of an opened file.
hsize_t getFileSize() const;
@@ -67,11 +61,6 @@ class H5_DLLCPP H5File : public IdComponent, public CommonFG {
// and datatypes) in the same file.
void getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) 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;
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
// Retrieves a dataspace with the region pointed to selected.
DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const;
@@ -87,14 +76,7 @@ class H5_DLLCPP H5File : public IdComponent, public CommonFG {
void reOpen(); // added for better name
void reopen();
- // Creates a reference to a named HDF5 object or to a dataset region
- // in this object.
- void reference(void* ref, const char* name, const DataSpace& dataspace,
- H5R_type_t ref_type = H5R_DATASET_REGION) const;
- void reference(void* ref, const char* name) const;
- void reference(void* ref, const H5std_string& name) const;
-
- // Returns this class name
+ ///\brief Returns this class name.
virtual H5std_string fromClass () const { return("H5File"); }
// Throw file exception.
@@ -124,17 +106,6 @@ class H5_DLLCPP H5File : public IdComponent, public CommonFG {
// constructors taking a string or a char*
void p_get_file( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist );
- // Creates a reference to an HDF5 object or a dataset region.
- void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const;
-
-#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Retrieves the type of object that an object reference points to.
- H5G_obj_t p_get_obj_type(void *ref, H5R_type_t ref_type) const;
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
- // Retrieves a dataspace with the region pointed to selected.
- hid_t p_get_region(void *ref, H5R_type_t ref_type) const;
-
protected:
// Sets the HDF5 file id.
virtual void p_setId(const hid_t new_id);
diff --git a/c++/src/H5FloatType.h b/c++/src/H5FloatType.h
index 7444bd5..cbb9541 100644
--- a/c++/src/H5FloatType.h
+++ b/c++/src/H5FloatType.h
@@ -53,7 +53,7 @@ class H5_DLLCPP FloatType : public AtomType {
// Sets the mantissa normalization of a floating-point datatype.
void setNorm( H5T_norm_t norm ) const;
- // Returns this class name
+ ///\brief Returns this class name.
virtual H5std_string fromClass () const { return("FloatType"); }
// Default constructor
diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp
index 6ec2dbb..e83b635 100644
--- a/c++/src/H5Group.cpp
+++ b/c++/src/H5Group.cpp
@@ -147,53 +147,6 @@ Group::Group(Attribute& attr, const void* ref, H5R_type_t ref_type) : H5Object()
}
}
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-//--------------------------------------------------------------------------
-// Function: Group::getObjType
-///\brief Retrieves the type of object that an object reference points to.
-///\param ref - IN: Reference to query
-///\param ref_type - IN: Type of reference to query, valid values are:
-/// \li \c H5R_OBJECT - Reference is an object reference.
-/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference.
-///\return An object type, which can be one of the following:
-/// \li \c H5G_LINK (0) - Object is a symbolic link.
-/// \li \c H5G_GROUP (1) - Object is a group.
-/// \li \c H5G_DATASET (2) - Object is a dataset.
-/// \li \c H5G_TYPE (3) - Object is a named datatype
-///\exception H5::GroupIException
-// Programmer Binh-Minh Ribler - May, 2004
-//--------------------------------------------------------------------------
-H5G_obj_t Group::getObjType(void *ref, H5R_type_t ref_type) const
-{
- try {
- return(p_get_obj_type(ref, ref_type));
- }
- catch (IdComponentException E) {
- throw GroupIException("Group::getObjType", E.getDetailMsg());
- }
-}
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
-//--------------------------------------------------------------------------
-// Function: Group::getRegion
-///\brief Retrieves a dataspace with the region pointed to selected.
-///\param ref - IN: Reference to get region of
-///\param ref_type - IN: Type of reference to get region of - default
-///\return DataSpace instance
-///\exception H5::GroupIException
-// Programmer Binh-Minh Ribler - May, 2004
-//--------------------------------------------------------------------------
-DataSpace Group::getRegion(void *ref, H5R_type_t ref_type) const
-{
- try {
- DataSpace dataspace(p_get_region(ref, ref_type));
- return(dataspace);
- }
- catch (IdComponentException E) {
- throw GroupIException("Group::getRegion", E.getDetailMsg());
- }
-}
-
//--------------------------------------------------------------------------
// Function: Group::getId
// Purpose: Get the id of this attribute
diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h
index 9978cf0..e4c2415 100644
--- a/c++/src/H5Group.h
+++ b/c++/src/H5Group.h
@@ -26,15 +26,10 @@ class H5_DLLCPP Group : public H5Object, public CommonFG {
// Close this group.
virtual void close();
-#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;
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
// Retrieves a dataspace with the region pointed to selected.
DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const;
- // Returns this class name
+ ///\brief Returns this class name.
virtual H5std_string fromClass () const { return("Group"); }
// Throw group exception.
diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h
index b217c10..7dc1da3 100644
--- a/c++/src/H5IdComponent.h
+++ b/c++/src/H5IdComponent.h
@@ -65,7 +65,7 @@ class H5_DLLCPP IdComponent {
// <class-name> is returned by fromClass().
H5std_string inMemFunc(const char* func_name) const;
- // Returns this class name.
+ ///\brief Returns this class name.
virtual H5std_string fromClass() const { return("IdComponent");}
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5IntType.h b/c++/src/H5IntType.h
index b712103..53864ee 100644
--- a/c++/src/H5IntType.h
+++ b/c++/src/H5IntType.h
@@ -35,7 +35,7 @@ class H5_DLLCPP IntType : public AtomType {
// Sets the sign proprety for an integer type.
void setSign( H5T_sign_t sign ) const;
- // Returns this class name
+ ///\brief Returns this class name.
virtual H5std_string fromClass () const { return("IntType"); }
// Default constructor
diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp
new file mode 100644
index 0000000..b93cd86
--- /dev/null
+++ b/c++/src/H5Location.cpp
@@ -0,0 +1,669 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <string>
+
+#include "H5Include.h"
+#include "H5Exception.h"
+#include "H5IdComponent.h"
+#include "H5PropList.h"
+#include "H5Location.h"
+#include "H5Object.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 "H5File.h"
+#include "H5DataSet.h"
+#include "H5Attribute.h"
+
+#ifndef H5_NO_NAMESPACE
+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 = static_cast <UserData4Aiterate *> (op_data);
+#endif
+ myData->op( *myData->location, s_attr_name, myData->opData );
+ return 0;
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location default constructor (protected)
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+H5Location::H5Location() : IdComponent(0) {}
+
+//--------------------------------------------------------------------------
+// Function: H5Location overloaded constructor (protected)
+// Purpose Creates an H5Location object using the id of an existing HDF5
+// object.
+// Parameters object_id - IN: Id of an existing HDF5 object
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+H5Location::H5Location(const hid_t object_id) : IdComponent(object_id) {}
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
+//--------------------------------------------------------------------------
+// Function: H5Location copy constructor
+///\brief Copy constructor: makes a copy of the original H5Location
+/// instance.
+///\param original - IN: H5Location instance to copy
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+H5Location::H5Location( const H5Location& original ) : IdComponent( original ) {}
+
+//--------------------------------------------------------------------------
+// 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( 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( 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, (hsize_t)idx, H5P_DEFAULT, H5P_DEFAULT);
+ if( attr_id > 0 )
+ {
+ Attribute 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 ? (hsize_t)*_idx : 0;
+ int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx,
+ userAttrOpWrpr, (void *) userData);
+
+ // release memory
+ delete userData;
+
+ if( ret_value >= 0 ) {
+ /* Pass back update index value to calling code */
+ if (_idx)
+ *_idx = (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( (int)oinfo.num_attrs );
+}
+
+//--------------------------------------------------------------------------
+// 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,
+/// 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::FileIException
+///\par Description
+/// This location is used to identify the file to be flushed.
+// Programmer Binh-Minh Ribler - 2012
+// Modification
+// Sep 2012 - BMR
+// Moved from H5File/H5Object
+//--------------------------------------------------------------------------
+void H5Location::flush(H5F_scope_t scope) const
+{
+ herr_t ret_value = H5Fflush(getId(), scope);
+ if( ret_value < 0 )
+ {
+ throw FileIException(inMemFunc("flush"), "H5Fflush failed");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::getFileName
+///\brief Gets the name of the file, in which this HDF5 object belongs.
+///\return File name
+///\exception H5::IdComponentException
+// Programmer Binh-Minh Ribler - Jul, 2004
+//--------------------------------------------------------------------------
+H5std_string H5Location::getFileName() const
+{
+ try {
+ return(p_get_file_name());
+ }
+ catch (IdComponentException E) {
+ throw FileIException(inMemFunc("getFileName"), E.getDetailMsg());
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::p_reference (protected)
+// Purpose Creates a reference to an HDF5 object or a dataset region.
+// Parameters
+// name - IN: Name of the object to be referenced
+// dataspace - IN: Dataspace with selection
+// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION
+// Exception H5::IdComponentException
+// Programmer Binh-Minh Ribler - May, 2004
+//--------------------------------------------------------------------------
+void H5Location::p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const
+{
+ herr_t ret_value = H5Rcreate(ref, getId(), name, ref_type, space_id);
+ if (ret_value < 0)
+ {
+ throw ReferenceException("", "H5Rcreate failed");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::reference
+///\brief Creates a reference to an HDF5 object or a dataset region.
+///\param ref - IN: Reference pointer
+///\param name - IN: Name of the object to be referenced
+///\param dataspace - IN: Dataspace with selection
+///\param ref_type - IN: Type of reference to query, valid values are:
+/// \li \c H5R_OBJECT - Reference is an object reference.
+/// \li \c H5R_DATASET_REGION - Reference is a dataset region
+/// reference. - this is the default
+///\exception H5::ReferenceException
+// Programmer Binh-Minh Ribler - May, 2004
+//--------------------------------------------------------------------------
+void H5Location::reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type) const
+{
+ try {
+ p_reference(ref, name, dataspace.getId(), ref_type);
+ }
+ catch (ReferenceException E) {
+ throw ReferenceException("H5Location::reference", E.getDetailMsg());
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::reference
+///\brief This is an overloaded function, provided for your convenience.
+/// It differs from the above function in that it only creates
+/// a reference to an HDF5 object, not to a dataset region.
+///\param ref - IN: Reference pointer
+///\param name - IN: Name of the object to be referenced - \c char pointer
+///\exception H5::ReferenceException
+///\par Description
+// This function passes H5R_OBJECT and -1 to the protected
+// function for it to pass to the C API H5Rcreate
+// to create a reference to the named object.
+// Programmer Binh-Minh Ribler - May, 2004
+//--------------------------------------------------------------------------
+void H5Location::reference(void* ref, const char* name) const
+{
+ try {
+ p_reference(ref, name, -1, H5R_OBJECT);
+ }
+ catch (ReferenceException E) {
+ throw ReferenceException("H5Location::reference", E.getDetailMsg());
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::reference
+///\brief This is an overloaded function, provided for your convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for the object's name.
+///\param ref - IN: Reference pointer
+///\param name - IN: Name of the object to be referenced - \c H5std_string
+// Programmer Binh-Minh Ribler - May, 2004
+//--------------------------------------------------------------------------
+void H5Location::reference(void* ref, const H5std_string& name) const
+{
+ reference(ref, name.c_str());
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::p_dereference (protected)
+// Purpose Dereference a ref into an hdf5 object.
+// Parameters
+// loc_id - IN: An hdf5 identifier specifying the location of the
+// referenced object
+// ref - IN: Reference pointer
+// ref_type - IN: Reference type
+// Exception H5::ReferenceException
+// Programmer Binh-Minh Ribler - Oct, 2006
+// Modification
+// May 2008 - BMR
+// Moved from IdComponent.
+//--------------------------------------------------------------------------
+hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type)
+{
+ hid_t temp_id;
+ temp_id = H5Rdereference2(loc_id, H5P_DEFAULT, ref_type, ref);
+ if (temp_id < 0)
+ {
+ throw ReferenceException("", "H5Rdereference failed");
+ }
+
+ // No failure, set id to the object
+ return(temp_id);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::dereference
+///\brief Dereferences a reference into an HDF5 object, given an HDF5 object.
+///\param obj - IN: Object specifying the location of the referenced object
+///\param ref - IN: Reference pointer
+///\param ref_type - IN: Reference type
+///\exception H5::ReferenceException
+// Programmer Binh-Minh Ribler - Oct, 2006
+// Modification
+// May, 2008
+// Corrected missing parameters. - BMR
+//--------------------------------------------------------------------------
+void H5Location::dereference(H5Object& obj, const void* ref, H5R_type_t ref_type)
+{
+ hid_t temp_id;
+ try {
+ temp_id = p_dereference(obj.getId(), ref, ref_type);
+ }
+ catch (ReferenceException E) {
+ throw ReferenceException("H5Location::dereference - located by object", E.getDetailMsg());
+ }
+ p_setId(temp_id);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::dereference
+///\brief Dereferences a reference into an HDF5 object, given an HDF5 file.
+///\param h5file - IN: HDF5 file specifying the location of the referenced object
+///\param ref - IN: Reference pointer
+///\param ref_type - IN: Reference type
+///\exception H5::ReferenceException
+// Programmer Binh-Minh Ribler - Oct, 2006
+// Modification
+// May, 2008
+// Corrected missing parameters. - BMR
+//--------------------------------------------------------------------------
+void H5Location::dereference(H5File& h5file, const void* ref, H5R_type_t ref_type)
+{
+ hid_t temp_id;
+ try {
+ temp_id = p_dereference(h5file.getId(), ref, ref_type);
+ }
+ catch (ReferenceException E) {
+ throw ReferenceException("H5Location::dereference - located by file", E.getDetailMsg());
+ }
+ p_setId(temp_id);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::dereference
+///\brief Dereferences a reference into an HDF5 object, given an attribute.
+///\param attr - IN: Attribute specifying the location of the referenced object
+///\param ref - IN: Reference pointer
+///\param ref_type - IN: Reference type
+///\exception H5::ReferenceException
+// Programmer Binh-Minh Ribler - Oct, 2006
+// Modification
+// May, 2008
+// Corrected missing parameters. - BMR
+//--------------------------------------------------------------------------
+void H5Location::dereference(Attribute& attr, const void* ref, H5R_type_t ref_type)
+{
+ hid_t temp_id;
+ try {
+ temp_id = p_dereference(attr.getId(), ref, ref_type);
+ }
+ catch (ReferenceException E) {
+ throw ReferenceException("H5Location::dereference - located by attribute", E.getDetailMsg());
+ }
+ p_setId(temp_id);
+}
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+//--------------------------------------------------------------------------
+// Function: H5Location::getObjType
+///\brief Retrieves the type of object that an object reference points to.
+///\param ref_type - IN: Type of reference to query, valid values are:
+/// \li \c H5R_OBJECT \tReference is an object reference.
+/// \li \c H5R_DATASET_REGION \tReference is a dataset region reference.
+///\param ref - IN: Reference to query
+///\return An object type, which can be one of the following:
+/// \li \c H5G_UNKNOWN \tA failure occurs. (-1)
+/// \li \c H5G_GROUP \tObject is a group.
+/// \li \c H5G_DATASET \tObject is a dataset.
+/// \li \c H5G_TYPE Object \tis a named datatype
+/// \li \c H5G_LINK \tObject is a symbolic link.
+/// \li \c H5G_UDLINK \tObject is a user-defined link.
+///\exception H5::ReferenceException
+// Programmer Binh-Minh Ribler - May, 2004
+// Modification
+// Sep 2012: Moved up from H5File, Group, DataSet, and DataType
+//--------------------------------------------------------------------------
+H5G_obj_t H5Location::getObjType(void *ref, H5R_type_t ref_type) const
+{
+ try {
+ return(p_get_obj_type(ref, ref_type));
+ }
+ catch (ReferenceException E) {
+ throw ReferenceException("H5Location::getObjType", E.getDetailMsg());
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::p_get_obj_type (protected)
+// Purpose Retrieves the type of object that an object reference points to.
+// Parameters
+// ref - IN: Reference to query
+// ref_type - IN: Type of reference to query
+// Return An object type, which can be one of the following:
+// H5G_UNKNOWN \tFailure occurs (-1)
+// H5G_GROUP \tObject is a group.
+// H5G_DATASET \tObject is a dataset.
+// H5G_TYPE Object \tis a named datatype.
+// H5G_LINK \tObject is a symbolic link.
+// H5G_UDLINK \tObject is a user-defined link.
+// Exception H5::ReferenceException
+// Programmer Binh-Minh Ribler - May, 2004
+//--------------------------------------------------------------------------
+H5G_obj_t H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const
+{
+ H5G_obj_t obj_type = H5Rget_obj_type1(getId(), ref_type, ref);
+
+ if (obj_type == H5G_UNKNOWN)
+ {
+ throw ReferenceException("", "H5Rget_obj_type1 failed");
+ }
+ return(obj_type);
+}
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+
+//--------------------------------------------------------------------------
+// Function: H5Location::getRefObjType
+///\brief Retrieves the type of object that an object reference points to.
+///\param ref - IN: Reference to query
+///\param ref_type - IN: Type of reference to query, valid values are:
+/// \li \c H5R_OBJECT - Reference is an object reference.
+/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference.
+///\return An object type, which can be one of the following:
+/// \li \c H5O_TYPE_UNKNOWN - Unknown object type (-1)
+/// \li \c H5O_TYPE_GROUP - Object is a group
+/// \li \c H5O_TYPE_DATASET - Object is a dataset
+/// \li \c H5O_TYPE_NAMED_DATATYPE - Object is a named datatype
+/// \li \c H5O_TYPE_NTYPES - Number of different object types
+///\exception H5::ReferenceException
+// Programmer Binh-Minh Ribler - May, 2004
+//--------------------------------------------------------------------------
+H5O_type_t H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const
+{
+ try {
+ return(p_get_ref_obj_type(ref, ref_type));
+ }
+ catch (ReferenceException E) {
+ throw ReferenceException("H5Location::getRefObjType", E.getDetailMsg());
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::p_get_ref_obj_type (protected)
+// Purpose Retrieves the type of object that an object reference points to.
+// Parameters
+// ref - IN: Reference to query
+// ref_type - IN: Type of reference to query
+// Return An object type, which can be one of the following:
+// H5O_TYPE_UNKNOWN - Unknown object type (-1)
+// H5O_TYPE_GROUP - Object is a group
+// H5O_TYPE_DATASET - Object is a dataset
+// H5O_TYPE_NAMED_DATATYPE - Object is a named datatype
+// H5O_TYPE_NTYPES - Number of object types
+// Exception H5::ReferenceException
+// Programmer Binh-Minh Ribler - May, 2004
+//--------------------------------------------------------------------------
+H5O_type_t H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const
+{
+ H5O_type_t obj_type = H5O_TYPE_UNKNOWN;
+ herr_t ret_value = H5Rget_obj_type2(getId(), ref_type, ref, &obj_type);
+
+ if (obj_type == H5O_TYPE_UNKNOWN || obj_type >= H5O_TYPE_NTYPES)
+ {
+ throw ReferenceException("", "H5Rget_obj_type2 failed");
+ }
+ return(obj_type);
+}
+
+
+//--------------------------------------------------------------------------
+// Function: H5Location::p_get_region (protected)
+// Purpose Retrieves a dataspace with the region pointed to selected.
+// Parameters
+// ref_type - IN: Type of reference to get region of - default
+// to H5R_DATASET_REGION
+// ref - IN: Reference to get region of
+// Return Dataspace id
+// Exception H5::ReferenceException
+// Programmer Binh-Minh Ribler - May, 2004
+//--------------------------------------------------------------------------
+hid_t H5Location::p_get_region(void *ref, H5R_type_t ref_type) const
+{
+ hid_t space_id = H5Rget_region(getId(), ref_type, ref);
+ if (space_id < 0)
+ {
+ throw ReferenceException("", "H5Rget_region failed");
+ }
+ return(space_id);
+}
+
+
+//--------------------------------------------------------------------------
+// Function: H5Location destructor
+///\brief Noop destructor.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+H5Location::~H5Location() {}
+
+#ifndef H5_NO_NAMESPACE
+} // end namespace
+#endif
diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h
new file mode 100644
index 0000000..d1dd892
--- /dev/null
+++ b/c++/src/H5Location.h
@@ -0,0 +1,146 @@
+// C++ informative line for the emacs editor: -*- C++ -*-
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _H5Location_H
+#define _H5Location_H
+
+#include "H5Classes.h" // constains forward class declarations
+
+// H5Location is an abstract class. It provides a collection of wrappers
+// of C functions which take location IDs. Most of these were in H5Object
+// but are now moved here for H5File's access.
+
+#ifndef H5_NO_NAMESPACE
+namespace H5 {
+#endif
+
+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*/);
+
+class UserData4Aiterate { // user data for attribute iteration
+ public:
+ attr_operator_t op;
+ void* opData;
+ H5Location* location;
+};
+
+// An H5Location can be a file, group, dataset, named datatype, or attribute.
+
+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;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+ // Retrieves the type of object that an object reference points to.
+ H5O_type_t getRefObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
+ // 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 );
+
+ // Removes the named attribute from this location.
+ void removeAttr( const char* name ) const;
+ void removeAttr( 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;
+
+ // Creates a reference to a named object or to a dataset region
+ // in this object.
+ void reference(void* ref, const char* name, const DataSpace& dataspace,
+ H5R_type_t ref_type = H5R_DATASET_REGION) const;
+ void reference(void* ref, const char* name) const;
+ void reference(void* ref, const H5std_string& name) const;
+
+ // Open a referenced object whose location is specified by either
+ // a file, an HDF5 object, or an attribute.
+ void dereference(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
+ void dereference(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
+ void dereference(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
+
+ // For subclasses.
+ virtual hid_t getId() const = 0;
+
+ protected:
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+ // Default constructor,
+ H5Location();
+
+ // Creates a copy of an existing object giving the location id.
+ H5Location(const hid_t loc_id);
+
+ // Copy constructor.
+ H5Location(const H5Location& original);
+
+ // Creates a reference to an HDF5 object or a dataset region.
+ void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const;
+
+ // Dereferences a ref into an HDF5 id.
+ hid_t p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type);
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ // Retrieves the type of object that an object reference points to.
+ H5G_obj_t p_get_obj_type(void *ref, H5R_type_t ref_type) const;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+ // Retrieves the type of object that an object reference points to.
+ H5O_type_t p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const;
+
+ // Retrieves a dataspace with the region pointed to selected.
+ hid_t p_get_region(void *ref, H5R_type_t ref_type) const;
+
+ // Noop destructor.
+ virtual ~H5Location();
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
+}; /* end class H5Location */
+
+#ifndef H5_NO_NAMESPACE
+}
+#endif
+#endif
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp
index 3c85502..e29e80e 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -37,30 +37,11 @@ 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 = static_cast <UserData4Aiterate *> (op_data);
-#endif
- myData->op( *myData->object, s_attr_name, myData->opData );
- return 0;
-}
-
//--------------------------------------------------------------------------
// Function: H5Object default constructor (protected)
-// Description
-// The id is set by IdComponent() but subclass constructor will
-// set it to a valid HDF5 id.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5Object::H5Object() : IdComponent(0) {}
+H5Object::H5Object() : H5Location() {}
//--------------------------------------------------------------------------
// Function: H5Object overloaded constructor (protected)
@@ -69,7 +50,7 @@ H5Object::H5Object() : IdComponent(0) {}
// Parameters object_id - IN: Id of an existing HDF5 object
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5Object::H5Object( const hid_t object_id ) : IdComponent( object_id ) {}
+H5Object::H5Object( const hid_t object_id ) : H5Location( object_id ) {}
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -80,496 +61,7 @@ H5Object::H5Object( const hid_t object_id ) : IdComponent( object_id ) {}
///\param original - IN: H5Object instance to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5Object::H5Object( const H5Object& original ) : IdComponent( original ) {}
-
-//--------------------------------------------------------------------------
-// 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( 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( 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, (hsize_t)idx, H5P_DEFAULT, H5P_DEFAULT);
- if( attr_id > 0 )
- {
- Attribute 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::H5Object&, 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->object = this;
-
- // call the C library routine H5Aiterate2 to iterate the attributes
- hsize_t idx = _idx ? (hsize_t)*_idx : 0;
- int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx,
- userAttrOpWrpr, (void *) userData);
-
- // release memory
- delete userData;
-
- if( ret_value >= 0 ) {
- /* Pass back update index value to calling code */
- if (_idx)
- *_idx = (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( (int)oinfo.num_attrs );
-}
-
-//--------------------------------------------------------------------------
-// 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: H5Object::flush
-///\brief Flushes all buffers associated with a file 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 object is used to identify the file to be flushed.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void H5Object::flush(H5F_scope_t scope) const
-{
- herr_t ret_value = H5Fflush(getId(), scope);
- if( ret_value < 0 )
- {
- throw FileIException(inMemFunc("flush"), "H5Fflush failed");
- }
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Object::getFileName
-///\brief Gets the name of the file, in which this HDF5 object belongs.
-///\return File name
-///\exception H5::IdComponentException
-// Programmer Binh-Minh Ribler - Jul, 2004
-//--------------------------------------------------------------------------
-H5std_string H5Object::getFileName() const
-{
- try {
- return(p_get_file_name());
- }
- catch (IdComponentException E) {
- throw FileIException(inMemFunc("getFileName"), E.getDetailMsg());
- }
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Object::p_reference (protected)
-// Purpose Creates a reference to an HDF5 object or a dataset region.
-// Parameters
-// name - IN: Name of the object to be referenced
-// dataspace - IN: Dataspace with selection
-// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION
-// Exception H5::IdComponentException
-// Programmer Binh-Minh Ribler - May, 2004
-//--------------------------------------------------------------------------
-void H5Object::p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const
-{
- herr_t ret_value = H5Rcreate(ref, getId(), name, ref_type, space_id);
- if (ret_value < 0)
- {
- throw IdComponentException("", "H5Rcreate failed");
- }
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Object::reference
-///\brief Creates a reference to an HDF5 object or a dataset region.
-///\param ref - IN: Reference pointer
-///\param name - IN: Name of the object to be referenced
-///\param dataspace - IN: Dataspace with selection
-///\param ref_type - IN: Type of reference to query, valid values are:
-/// \li \c H5R_OBJECT - Reference is an object reference.
-/// \li \c H5R_DATASET_REGION - Reference is a dataset region
-/// reference. - this is the default
-///\exception H5::IdComponentException
-// Programmer Binh-Minh Ribler - May, 2004
-//--------------------------------------------------------------------------
-void H5Object::reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type) const
-{
- try {
- p_reference(ref, name, dataspace.getId(), ref_type);
- }
- catch (IdComponentException E) {
- throw IdComponentException("H5Object::reference", E.getDetailMsg());
- }
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Object::reference
-///\brief This is an overloaded function, provided for your convenience.
-/// It differs from the above function in that it only creates
-/// a reference to an HDF5 object, not to a dataset region.
-///\param ref - IN: Reference pointer
-///\param name - IN: Name of the object to be referenced - \c char pointer
-///\exception H5::IdComponentException
-///\par Description
-// This function passes H5R_OBJECT and -1 to the protected
-// function for it to pass to the C API H5Rcreate
-// to create a reference to the named object.
-// Programmer Binh-Minh Ribler - May, 2004
-//--------------------------------------------------------------------------
-void H5Object::reference(void* ref, const char* name) const
-{
- try {
- p_reference(ref, name, -1, H5R_OBJECT);
- }
- catch (IdComponentException E) {
- throw IdComponentException("H5Object::reference", E.getDetailMsg());
- }
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Object::reference
-///\brief This is an overloaded function, provided for your convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for the object's name.
-///\param ref - IN: Reference pointer
-///\param name - IN: Name of the object to be referenced - \c H5std_string
-// Programmer Binh-Minh Ribler - May, 2004
-//--------------------------------------------------------------------------
-void H5Object::reference(void* ref, const H5std_string& name) const
-{
- reference(ref, name.c_str());
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Object::p_dereference (protected)
-// Purpose Dereference a ref into an hdf5 object.
-// Parameters
-// loc_id - IN: An hdf5 identifier specifying the location of the
-// referenced object
-// ref - IN: Reference pointer
-// ref_type - IN: Reference type
-// Exception H5::ReferenceException
-// Programmer Binh-Minh Ribler - Oct, 2006
-// Modification
-// May 2008 - BMR
-// Moved from IdComponent.
-//--------------------------------------------------------------------------
-hid_t H5Object::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type)
-{
- hid_t temp_id;
- temp_id = H5Rdereference2(loc_id, H5P_DEFAULT, ref_type, ref);
- if (temp_id < 0)
- {
- throw ReferenceException("", "H5Rdereference failed");
- }
-
- // No failure, set id to the object
- return(temp_id);
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Object::dereference
-///\brief Dereferences a reference into an HDF5 object, given an HDF5 object.
-///\param obj - IN: Object specifying the location of the referenced object
-///\param ref - IN: Reference pointer
-///\param ref_type - IN: Reference type
-///\exception H5::ReferenceException
-// Programmer Binh-Minh Ribler - Oct, 2006
-// Modification
-// May, 2008
-// Corrected missing parameters. - BMR
-//--------------------------------------------------------------------------
-void H5Object::dereference(H5Object& obj, const void* ref, H5R_type_t ref_type)
-{
- hid_t temp_id;
- try {
- temp_id = p_dereference(obj.getId(), ref, ref_type);
- }
- catch (ReferenceException E) {
- throw ReferenceException("H5Object::dereference - located by object", E.getDetailMsg());
- }
- p_setId(temp_id);
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Object::dereference
-///\brief Dereferences a reference into an HDF5 object, given an HDF5 file.
-///\param h5file - IN: HDF5 file specifying the location of the referenced object
-///\param ref - IN: Reference pointer
-///\param ref_type - IN: Reference type
-///\exception H5::ReferenceException
-// Programmer Binh-Minh Ribler - Oct, 2006
-// Modification
-// May, 2008
-// Corrected missing parameters. - BMR
-//--------------------------------------------------------------------------
-void H5Object::dereference(H5File& h5file, const void* ref, H5R_type_t ref_type)
-{
- hid_t temp_id;
- try {
- temp_id = p_dereference(h5file.getId(), ref, ref_type);
- }
- catch (ReferenceException E) {
- throw ReferenceException("H5Object::dereference - located by file", E.getDetailMsg());
- }
- p_setId(temp_id);
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Object::dereference
-///\brief Dereferences a reference into an HDF5 object, given an attribute.
-///\param attr - IN: Attribute specifying the location of the referenced object
-///\param ref - IN: Reference pointer
-///\param ref_type - IN: Reference type
-///\exception H5::ReferenceException
-// Programmer Binh-Minh Ribler - Oct, 2006
-// Modification
-// May, 2008
-// Corrected missing parameters. - BMR
-//--------------------------------------------------------------------------
-void H5Object::dereference(Attribute& attr, const void* ref, H5R_type_t ref_type)
-{
- hid_t temp_id;
- try {
- temp_id = p_dereference(attr.getId(), ref, ref_type);
- }
- catch (ReferenceException E) {
- throw ReferenceException("H5Object::dereference - located by attribute", E.getDetailMsg());
- }
- p_setId(temp_id);
-}
-
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-//--------------------------------------------------------------------------
-// Function: H5Object::p_get_obj_type (protected)
-// Purpose Retrieves the type of object that an object reference points to.
-// Parameters
-// ref - IN: Reference to query
-// ref_type - IN: Type of reference to query
-// Return An object type, which can be one of the following:
-// H5G_LINK Object is a symbolic link.
-// H5G_GROUP Object is a group.
-// H5G_DATASET Object is a dataset.
-// H5G_TYPE Object is a named datatype
-// Exception H5::IdComponentException
-// Programmer Binh-Minh Ribler - May, 2004
-//--------------------------------------------------------------------------
-H5G_obj_t H5Object::p_get_obj_type(void *ref, H5R_type_t ref_type) const
-{
- H5G_obj_t obj_type = H5Rget_obj_type1(getId(), ref_type, ref);
-
- if (obj_type == H5G_UNKNOWN)
- {
- throw IdComponentException("", "H5Rget_obj_type failed");
- }
- return(obj_type);
-}
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
-
-//--------------------------------------------------------------------------
-// Function: H5Object::p_get_region (protected)
-// Purpose Retrieves a dataspace with the region pointed to selected.
-// Parameters
-// ref_type - IN: Type of reference to get region of - default
-// to H5R_DATASET_REGION
-// ref - IN: Reference to get region of
-// Return Dataspace id
-// Exception H5::IdComponentException
-// Programmer Binh-Minh Ribler - May, 2004
-//--------------------------------------------------------------------------
-hid_t H5Object::p_get_region(void *ref, H5R_type_t ref_type) const
-{
- hid_t space_id = H5Rget_region(getId(), ref_type, ref);
- if (space_id < 0)
- {
- throw IdComponentException("", "H5Rget_region failed");
- }
- return(space_id);
-}
-
+H5Object::H5Object( const H5Object& original ) : H5Location( original ) {}
//--------------------------------------------------------------------------
// Function: H5Object destructor
diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h
index 4ac417b..bfd5e6f 100644
--- a/c++/src/H5Object.h
+++ b/c++/src/H5Object.h
@@ -17,81 +17,29 @@
#ifndef _H5Object_H
#define _H5Object_H
+#include "H5Location.h"
#include "H5Classes.h" // constains forward class declarations
// H5Object is a baseclass. It has these subclasses:
// Group, DataSet, and DataType.
// DataType, in turn, has several specific datatypes as subclasses.
+// Modification:
+// Sept 18, 2012: Added class H5Location in between IdComponent and
+// H5Object. An H5File now inherits from H5Location. All HDF5
+// wrappers in H5Object are moved up to H5Location. H5Object
+// is left mostly empty for future wrappers that are only for
+// group, dataset, and named datatype. Note that the reason for
+// adding H5Location instead of simply moving H5File to be under
+// H5Object is H5File is not an HDF5 object, and renaming H5Object
+// to H5Location will risk breaking user applications.
+// -BMR
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-class H5_DLLCPP H5Object; // forward declaration for UserData4Aiterate
-
-// 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*/);
-
-class UserData4Aiterate { // user data for attribute iteration
- public:
- attr_operator_t op;
- void* opData;
- H5Object* object;
-};
-#endif // DOXYGEN_SHOULD_SKIP_THIS
-
-// The above part is being moved into Iterator, but not completed
-
-class H5_DLLCPP H5Object : public IdComponent {
+class H5_DLLCPP H5Object : public H5Location {
public:
- // Creates an attribute for a group, dataset, or named datatype.
- // 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;
-
- // Opens an attribute given its name.
- Attribute openAttribute( const char* name ) const;
- Attribute openAttribute( const H5std_string& name ) const;
-
- // Opens an attribute given its index.
- Attribute openAttribute( const unsigned int idx ) const;
-
- // Flushes all buffers associated with this object to disk
- void flush( H5F_scope_t scope ) const;
-
- // Gets the name of the file, in which this HDF5 object belongs.
- H5std_string getFileName() const;
-
- // Determines the number of attributes attached to this object.
- int getNumAttrs() 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 );
-
- // Removes the named attribute from this object.
- void removeAttr( const char* name ) const;
- void removeAttr( const H5std_string& name ) const;
-
- // Renames the 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;
-
- // Creates a reference to a named Hdf5 object or to a dataset region
- // in this object.
- void reference(void* ref, const char* name, const DataSpace& dataspace,
- H5R_type_t ref_type = H5R_DATASET_REGION) const;
- void reference(void* ref, const char* name) const;
- void reference(void* ref, const H5std_string& name) const;
-
- // Open a referenced HDF5 object whose location is specified by either
- // a file, an HDF5 object, or an attribute.
- void dereference(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
- void dereference(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
- void dereference(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
-
// Copy constructor: makes copy of an H5Object object.
H5Object(const H5Object& original);
@@ -106,23 +54,6 @@ class H5_DLLCPP H5Object : public IdComponent {
// Creates a copy of an existing object giving the object id
H5Object( const hid_t object_id );
- // Gets the id of the H5 file in which the given object is located.
- hid_t p_get_file_id();
-
- // Creates a reference to an HDF5 object or a dataset region.
- void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const;
-
- // Dereferences a ref into an hdf5 id.
- hid_t p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type);
-
-#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Retrieves the type of object that an object reference points to.
- H5G_obj_t p_get_obj_type(void *ref, H5R_type_t ref_type) const;
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
- // Retrieves a dataspace with the region pointed to selected.
- hid_t p_get_region(void *ref, H5R_type_t ref_type) const;
-
#endif // DOXYGEN_SHOULD_SKIP_THIS
}; /* end class H5Object */
diff --git a/c++/src/H5PredType.h b/c++/src/H5PredType.h
index 9cb1c65..8a04f0c 100644
--- a/c++/src/H5PredType.h
+++ b/c++/src/H5PredType.h
@@ -36,7 +36,7 @@ namespace H5 {
class H5_DLLCPP PredType : public AtomType {
public:
- ///\brief Returns this class name
+ ///\brief Returns this class name.
virtual H5std_string fromClass () const { return("PredType"); }
// Makes a copy of the predefined type and stores the new
diff --git a/c++/src/H5PropList.h b/c++/src/H5PropList.h
index 5dfa538..7e47b32 100644
--- a/c++/src/H5PropList.h
+++ b/c++/src/H5PropList.h
@@ -94,7 +94,7 @@ class H5_DLLCPP PropList : public IdComponent {
void removeProp(const char *name) const;
void removeProp(const H5std_string& name) const;
- // Returns this class name
+ ///\brief Returns this class name.
virtual H5std_string fromClass () const { return("PropList"); }
// Default constructor: creates a stub PropList object.
diff --git a/c++/src/H5StrType.h b/c++/src/H5StrType.h
index d4a0016..be9fed8 100644
--- a/c++/src/H5StrType.h
+++ b/c++/src/H5StrType.h
@@ -47,7 +47,7 @@ class H5_DLLCPP StrType : public AtomType {
// Defines the storage mechanism for character strings.
void setStrpad(H5T_str_t strpad) const;
- // Returns this class name
+ ///\brief Returns this class name.
virtual H5std_string fromClass () const { return("StrType"); }
// default constructor
diff --git a/c++/src/H5VarLenType.h b/c++/src/H5VarLenType.h
index 91f653e..0cee219 100644
--- a/c++/src/H5VarLenType.h
+++ b/c++/src/H5VarLenType.h
@@ -30,7 +30,7 @@ class H5_DLLCPP VarLenType : public DataType {
// on the specified base type.
VarLenType(const DataType* base_type);
- // Returns this class name
+ ///\brief Returns this class name.
virtual H5std_string fromClass () const { return("VarLenType"); }
// Copy constructor: makes copy of the original object.
diff --git a/c++/src/Makefile.am b/c++/src/Makefile.am
index 6278fa0..ec942fd 100644
--- a/c++/src/Makefile.am
+++ b/c++/src/Makefile.am
@@ -40,12 +40,12 @@ bin_SCRIPTS=h5c++
# Source files for the library
libhdf5_cpp_la_SOURCES=H5Exception.cpp H5IdComponent.cpp H5Library.cpp \
- H5Attribute.cpp H5Object.cpp H5PropList.cpp H5FaccProp.cpp \
- H5FcreatProp.cpp H5DcreatProp.cpp H5DxferProp.cpp H5DataType.cpp \
- H5DataSpace.cpp H5AbstractDs.cpp H5AtomType.cpp H5PredType.cpp \
- H5EnumType.cpp H5IntType.cpp H5FloatType.cpp H5StrType.cpp \
- H5ArrayType.cpp H5VarLenType.cpp H5CompType.cpp H5DataSet.cpp \
- H5CommonFG.cpp H5Group.cpp H5File.cpp
+ H5Attribute.cpp H5Location.cpp H5Object.cpp H5PropList.cpp \
+ H5FaccProp.cpp H5FcreatProp.cpp H5DcreatProp.cpp H5DxferProp.cpp \
+ H5DataType.cpp H5DataSpace.cpp H5AbstractDs.cpp H5AtomType.cpp \
+ H5PredType.cpp H5EnumType.cpp H5IntType.cpp H5FloatType.cpp \
+ H5StrType.cpp H5ArrayType.cpp H5VarLenType.cpp H5CompType.cpp \
+ H5DataSet.cpp H5CommonFG.cpp H5Group.cpp H5File.cpp
# HDF5 C++ library depends on HDF5 Library.
libhdf5_cpp_la_LIBADD=$(LIBHDF5)
@@ -55,8 +55,9 @@ include_HEADERS=H5Cpp.h H5AbstractDs.h H5AtomType.h H5Attribute.h H5Classes.h \
H5CommonFG.h H5CompType.h H5DataSet.h H5DataSpace.h H5DataType.h \
H5DcreatProp.h H5DxferProp.h H5EnumType.h H5Exception.h H5FaccProp.h \
H5FcreatProp.h H5File.h H5FloatType.h H5Group.h H5IdComponent.h \
- H5Include.h H5IntType.h H5Library.h H5Object.h H5PredType.h \
- H5PropList.h H5StrType.h H5CppDoc.h H5ArrayType.h H5VarLenType.h
+ H5Include.h H5IntType.h H5Library.h H5Location.h H5Object.h \
+ H5PredType.h H5PropList.h H5StrType.h H5CppDoc.h H5ArrayType.h \
+ H5VarLenType.h
# h5c++ and libhdf5.settings are generated during configure. Remove only when
# distclean.
diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in
index 4265900..d8b2367 100644
--- a/c++/src/Makefile.in
+++ b/c++/src/Makefile.in
@@ -120,12 +120,12 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
LTLIBRARIES = $(lib_LTLIBRARIES)
libhdf5_cpp_la_DEPENDENCIES = $(LIBHDF5)
am_libhdf5_cpp_la_OBJECTS = H5Exception.lo H5IdComponent.lo \
- H5Library.lo H5Attribute.lo H5Object.lo H5PropList.lo \
- H5FaccProp.lo H5FcreatProp.lo H5DcreatProp.lo H5DxferProp.lo \
- H5DataType.lo H5DataSpace.lo H5AbstractDs.lo H5AtomType.lo \
- H5PredType.lo H5EnumType.lo H5IntType.lo H5FloatType.lo \
- H5StrType.lo H5ArrayType.lo H5VarLenType.lo H5CompType.lo \
- H5DataSet.lo H5CommonFG.lo H5Group.lo H5File.lo
+ H5Library.lo H5Attribute.lo H5Location.lo H5Object.lo \
+ H5PropList.lo H5FaccProp.lo H5FcreatProp.lo H5DcreatProp.lo \
+ H5DxferProp.lo H5DataType.lo H5DataSpace.lo H5AbstractDs.lo \
+ H5AtomType.lo H5PredType.lo H5EnumType.lo H5IntType.lo \
+ H5FloatType.lo H5StrType.lo H5ArrayType.lo H5VarLenType.lo \
+ H5CompType.lo H5DataSet.lo H5CommonFG.lo H5Group.lo H5File.lo
libhdf5_cpp_la_OBJECTS = $(am_libhdf5_cpp_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -467,7 +467,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 121
+LT_VERS_REVISION = 127
LT_VERS_AGE = 0
# Include src directory
@@ -482,12 +482,12 @@ bin_SCRIPTS = h5c++
# Source files for the library
libhdf5_cpp_la_SOURCES = H5Exception.cpp H5IdComponent.cpp H5Library.cpp \
- H5Attribute.cpp H5Object.cpp H5PropList.cpp H5FaccProp.cpp \
- H5FcreatProp.cpp H5DcreatProp.cpp H5DxferProp.cpp H5DataType.cpp \
- H5DataSpace.cpp H5AbstractDs.cpp H5AtomType.cpp H5PredType.cpp \
- H5EnumType.cpp H5IntType.cpp H5FloatType.cpp H5StrType.cpp \
- H5ArrayType.cpp H5VarLenType.cpp H5CompType.cpp H5DataSet.cpp \
- H5CommonFG.cpp H5Group.cpp H5File.cpp
+ H5Attribute.cpp H5Location.cpp H5Object.cpp H5PropList.cpp \
+ H5FaccProp.cpp H5FcreatProp.cpp H5DcreatProp.cpp H5DxferProp.cpp \
+ H5DataType.cpp H5DataSpace.cpp H5AbstractDs.cpp H5AtomType.cpp \
+ H5PredType.cpp H5EnumType.cpp H5IntType.cpp H5FloatType.cpp \
+ H5StrType.cpp H5ArrayType.cpp H5VarLenType.cpp H5CompType.cpp \
+ H5DataSet.cpp H5CommonFG.cpp H5Group.cpp H5File.cpp
# HDF5 C++ library depends on HDF5 Library.
@@ -498,8 +498,9 @@ include_HEADERS = H5Cpp.h H5AbstractDs.h H5AtomType.h H5Attribute.h H5Classes.h
H5CommonFG.h H5CompType.h H5DataSet.h H5DataSpace.h H5DataType.h \
H5DcreatProp.h H5DxferProp.h H5EnumType.h H5Exception.h H5FaccProp.h \
H5FcreatProp.h H5File.h H5FloatType.h H5Group.h H5IdComponent.h \
- H5Include.h H5IntType.h H5Library.h H5Object.h H5PredType.h \
- H5PropList.h H5StrType.h H5CppDoc.h H5ArrayType.h H5VarLenType.h
+ H5Include.h H5IntType.h H5Library.h H5Location.h H5Object.h \
+ H5PredType.h H5PropList.h H5StrType.h H5CppDoc.h H5ArrayType.h \
+ H5VarLenType.h
# h5c++ and libhdf5.settings are generated during configure. Remove only when
@@ -664,6 +665,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5IdComponent.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5IntType.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Library.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Location.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Object.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5PredType.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5PropList.Plo@am__quote@