summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2004-06-28 01:34:49 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2004-06-28 01:34:49 (GMT)
commit3fe2e8a5139b7a2f11fa628d4c486b9c3591bec3 (patch)
tree2c62e67c67a90e0403ba17af7d8ae72699db3e33
parent9b84be1422c1455fc0414e5619b9ee142a84cd82 (diff)
downloadhdf5-3fe2e8a5139b7a2f11fa628d4c486b9c3591bec3.zip
hdf5-3fe2e8a5139b7a2f11fa628d4c486b9c3591bec3.tar.gz
hdf5-3fe2e8a5139b7a2f11fa628d4c486b9c3591bec3.tar.bz2
[svn-r8744] Purpose:
Add documentation with doxygen Platforms: Linux 2.4 (eirene) I need to check in these files now to prevent loss of effort, but will check out and test on 2 more platforms asap.
-rw-r--r--c++/src/H5AbstractDs.cpp128
-rw-r--r--c++/src/H5AtomType.cpp175
-rw-r--r--c++/src/H5AtomType.h5
-rw-r--r--c++/src/H5Attribute.cpp168
-rw-r--r--c++/src/H5Attribute.h6
-rw-r--r--c++/src/H5CommonFG.cpp502
-rw-r--r--c++/src/H5CompType.cpp215
-rw-r--r--c++/src/H5DataSet.cpp338
-rw-r--r--c++/src/H5DataSet.h31
-rw-r--r--c++/src/H5DataSpace.cpp307
-rw-r--r--c++/src/H5EnumType.cpp183
-rw-r--r--c++/src/H5EnumType.h3
-rw-r--r--c++/src/H5FloatType.cpp148
-rw-r--r--c++/src/H5IdComponent.cpp172
-rw-r--r--c++/src/H5IdComponent.h42
-rw-r--r--c++/src/H5IntType.cpp71
-rw-r--r--c++/src/H5Library.cpp106
-rw-r--r--c++/src/H5Library.h8
-rw-r--r--c++/src/H5Object.cpp190
-rw-r--r--c++/src/H5Object.h20
-rw-r--r--c++/src/H5PredType.cpp43
-rw-r--r--c++/src/H5StrType.cpp111
-rw-r--r--c++/src/H5StrType.h3
23 files changed, 2427 insertions, 548 deletions
diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp
index d677237..185ce7c 100644
--- a/c++/src/H5AbstractDs.cpp
+++ b/c++/src/H5AbstractDs.cpp
@@ -27,17 +27,35 @@
namespace H5 {
#endif
-// Default constructor
+//--------------------------------------------------------------------------
+// Function: AbstractDs default constructor
+///\brief Default constructor
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
AbstractDs::AbstractDs() : H5Object() {}
-// Constructor that takes an id
+//--------------------------------------------------------------------------
+// Function: AbstractDs default constructor
+///\brief Creates an AbstractDs instance using an existing id.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
AbstractDs::AbstractDs( const hid_t ds_id ) : H5Object( ds_id ) {}
-// Copy constructor: makes copy of the original object; simply invokes
-// base-class copy constructor.
+//--------------------------------------------------------------------------
+// Function: AbstractDs copy constructor
+///\brief Copy constructor: makes a copy of the original AbstractDs object.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
AbstractDs::AbstractDs( const AbstractDs& original ) : H5Object( original ) {}
-// Returns the class of the datatype that is used by this dataset
+//--------------------------------------------------------------------------
+// Function: AbstractDs::getTypeClass
+///\brief Returns the class of the datatype that is used by this
+/// object, which can be a dataset or an attribute.
+///\return Datatype class identifier
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
H5T_class_t AbstractDs::getTypeClass() const
{
// Gets the datatype used by this dataset or attribute.
@@ -52,12 +70,18 @@ H5T_class_t AbstractDs::getTypeClass() const
else
{
throw DataTypeIException("AbstractDs::getTypeClass",
- "H5Tget_class returns something different than H5T_NO_CLASS");
+ "H5Tget_class returns H5T_NO_CLASS");
}
}
-// Returns the generic datatype of this abstract dataset which
-// can be a dataset or an attribute.
+//--------------------------------------------------------------------------
+// Function: AbstractDs::getDataType
+///\brief Returns the generic datatype of this abstract dataset, which
+/// can be a dataset or an attribute.
+///\return DataType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
DataType AbstractDs::getDataType() const
{
// Gets the id of the datatype used by this dataset or attribute.
@@ -70,79 +94,81 @@ DataType AbstractDs::getDataType() const
return( datatype );
}
-// Returns the enumeration datatype of this abstract dataset which
-// can be a dataset or an attribute.
+//--------------------------------------------------------------------------
+// Function: AbstractDs::getEnumType
+///\brief Returns the enumeration datatype of this abstract dataset which
+/// can be a dataset or an attribute.
+///\return EnumType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
EnumType AbstractDs::getEnumType() const
{
EnumType enumtype( p_getType());
return( enumtype );
}
-// Returns the compound datatype of this abstract dataset which
-// can be a dataset or an attribute.
+//--------------------------------------------------------------------------
+// Function: AbstractDs::getCompType
+///\brief Returns the compound datatype of this abstract dataset which
+/// can be a dataset or an attribute.
+///\return CompType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
CompType AbstractDs::getCompType() const
{
CompType comptype( p_getType());
return( comptype );
}
-// Returns the integer datatype of this abstract dataset which
-// can be a dataset or an attribute.
+//--------------------------------------------------------------------------
+// Function: AbstractDs::getIntType
+///\brief Returns the integer datatype of this abstract dataset which
+/// can be a dataset or an attribute.
+///\return IntType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
IntType AbstractDs::getIntType() const
{
IntType inttype( p_getType());
return( inttype );
}
-// Returns the floating-point datatype of this abstract dataset which
-// can be a dataset or an attribute.
+//--------------------------------------------------------------------------
+// Function: AbstractDs::getFloatType
+///\brief Returns the floating-point datatype of this abstract dataset,
+/// which can be a dataset or an attribute.
+///\return FloatType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
FloatType AbstractDs::getFloatType() const
{
FloatType floatype( p_getType());
return( floatype );
}
-// Returns the string datatype of this abstract dataset which
-// can be a dataset or an attribute.
+//--------------------------------------------------------------------------
+// Function: AbstractDs::getStrType
+///\brief Returns the string datatype of this abstract dataset which
+/// can be a dataset or an attribute.
+///\return StrType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
StrType AbstractDs::getStrType() const
{
StrType strtype( p_getType());
return( strtype );
}
-/* This version of getDataType is older style. New style above doesn't
-use overloading. Remove it when knowing for sure that the other way
-is prefered
-// Gets the specific datatype of this abstract dataset which can be a
-// dataset or an attribute. Several overloaded getDataType's below
-// are for specific sub-datatypes.
-void AbstractDs::getDataType( EnumType& enumtype ) const
-{
- enumtype.setId( p_getType());
-}
-
-void AbstractDs::getDataType( CompType& comptype ) const
-{
- comptype.setId( p_getType());
-}
-
-void AbstractDs::getDataType( IntType& inttype ) const
-{
- inttype.setId( p_getType());
-}
-
-void AbstractDs::getDataType( FloatType& floatype ) const
-{
- floatype.setId( p_getType());
-}
-
-void AbstractDs::getDataType( StrType& strtype ) const
-{
- strtype.setId( p_getType());
-}
-end of old style of getDataType */
-
-// Default destructor
+//--------------------------------------------------------------------------
+// Function: AbstractDs destructor
+///\brief Noop destructor.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
AbstractDs::~AbstractDs() {}
#ifndef H5_NO_NAMESPACE
diff --git a/c++/src/H5AtomType.cpp b/c++/src/H5AtomType.cpp
index 0185960..2ca0188 100644
--- a/c++/src/H5AtomType.cpp
+++ b/c++/src/H5AtomType.cpp
@@ -27,16 +27,36 @@
namespace H5 {
#endif
-// Default constructor
+//--------------------------------------------------------------------------
+// Function: AtomType default constructor
+///\brief Default constructor: Creates a stub datatype
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
AtomType::AtomType() : DataType() {}
-// Constructor that takes an existing id
+//--------------------------------------------------------------------------
+// Function: AtomType overloaded constructor
+///\brief Creates an AtomType object using an existing id.
+///\param existing_id - IN: Id of an existing datatype
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
AtomType::AtomType( const hid_t existing_id ) : DataType( existing_id ) {}
-// Copy constructor: makes a copy of the original AtomType object.
+//--------------------------------------------------------------------------
+// Function: AtomType copy constructor
+///\brief Copy constructor: makes a copy of the original AtomType object.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
AtomType::AtomType( const AtomType& original ) : DataType( original ) {}
-// Sets the total size for an atomic datatype.
+//--------------------------------------------------------------------------
+// Function: AtomType::setSize
+///\brief Sets the total size for an atomic datatype.
+///\param size - IN: Size to set
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void AtomType::setSize( size_t size ) const
{
// Call C routine H5Tset_size to set the total size
@@ -47,7 +67,17 @@ void AtomType::setSize( size_t size ) const
}
}
-// Returns the byte order of an atomic datatype. Inheritance class???
+//--------------------------------------------------------------------------
+// Function: AtomType::getOrder
+///\brief Returns the byte order of an atomic datatype.
+///\param order_string - OUT: Text description of the returned byte order
+///\return Byte order, which can be:
+/// \li \c H5T_ORDER_LE
+/// \li \c H5T_ORDER_BE
+/// \li \c H5T_ORDER_VAX
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
H5T_order_t AtomType::getOrder( string& order_string ) const
{
// Call C routine to get the byte ordering
@@ -68,7 +98,16 @@ H5T_order_t AtomType::getOrder( string& order_string ) const
return( type_order );
}
-// Sets the byte ordering of an atomic datatype. Inheritance class???
+//--------------------------------------------------------------------------
+// Function: AtomType::setOrder
+///\brief Sets the byte ordering of an atomic datatype.
+///\param order - IN: Byte ordering constant, which can be:
+/// \li \c H5T_ORDER_LE
+/// \li \c H5T_ORDER_BE
+/// \li \c H5T_ORDER_VAX
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void AtomType::setOrder( H5T_order_t order ) const
{
// Call C routine to set the byte ordering
@@ -79,7 +118,17 @@ void AtomType::setOrder( H5T_order_t order ) const
}
}
-// Returns the precision of an atomic datatype.
+//--------------------------------------------------------------------------
+// Function: AtomType::getPrecision
+///\brief Returns the precision of an atomic datatype.
+///\return Number of significant bits
+///\exception H5::DataTypeIException
+///\par Description
+/// The precision is the number of significant bits which,
+/// unless padding is present, is 8 times larger than the
+/// value returned by \c DataType::getSize().
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
size_t AtomType::getPrecision() const
{
size_t num_signi_bits = H5Tget_precision( id ); // C routine
@@ -93,7 +142,16 @@ size_t AtomType::getPrecision() const
return( num_signi_bits );
}
-// Sets the precision of an atomic datatype.
+//--------------------------------------------------------------------------
+// Function: AtomType::setPrecision
+///\brief Sets the precision of an atomic datatype.
+///\param precision - IN: Number of bits of precision
+///\exception H5::DataTypeIException
+///\par Description
+/// For information, please see C layer Reference Manuat at:
+/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5T.html#Datatype-SetPrecision
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void AtomType::setPrecision( size_t precision ) const
{
// Call C routine to set the datatype precision
@@ -104,10 +162,20 @@ void AtomType::setPrecision( size_t precision ) const
}
}
-// Retrieves the bit offset of the first significant bit.
-// 12/05/00: due to C API change
-// - return type changed from size_t to int
-// - offset = -1 when failure occurs vs. 0
+//--------------------------------------------------------------------------
+// Function: AtomType::getOffset
+///\brief Retrieves the bit offset of the first significant bit.
+///\return Offset value
+///\exception H5::DataTypeIException
+///\par Description
+/// For information, please see C layer Reference Manuat at:
+/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5T.html#Datatype-GetOffset
+// Programmer Binh-Minh Ribler - 2000
+// Modification
+// 12/05/00: due to C API change
+// - return type changed from size_t to int
+// - offset = -1 when failure occurs vs. 0
+//--------------------------------------------------------------------------
int AtomType::getOffset() const
{
int offset = H5Tget_offset( id ); // C routine
@@ -121,7 +189,16 @@ int AtomType::getOffset() const
return( offset );
}
-// Sets the bit offset of the first significant bit.
+//--------------------------------------------------------------------------
+// Function: AtomType::setOffset
+///\brief Sets the bit offset of the first significant bit.
+///\param offset - IN: Offset of first significant bit
+///\exception H5::DataTypeIException
+///\par Description
+/// For information, please see C layer Reference Manuat at:
+/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5T.html#Datatype-SetOffset
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void AtomType::setOffset( size_t offset ) const
{
// Call C routine to set the bit offset
@@ -132,30 +209,58 @@ void AtomType::setOffset( size_t offset ) const
}
}
-// Retrieves the padding type of the least and most-significant bit padding.
-// these two are for Opaque type
-//void AtomType::getPad( H5T_pad_t& lsb, H5T_pad_t& msb ) const
-//{
+//--------------------------------------------------------------------------
+// Function: AtomType::getPad
+///\brief Retrieves the padding type of the least and most-significant
+/// bit padding.
+///\param lsb - OUT: Least-significant bit padding type
+///\param msb - OUT: Most-significant bit padding type
+///\exception H5::DataTypeIException
+///\par Description
+/// Possible values for \a lsb and \a msb include:
+/// \li \c H5T_PAD_ZERO (0) - Set background to zeros.
+/// \li \c H5T_PAD_ONE (1) - Set background to ones.
+/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void AtomType::getPad( H5T_pad_t& lsb, H5T_pad_t& msb ) const
+{
// Call C routine to get the padding type
- //herr_t ret_value = H5Tget_pad( id, &lsb, &msb );
- //if( ret_value < 0 )
- //{
- //throw DataTypeIException("AtomType::getPad", "H5Tget_pad failed");
- //}
-//}
-
-// Sets the least and most-significant bits padding types
-//void AtomType::setPad( H5T_pad_t lsb, H5T_pad_t msb ) const
-//{
+ herr_t ret_value = H5Tget_pad( id, &lsb, &msb );
+ if( ret_value < 0 )
+ {
+ throw DataTypeIException("AtomType::getPad", "H5Tget_pad failed");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: AtomType::getPad
+///\brief Sets the least and most-significant bits padding types.
+///\param lsb - IN: Least-significant bit padding type
+///\param msb - IN: Most-significant bit padding type
+///\exception H5::DataTypeIException
+///\par Description
+/// Valid values for \a lsb and \a msb include:
+/// \li \c H5T_PAD_ZERO (0) - Set background to zeros.
+/// \li \c H5T_PAD_ONE (1) - Set background to ones.
+/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void AtomType::setPad( H5T_pad_t lsb, H5T_pad_t msb ) const
+{
// Call C routine to set the padding type
- //herr_t ret_value = H5Tset_pad( id, lsb, msb );
- //if( ret_value < 0 )
- //{
- //throw DataTypeIException("AtomType::setPad", "H5Tset_pad failed");
- //}
-//}
-
-// This destructor terminates access to the datatype; it calls ~DataType
+ herr_t ret_value = H5Tset_pad( id, lsb, msb );
+ if( ret_value < 0 )
+ {
+ throw DataTypeIException("AtomType::setPad", "H5Tset_pad failed");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: AtomType destructor
+///\brief Noop destructor.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
AtomType::~AtomType() {}
#ifndef H5_NO_NAMESPACE
diff --git a/c++/src/H5AtomType.h b/c++/src/H5AtomType.h
index 6217c8c..bb20bd3 100644
--- a/c++/src/H5AtomType.h
+++ b/c++/src/H5AtomType.h
@@ -48,12 +48,11 @@ class H5_DLLCPP AtomType : public DataType {
// Sets the bit offset of the first significant bit.
void setOffset( size_t offset ) const;
- // The followings will go into Opaque type when completed
// Retrieves the padding type of the least and most-significant bit padding.
- // void getPad( H5T_pad_t& lsb, H5T_pad_t& msb ) const;
+ void getPad( H5T_pad_t& lsb, H5T_pad_t& msb ) const;
// Sets the least and most-significant bits padding types
- // void setPad( H5T_pad_t lsb, H5T_pad_t msb ) const;
+ void setPad( H5T_pad_t lsb, H5T_pad_t msb ) const;
// Copy constructor - makes copy of the original object
AtomType( const AtomType& original );
diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp
index 5c9dfb3..7e60650 100644
--- a/c++/src/H5Attribute.cpp
+++ b/c++/src/H5Attribute.cpp
@@ -35,14 +35,39 @@
namespace H5 {
#endif
-// Copy constructor: makes a copy of the original object; simply invokes
-// the base class copy constructor.
+//--------------------------------------------------------------------------
+// Function: Attribute default constructor
+///\brief Default constructor: Creates a stub attribute
+// Programmer Binh-Minh Ribler - May, 2004
+//--------------------------------------------------------------------------
+Attribute::Attribute() : AbstractDs() {}
+
+//--------------------------------------------------------------------------
+// Function: Attribute copy constructor
+///\brief Copy constructor: makes a copy of the original Attribute object.
+///\param original - IN: Original Attribute object to copy
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
Attribute::Attribute( const Attribute& original ) : AbstractDs( original ) {}
-// Creates a copy of an existing attribute using an id
-Attribute::Attribute( const hid_t attr_id ) : AbstractDs( attr_id ) {}
+//--------------------------------------------------------------------------
+// Function: Attribute overloaded constructor
+///\brief Creates an Attribute object using the id of an existing
+/// attribute.
+///\param existing_id - IN: Id of an existing attribute
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+Attribute::Attribute(const hid_t existing_id) : AbstractDs(existing_id) {}
-// Writes data to this attribute.
+//--------------------------------------------------------------------------
+// Function: Attribute::write
+///\brief Writes data to this attribute.
+///\param mem_type - IN: Attribute datatype (in memory)
+///\param buf - IN: Data to be written
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void Attribute::write( const DataType& mem_type, const void *buf ) const
{
herr_t ret_value = H5Awrite( id, mem_type.getId(), buf );
@@ -52,6 +77,15 @@ void Attribute::write( const DataType& mem_type, const void *buf ) const
}
}
+//--------------------------------------------------------------------------
+// Function: Attribute::write
+///\brief This is an overloaded member function, provided for convenience.
+/// It writes a \a std::string to this attribute.
+///\param mem_type - IN: Attribute datatype (in memory)
+///\param strg - IN: Data to be written
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - Apr, 2003
+//--------------------------------------------------------------------------
void Attribute::write( const DataType& mem_type, const string& strg ) const
{
// Convert string to C-string
@@ -65,7 +99,32 @@ void Attribute::write( const DataType& mem_type, const string& strg ) const
}
}
-// Reads data from this attribute.
+//--------------------------------------------------------------------------
+// Function: Attribute::read
+///\brief Reads data from this attribute.
+///\param mem_type - IN: Attribute datatype (in memory)
+///\param buf - OUT: Buffer for read data
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void Attribute::read( const DataType& mem_type, void *buf ) const
+{
+ herr_t ret_value = H5Aread( id, mem_type.getId(), buf );
+ if( ret_value < 0 )
+ {
+ throw AttributeIException("Attribute::read", "H5Aread failed");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: Attribute::read
+///\brief This is an overloaded member function, provided for convenience.
+/// It reads a \a std::string from this attribute.
+///\param mem_type - IN: Attribute datatype (in memory)
+///\param strg - IN: Buffer for read string
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - Apr, 2003
+//--------------------------------------------------------------------------
void Attribute::read( const DataType& mem_type, string& strg ) const
{
size_t size = mem_type.getSize();
@@ -79,17 +138,13 @@ void Attribute::read( const DataType& mem_type, string& strg ) const
delete strg_C;
}
-// Reads data from this attribute.
-void Attribute::read( const DataType& mem_type, void *buf ) const
-{
- herr_t ret_value = H5Aread( id, mem_type.getId(), buf );
- if( ret_value < 0 )
- {
- throw AttributeIException("Attribute::read", "H5Aread failed");
- }
-}
-
-// Gets a copy of the dataspace for this attribute.
+//--------------------------------------------------------------------------
+// Function: Attribute::getSpace
+///\brief Gets a copy of the dataspace for this attribute.
+///\return Dataspace instance
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
DataSpace Attribute::getSpace() const
{
// Calls C function H5Aget_space to get the id of the dataspace
@@ -107,10 +162,15 @@ DataSpace Attribute::getSpace() const
}
}
-// This private member function calls the C API to get the generic datatype
-// of the datatype that is used by this attribute. This function is used
-// by the overloaded functions getDataType defined in AbstractDs for the
-// generic datatype and specific sub-types.
+//--------------------------------------------------------------------------
+// Function: Attribute::p_getType (private)
+// Purpose Gets the datatype of this attribute.
+// Return Id of the datatype
+// Exception H5::AttributeIException
+// Description
+// This private function is used in AbstractDs.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
hid_t Attribute::p_getType() const
{
hid_t type_id = H5Aget_type( id );
@@ -122,7 +182,15 @@ hid_t Attribute::p_getType() const
}
}
-// Gets the name of this attribute, returning its length.
+//--------------------------------------------------------------------------
+// Function: Attribute::getName
+///\brief Gets the name of this attribute, returning its length.
+///\param buf_size - IN: Desired length of the name
+///\param attr_name - OUT: Buffer for the name string
+///\return Length of the attribute name
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - Nov, 2001
+//--------------------------------------------------------------------------
ssize_t Attribute::getName( size_t buf_size, string& attr_name ) const
{
char* name_C = new char[buf_size+1]; // temporary C-string for C API
@@ -141,7 +209,16 @@ ssize_t Attribute::getName( size_t buf_size, string& attr_name ) const
return( name_size );
}
-// Gets the name of this attribute, returning the name, not the length.
+//--------------------------------------------------------------------------
+// Function: Attribute::getName
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it returns the
+/// attribute's name, not the length.
+///\return Name of the attribute
+///\param buf_size - IN: Desired length of the name
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
string Attribute::getName( size_t buf_size ) const
{
string attr_name;
@@ -150,8 +227,37 @@ string Attribute::getName( size_t buf_size ) const
// let caller catch exception if any
}
-// This private function calls the C API H5Aclose to close this attribute.
-// Used by the IdComponent::reset.
+//--------------------------------------------------------------------------
+// Function: Attribute::getName
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above functions in that it doesn't take
+/// any arguments and returns the attribute's name.
+///\return Name of the attribute
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - May, 2004
+//--------------------------------------------------------------------------
+string Attribute::getName() const
+{
+ // Try with 256 characters for the name first, if the name's length
+ // returned is more than that then, read the name again with the
+ // appropriate space allocation
+ string attr_name;
+ ssize_t name_size = getName(255, attr_name);
+ if (name_size >= 256)
+ name_size = getName(name_size, attr_name);
+ return( attr_name );
+ // let caller catch exception if any
+}
+
+//--------------------------------------------------------------------------
+// Function: Attribute::p_close (private)
+///\brief Closes this attribute.
+///\exception H5::AttributeIException
+///\note
+/// This function will be obsolete because its functionality
+/// is recently handled by the C library layer. - May, 2004
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void Attribute::p_close() const
{
herr_t ret_value = H5Aclose( id );
@@ -161,16 +267,16 @@ void Attribute::p_close() const
}
}
-// The destructor of this instance calls IdComponent::reset to
-// reset its identifier - no longer true
-// Older compilers (baldric) don't support template member functions
-// and IdComponent::reset is one; so at this time, the resetId is not
-// a member function so it can be template to work around that problem.
+//--------------------------------------------------------------------------
+// Function: Attribute destructor
+///\brief Properly terminates access to this attribute.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
Attribute::~Attribute()
{
// The attribute id will be closed properly
try {
- resetIdComponent( this ); }
+ resetIdComponent(this); }
catch (Exception close_error) { // thrown by p_close
cerr << "Attribute::~Attribute - " << close_error.getDetailMsg() << endl;
}
diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h
index 7053f8c..a027fc3 100644
--- a/c++/src/H5Attribute.h
+++ b/c++/src/H5Attribute.h
@@ -36,11 +36,12 @@ class H5_DLLCPP Attribute : public AbstractDs {
// Gets the name of this attribute.
ssize_t getName( size_t buf_size, string& attr_name ) const;
string getName( size_t buf_size ) const; // returns name, not its length
+ string getName() const; // returns name, no argument
// do not inherit iterateAttrs from H5Object
int iterateAttrs() { return 0; }
- // Used by the API to appropriately close a attribute
+ // Used by the API to appropriately close an attribute
virtual void p_close() const;
// Creates a copy of an existing attribute using the attribute id
@@ -57,6 +58,9 @@ class H5_DLLCPP Attribute : public AbstractDs {
// defined in AbstractDs for generic datatype and specific
// sub-types
virtual hid_t p_getType() const;
+
+ // Default constructor
+ Attribute();
};
#ifndef H5_NO_NAMESPACE
}
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp
index 8477fed..3f739d0 100644
--- a/c++/src/H5CommonFG.cpp
+++ b/c++/src/H5CommonFG.cpp
@@ -49,12 +49,22 @@
namespace H5 {
#endif
-// Creates a new group at this location which can be a file or another group.
-Group CommonFG::createGroup( const string& name, size_t size_hint ) const
-{
- return( createGroup( name.c_str(), size_hint ));
-}
-
+//--------------------------------------------------------------------------
+// Function: CommonFG::createGroup
+///\brief Creates a new group at this location which can be a file
+/// or another group.
+///\param name - IN: Name of the group to create
+///\param size_hint - IN: Indicates the number of bytes to reserve for
+/// the names that will appear in the group
+///\return Group instance
+///\exception H5::FileIException or H5::GroupIException
+///\par Description
+/// The optional \a size_hint specifies how much file space to
+/// reserve for storing the names that will appear in this new
+/// group. If a non-positive value is provided for the \a size_hint
+/// then a default size is chosen.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
Group CommonFG::createGroup( const char* name, size_t size_hint ) const
{
// Call C routine H5Gcreate to create the named group, giving the
@@ -72,11 +82,27 @@ Group CommonFG::createGroup( const char* name, size_t size_hint ) const
return( group );
}
-// Opens an existing group in a location which can be a file or another group
-Group CommonFG::openGroup( const string& name ) const
+//--------------------------------------------------------------------------
+// Function: CommonFG::createGroup
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c std::string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+Group CommonFG::createGroup( const string& name, size_t size_hint ) const
{
- return( openGroup( name.c_str() ));
+ return( createGroup( name.c_str(), size_hint ));
}
+
+//--------------------------------------------------------------------------
+// Function: CommonFG::openGroup
+///\brief Opens an existing group in a location which can be a file
+/// or another group.
+///\param name - IN: Name of the group to open
+///\return Group instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
Group CommonFG::openGroup( const char* name ) const
{
// Call C routine H5Gopen to open the named group, giving the
@@ -94,11 +120,29 @@ Group CommonFG::openGroup( const char* name ) const
return( group );
}
-// Creates a new dataset at this location.
-DataSet CommonFG::createDataSet( const string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist ) const
+//--------------------------------------------------------------------------
+// Function: CommonFG::openGroup
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c std::string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+Group CommonFG::openGroup( const string& name ) const
{
- return( createDataSet( name.c_str(), data_type, data_space, create_plist ));
+ return( openGroup( name.c_str() ));
}
+
+//--------------------------------------------------------------------------
+// Function: CommonFG::createDataSet
+///\brief Creates a new dataset at this location.
+///\param name - IN: Name of the dataset to create
+///\param data_type - IN: Datatype of the dataset
+///\param data_space - IN: Dataspace for the dataset
+///\param create_plist - IN: Creation properly list for the dataset
+///\return DataSet instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
DataSet CommonFG::createDataSet( const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist ) const
{
// Obtain identifiers for C API
@@ -120,11 +164,26 @@ DataSet CommonFG::createDataSet( const char* name, const DataType& data_type, co
return( dataset );
}
-// Opens an existing dataset at this location.
-DataSet CommonFG::openDataSet( const string& name ) const
+//--------------------------------------------------------------------------
+// Function: CommonFG::createDataSet
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c std::string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+DataSet CommonFG::createDataSet( const string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist ) const
{
- return( openDataSet( name.c_str() ));
+ return( createDataSet( name.c_str(), data_type, data_space, create_plist ));
}
+
+//--------------------------------------------------------------------------
+// Function: CommonFG::openDataSet
+///\brief Opens an existing dataset at this location.
+///\param name - IN: Name of the dataset to open
+///\return DataSet instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
DataSet CommonFG::openDataSet( const char* name ) const
{
// Call C function H5Dopen to open the specified dataset, giving
@@ -142,12 +201,34 @@ DataSet CommonFG::openDataSet( const char* name ) const
return( dataset );
}
-// Creates a link of the specified type from new_name to current_name;
-// both names are interpreted relative to the specified location id
-void CommonFG::link( H5G_link_t link_type, const string& curr_name, const string& new_name ) const
+//--------------------------------------------------------------------------
+// Function: CommonFG::openDataSet
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c std::string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+DataSet CommonFG::openDataSet( const string& name ) const
{
- link( link_type, curr_name.c_str(), new_name.c_str() );
+ return( openDataSet( name.c_str() ));
}
+
+//--------------------------------------------------------------------------
+// Function: CommonFG::link
+///\brief Creates a link of the specified type from \a new_name to
+/// \a curr_name.
+///\param link_type - IN: Link type; possible values are
+/// \li \c H5G_LINK_HARD
+/// \li \c H5G_LINK_SOFT
+///\param curr_name - IN: Name of the existing object if link is a hard
+/// link; can be anything for the soft link
+///\param new_name - IN: New name for the object
+///\exception H5::FileIException or H5::GroupIException
+///\par Description
+/// Note that both names are interpreted relative to the
+/// specified location.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void CommonFG::link( H5G_link_t link_type, const char* curr_name, const char* new_name ) const
{
herr_t ret_value = H5Glink( getLocId(), link_type, curr_name, new_name );
@@ -157,11 +238,25 @@ void CommonFG::link( H5G_link_t link_type, const char* curr_name, const char* ne
}
}
-// Removes the specified name at this location.
-void CommonFG::unlink( const string& name ) const
+//--------------------------------------------------------------------------
+// Function: CommonFG::link
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c std::string for \a curr_name and \a new_name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void CommonFG::link( H5G_link_t link_type, const string& curr_name, const string& new_name ) const
{
- unlink( name.c_str() );
+ link( link_type, curr_name.c_str(), new_name.c_str() );
}
+
+//--------------------------------------------------------------------------
+// Function: CommonFG::unlink
+///\brief Removes the specified name at this location.
+///\param name - IN: Name of the object to be removed
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void CommonFG::unlink( const char* name ) const
{
herr_t ret_value = H5Gunlink( getLocId(), name );
@@ -171,11 +266,26 @@ void CommonFG::unlink( const char* name ) const
}
}
-// Renames an object at this location.
-void CommonFG::move( const string& src, const string& dst ) const
+//--------------------------------------------------------------------------
+// Function: CommonFG::unlink
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c std::string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void CommonFG::unlink( const string& name ) const
{
- move( src.c_str(), dst.c_str() );
+ unlink( name.c_str() );
}
+
+//--------------------------------------------------------------------------
+// Function: CommonFG::move
+///\brief Renames an object at this location.
+///\param src - IN: Object's original name
+///\param dst - IN: Object's new name
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void CommonFG::move( const char* src, const char* dst ) const
{
herr_t ret_value = H5Gmove( getLocId(), src, dst );
@@ -185,11 +295,27 @@ void CommonFG::move( const char* src, const char* dst ) const
}
}
-// Returns information about an object
-void CommonFG::getObjinfo( const string& name, hbool_t follow_link, H5G_stat_t& statbuf ) const
+//--------------------------------------------------------------------------
+// Function: CommonFG::move
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c std::string for \a src and \a dst.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void CommonFG::move( const string& src, const string& dst ) const
{
- getObjinfo( name.c_str(), follow_link, statbuf );
+ move( src.c_str(), dst.c_str() );
}
+
+//--------------------------------------------------------------------------
+// Function: CommonFG::getObjinfo
+///\brief Returns information about an object.
+///\param name - IN: Name of the object
+///\param follow_link - IN: Link flag
+///\param statbuf - OUT: Buffer to return information about the object
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void CommonFG::getObjinfo( const char* name, hbool_t follow_link, H5G_stat_t& statbuf ) const
{
herr_t ret_value = H5Gget_objinfo( getLocId(), name, follow_link, &statbuf );
@@ -199,11 +325,27 @@ void CommonFG::getObjinfo( const char* name, hbool_t follow_link, H5G_stat_t& st
}
}
-// Returns the name of the object that the symbolic link points to.
-string CommonFG::getLinkval( const string& name, size_t size ) const
+//--------------------------------------------------------------------------
+// Function: CommonFG::getObjinfo
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c std::string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void CommonFG::getObjinfo( const string& name, hbool_t follow_link, H5G_stat_t& statbuf ) const
{
- return( getLinkval( name.c_str(), size ));
+ getObjinfo( name.c_str(), follow_link, statbuf );
}
+
+//--------------------------------------------------------------------------
+// Function: CommonFG::getLinkval
+///\brief Returns the name of the object that the symbolic link points to.
+///\param name - IN: Symbolic link to the object
+///\param size - IN: Maximum number of characters of value to be returned
+///\return Name of the object
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
string CommonFG::getLinkval( const char* name, size_t size ) const
{
char* value_C = new char[size+1]; // temporary C-string for C API
@@ -218,11 +360,33 @@ string CommonFG::getLinkval( const char* name, size_t size ) const
return( value );
}
-// Sets the comment for an object specified by its name
-void CommonFG::setComment( const string& name, const string& comment ) const
+//--------------------------------------------------------------------------
+// Function: CommonFG::getLinkval
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c std::string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+string CommonFG::getLinkval( const string& name, size_t size ) const
{
- setComment( name.c_str(), comment.c_str() );
+ return( getLinkval( name.c_str(), size ));
}
+
+//--------------------------------------------------------------------------
+// Function: CommonFG::setComment
+///\brief Sets or resets the comment for an object specified by its name.
+///\param name - IN: Name of the object
+///\param comment - IN: New comment
+///\exception H5::FileIException or H5::GroupIException
+///\par Description
+/// If \a comment is an empty string or a null pointer, the comment
+/// message is removed from the object.
+/// Comments should be relatively short, null-terminated, ASCII
+/// strings. They can be attached to any object that has an
+/// object header, e.g., data sets, groups, named data types,
+/// and data spaces, but not symbolic links.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void CommonFG::setComment( const char* name, const char* comment ) const
{
herr_t ret_value = H5Gset_comment( getLocId(), name, comment );
@@ -232,11 +396,27 @@ void CommonFG::setComment( const char* name, const char* comment ) const
}
}
-// Retrieves comment for specified object
-string CommonFG::getComment( const string& name, size_t bufsize ) const
+//--------------------------------------------------------------------------
+// Function: CommonFG::setComment
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c std::string for \a name and \a comment.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void CommonFG::setComment( const string& name, const string& comment ) const
{
- return( getComment( name.c_str(), bufsize ));
+ setComment( name.c_str(), comment.c_str() );
}
+
+//--------------------------------------------------------------------------
+// Function: CommonFG::getComment
+///\brief Retrieves comment for the specified object.
+///\param name - IN: Name of the object
+///\param bufsize - IN: Length of the comment to retrieve
+///\return Comment string
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
string CommonFG::getComment( const char* name, size_t bufsize ) const
{
// temporary C-string for the object's comment
@@ -254,11 +434,27 @@ string CommonFG::getComment( const char* name, size_t bufsize ) const
return( comment );
}
-// Mounts the file 'child' onto this group
-void CommonFG::mount( const string& name, H5File& child, PropList& plist ) const
+//--------------------------------------------------------------------------
+// Function: CommonFG::getComment
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c std::string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+string CommonFG::getComment( const string& name, size_t bufsize ) const
{
- mount( name.c_str(), child, plist );
+ return( getComment( name.c_str(), bufsize ));
}
+
+//--------------------------------------------------------------------------
+// Function: CommonFG::mount
+///\brief Mounts the file \a child onto this group.
+///\param name - IN: Name of the group
+///\param child - IN: File to mount
+///\param plist - IN: Property list to use
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void CommonFG::mount( const char* name, H5File& child, PropList& plist ) const
{
// Obtain identifiers for C API
@@ -275,11 +471,25 @@ void CommonFG::mount( const char* name, H5File& child, PropList& plist ) const
}
}
-// Unmounts the file named 'name' from this parent group
-void CommonFG::unmount( const string& name ) const
+//--------------------------------------------------------------------------
+// Function: CommonFG::mount
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c std::string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void CommonFG::mount( const string& name, H5File& child, PropList& plist ) const
{
- unmount( name.c_str() );
+ mount( name.c_str(), child, plist );
}
+
+//--------------------------------------------------------------------------
+// Function: CommonFG::unmount
+///\brief Unmounts the specified file.
+///\param name - IN: Name of the file to unmount
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void CommonFG::unmount( const char* name ) const
{
// Call C routine H5Fmount to do the mouting
@@ -292,9 +502,29 @@ void CommonFG::unmount( const char* name ) const
}
}
-// This private member function calls the C API H5Topen to open the
-// named datatype and returns the datatype's identifier. The function
-// is used by the functions openXxxType's below for opening the sub-types
+//--------------------------------------------------------------------------
+// Function: CommonFG::unmount
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c std::string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void CommonFG::unmount( const string& name ) const
+{
+ unmount( name.c_str() );
+}
+
+//--------------------------------------------------------------------------
+// Function: CommonFG::p_openDataType (private)
+// Purpose Opens the named datatype and returns the datatype's identifier.
+// Return Id of the datatype
+// Exception H5::FileIException or H5::GroupIException
+// Description
+// This private function is used by the member functions
+// CommonFG::openXxxType, where Xxx indicates the specific
+// datatypes.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
hid_t CommonFG::p_openDataType( const char* name ) const
{
// Call C function H5Topen to open the named datatype in this group,
@@ -316,77 +546,175 @@ hid_t CommonFG::p_openDataType( const char* name ) const
// p_openDataType to open a named datatype in this location
//
-// Opens the named generic datatype in this group.
-DataType CommonFG::openDataType( const string& name ) const
-{
- return( openDataType( name.c_str()) );
-}
+//--------------------------------------------------------------------------
+// Function: CommonFG::openDataType
+///\brief Opens the named generic datatype at this location.
+///\param name - IN: Name of the datatype to open
+///\return DataType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
DataType CommonFG::openDataType( const char* name ) const
{
DataType data_type( p_openDataType( name ));
return( data_type );
}
-// Opens the named enumeration datatype in this group.
-EnumType CommonFG::openEnumType( const string& name ) const
+//--------------------------------------------------------------------------
+// Function: CommonFG::openDataType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c std::string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+DataType CommonFG::openDataType( const string& name ) const
{
- return( openEnumType( name.c_str()) );
-}
+ return( openDataType( name.c_str()) );
+}
+
+//--------------------------------------------------------------------------
+// Function: CommonFG::openEnumType
+///\brief Opens the named enumeration datatype at this location.
+///\param name - IN: Name of the enumeration datatype to open
+///\return EnumType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
EnumType CommonFG::openEnumType( const char* name ) const
{
EnumType enum_type( p_openDataType( name ));
return( enum_type );
}
-// Opens the named compound datatype in this group.
-CompType CommonFG::openCompType( const string& name ) const
+//--------------------------------------------------------------------------
+// Function: CommonFG::openEnumType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c std::string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+EnumType CommonFG::openEnumType( const string& name ) const
{
- return( openCompType( name.c_str()) );
-}
+ return( openEnumType( name.c_str()) );
+}
+
+//--------------------------------------------------------------------------
+// Function: CommonFG::openCompType
+///\brief Opens the named compound datatype at this location.
+///\param name - IN: Name of the compound datatype to open
+///\return CompType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
CompType CommonFG::openCompType( const char* name ) const
{
CompType comp_type( p_openDataType( name ));
return( comp_type );
}
-// Opens the named integer datatype in this group.
-IntType CommonFG::openIntType( const string& name ) const
-{
- return( openIntType( name.c_str()) );
+//--------------------------------------------------------------------------
+// Function: CommonFG::openCompType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c std::string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+CompType CommonFG::openCompType( const string& name ) const
+{
+ return( openCompType( name.c_str()) );
}
+
+//--------------------------------------------------------------------------
+// Function: CommonFG::openIntType
+///\brief Opens the named integer datatype at this location.
+///\param name - IN: Name of the integer datatype to open
+///\return IntType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
IntType CommonFG::openIntType( const char* name ) const
{
IntType int_type( p_openDataType( name ));
return( int_type );
}
-// Opens the named floating-point datatype in this group.
-FloatType CommonFG::openFloatType( const string& name ) const
+//--------------------------------------------------------------------------
+// Function: CommonFG::openIntType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c std::string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+IntType CommonFG::openIntType( const string& name ) const
{
- return( openFloatType( name.c_str()) );
+ return( openIntType( name.c_str()) );
}
+
+//--------------------------------------------------------------------------
+// Function: CommonFG::openFloatType
+///\brief Opens the named floating-point datatype at this location.
+///\param name - IN: Name of the floating-point datatype to open
+///\return FloatType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
FloatType CommonFG::openFloatType( const char* name ) const
{
FloatType float_type( p_openDataType( name ));
return( float_type );
}
-// Opens the named string datatype of this group
-StrType CommonFG::openStrType( const string& name ) const
-{
- return( openStrType( name.c_str()) );
+//--------------------------------------------------------------------------
+// Function: CommonFG::openFloatType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c std::string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+FloatType CommonFG::openFloatType( const string& name ) const
+{
+ return( openFloatType( name.c_str()) );
}
+
+//--------------------------------------------------------------------------
+// Function: CommonFG::openStrType
+///\brief Opens the named string datatype at this location.
+///\param name - IN: Name of the string datatype to open
+///\return StrType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
StrType CommonFG::openStrType( const char* name ) const
{
StrType str_type( p_openDataType( name ));
return( str_type );
}
-// Iterates a user's function over the entries of a group.
-int CommonFG::iterateElems( const string& name, int *idx, H5G_iterate_t op , void* op_data )
+//--------------------------------------------------------------------------
+// Function: CommonFG::openStrType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c std::string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+StrType CommonFG::openStrType( const string& name ) const
{
- return( iterateElems( name.c_str(), idx, op, op_data ));
+ return( openStrType( name.c_str()) );
}
+
+//--------------------------------------------------------------------------
+// Function: CommonFG::iterateElems
+///\brief Iterates a user's function over the entries of a group.
+///\param name - IN: Name of group to iterate over
+///\param idx - IN/OUT: Starting (IN) and ending (OUT) entry indices
+///\param op - IN: User's function to operate on each entry
+///\param op_data - IN/OUT: Data associated with the operation
+///\return The return value of the first operator that returns non-zero,
+/// or zero if all members were processed with no operator
+/// returning non-zero.
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
int CommonFG::iterateElems( const char* name, int *idx, H5G_iterate_t op , void* op_data )
{
int ret_value = H5Giterate( getLocId(), name, idx, op, op_data );
@@ -397,13 +725,31 @@ int CommonFG::iterateElems( const char* name, int *idx, H5G_iterate_t op , void*
return( ret_value );
}
-CommonFG::CommonFG()
-{ // do nothing
+//--------------------------------------------------------------------------
+// Function: CommonFG::iterateElems
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c std::string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+int CommonFG::iterateElems( const string& name, int *idx, H5G_iterate_t op , void* op_data )
+{
+ return( iterateElems( name.c_str(), idx, op, op_data ));
}
-CommonFG::~CommonFG()
-{ // do nothing
-}
+//--------------------------------------------------------------------------
+// Function: CommonFG default constructor
+///\brief Default constructor.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+CommonFG::CommonFG() {}
+
+//--------------------------------------------------------------------------
+// Function: CommonFG destructor
+///\brief Noop destructor.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+CommonFG::~CommonFG() {}
#ifndef H5_NO_NAMESPACE
}
diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp
index 05a214e..cbfafb6 100644
--- a/c++/src/H5CompType.cpp
+++ b/c++/src/H5CompType.cpp
@@ -31,19 +31,49 @@
namespace H5 {
#endif
-// Creates a new compound datatype
-CompType::CompType( size_t size ) : DataType( H5T_COMPOUND, size ) {}
-
-// Creates a compound datatype using an existing id
-CompType::CompType( const hid_t existing_id ) : DataType( existing_id ) {}
-
-// Default constructor
+//--------------------------------------------------------------------------
+// Function: CompType default constructor
+///\brief Default constructor: Creates a stub compound datatype
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
CompType::CompType() : DataType() {}
-// Copy constructor: makes copy of the original CompType object
+//--------------------------------------------------------------------------
+// Function: CompType copy constructor
+///\brief Copy constructor: makes copy of the original CompType object
+///\param original - IN: Original CompType instance
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
CompType::CompType( const CompType& original ) : DataType( original ) {}
-// Gets the compound datatype of the specified dataset - reimplement this
+//--------------------------------------------------------------------------
+// Function: CompType overloaded constructor
+///\brief Creates a CompType object using the id of an existing datatype.
+///\param existing_id - IN: Id of an existing compound datatype
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+CompType::CompType( const hid_t existing_id ) : DataType( existing_id ) {}
+
+//--------------------------------------------------------------------------
+// Function: CompType overloaded constructor
+///\brief Creates an empty compound datatype given a size, in bytes.
+///\param size - IN: Number of bytes in the datatype to create
+///\exception H5::DataTypeIException
+// Description
+// The DataType constructor calls the C API H5Tcreate to create
+// the compound datatype.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+CompType::CompType( size_t size ) : DataType( H5T_COMPOUND, size ) {}
+
+//--------------------------------------------------------------------------
+// Function: CompType overloaded constructor
+///\brief Gets the compound datatype of the specified dataset.
+///\param dataset - IN: Dataset that this enum datatype associates with
+///\return CompType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
CompType::CompType( const DataSet& dataset ) : DataType()
{
// Calls C function H5Dget_type to get the id of the datatype
@@ -56,7 +86,13 @@ CompType::CompType( const DataSet& dataset ) : DataType()
}
}
-// Retrieves the number of members in this compound datatype.
+//--------------------------------------------------------------------------
+// Function: CompType::getNmembers
+///\brief Returns the number of members in this compound datatype.
+///\return Number of members
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
int CompType::getNmembers() const
{
int num_members = H5Tget_nmembers( id );
@@ -68,7 +104,14 @@ int CompType::getNmembers() const
return( num_members );
}
-// Retrieves the name of a member of this compound datatype.
+//--------------------------------------------------------------------------
+// Function: CompType::getMemberName
+///\brief Returns the name of a member in this compound datatype.
+///\param member_num - IN: Zero-based index of the member
+///\return Name of member
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
string CompType::getMemberName( int member_num ) const
{
char* member_name_C = H5Tget_member_name( id, member_num );
@@ -82,20 +125,18 @@ string CompType::getMemberName( int member_num ) const
return( member_name ); // return the member name string
}
-/*-------------------------------------------------------------------------
- * Function: getMemberIndex
- *
- * Purpose: Returns the index of a member in a compound data type.
- * Members are stored in no particular order with numbers 0
- * through N-1, where N is the value returned by the member
- * function getNmembers.
- *
- * Return: Success: index of the member if exists.
- * Failure: DataTypeIException
- *
- * BMR - May 16, 2002
- *-------------------------------------------------------------------------
- */
+//--------------------------------------------------------------------------
+// Function: CompType::getMemberIndex
+///\brief Returns the index of a member in this compound datatype.
+///\param name - IN: Name of the member
+///\return Index of member
+///\exception H5::DataTypeIException
+///\par Description
+/// Members are stored in no particular order with numbers 0
+/// through N-1, where N is the value returned by the member
+/// function \c CompType::getNmembers.
+// Programmer Binh-Minh Ribler - May 16, 2002
+//--------------------------------------------------------------------------
int CompType::getMemberIndex(const char* name) const
{
int member_index = H5Tget_member_index(id, name);
@@ -111,29 +152,25 @@ int CompType::getMemberIndex(const string& name) const
return(getMemberIndex(name.c_str()));
}
-/*-------------------------------------------------------------------------
- * Function: getMemberOffset
- *
- * Purpose: Returns the byte offset of the beginning of a member with
- * respect to the beginning of the compound data type datum.
- * Members are stored in no particular order with numbers 0
- * through N-1, where N is the value returned by the member
- * function getNmembers.
- *
- * Return: Success: Byte offset.
- * Failure: Quincey: for now, 0 is not a failure
- *
- * BMR - 2000
- *-------------------------------------------------------------------------
- */
+//--------------------------------------------------------------------------
+// Function: CompType::getMemberOffset
+///\brief Returns the byte offset of the beginning of a member with
+/// respect to the beginning of the compound data type datum.
+///\param member_num - IN: Zero-based index of the member
+///\return Byte offset
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+// Description
+/// Members are stored in no particular order with numbers 0
+/// through N-1, where N is the value returned by the member
+/// function \c CompType::getNmembers.
+//
+// Note that byte offset being returned as 0 doesn't indicate
+// a failure. (According to Quincey)
+//--------------------------------------------------------------------------
size_t CompType::getMemberOffset( int member_num ) const
{
size_t offset = H5Tget_member_offset( id, member_num );
- //if( offset == 0 )
- //{
- //throw DataTypeIException("CompType::getMemberOffset",
- //"H5Tget_member_offset failed");
- //}
return( offset );
}
@@ -145,7 +182,14 @@ int CompType::getMemberDims( int member_num, size_t* dims, int* perm ) const
// will complain
}
-// Gets the type class of the specified member.
+//--------------------------------------------------------------------------
+// Function: CompType::getMemberClass
+///\brief Gets the type class of the specified member.
+///\param member_num - IN: Zero-based index of the member
+///\return Type class of the member
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
H5T_class_t CompType::getMemberClass( int member_num ) const
{
// get the member datatype first
@@ -184,37 +228,90 @@ hid_t CompType::p_getMemberType( int member_num ) const
}
}
-// Returns the datatype of the specified member in this compound datatype.
+//--------------------------------------------------------------------------
+// Function: CompType::getMemberDataType
+///\brief Returns the generic datatype of the specified member in this
+/// compound datatype.
+///\param member_num - IN: Zero-based index of the member
+///\return DataType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
DataType CompType::getMemberDataType( int member_num ) const
{
DataType datatype( p_getMemberType( member_num ));
return( datatype );
}
+//--------------------------------------------------------------------------
+// Function: CompType::getMemberDataType
+///\brief Returns the enumeration datatype of the specified member in
+/// this compound datatype.
+///\param member_num - IN: Zero-based index of the member
+///\return EnumType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
EnumType CompType::getMemberEnumType( int member_num ) const
{
EnumType enumtype( p_getMemberType( member_num ));
return( enumtype );
}
+//--------------------------------------------------------------------------
+// Function: CompType::getMemberDataType
+///\brief Returns the compound datatype of the specified member in this
+/// compound datatype.
+///\param member_num - IN: Zero-based index of the member
+///\return CompType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
CompType CompType::getMemberCompType( int member_num ) const
{
CompType comptype( p_getMemberType( member_num ));
return( comptype );
}
+//--------------------------------------------------------------------------
+// Function: CompType::getMemberDataType
+///\brief Returns the integer datatype of the specified member in this
+/// compound datatype.
+///\param member_num - IN: Zero-based index of the member
+///\return IntType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
IntType CompType::getMemberIntType( int member_num ) const
{
IntType inttype( p_getMemberType( member_num ));
return( inttype );
}
+//--------------------------------------------------------------------------
+// Function: CompType::getMemberDataType
+///\brief Returns the floating-point datatype of the specified member
+/// in this compound datatype.
+///\param member_num - IN: Zero-based index of the member
+///\return FloatType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
FloatType CompType::getMemberFloatType( int member_num ) const
{
FloatType floatype( p_getMemberType( member_num ));
return( floatype );
}
+//--------------------------------------------------------------------------
+// Function: CompType::getMemberDataType
+///\brief Returns the string datatype of the specified member in this
+/// compound datatype.
+///\param member_num - IN: Zero-based index of the member
+///\return StrType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
StrType CompType::getMemberStrType( int member_num ) const
{
StrType strtype( p_getMemberType( member_num ));
@@ -224,6 +321,7 @@ StrType CompType::getMemberStrType( int member_num ) const
/* old style of getMemberType - using overloads; new style above
returns the appropriate datatypes but has different named functions.
In the old style, a datatype must be passed into the function.
+ May, 2004: These should be reconsidered to provide more convenience.
// Returns the datatype of the specified member in this compound datatype.
// Several overloading of getMemberType are for different datatypes
void CompType::getMemberType( int member_num, EnumType& enumtype ) const
@@ -253,7 +351,15 @@ void CompType::getMemberType( int member_num, StrType& strtype ) const
// end of overloading of getMemberType
*/
-// Adds a new member to a compound datatype
+//--------------------------------------------------------------------------
+// Function: CompType::insertMember
+///\brief Inserts a new member to this compound datatype.
+///\param name - IN: Name of the new member
+///\param offset - IN: Offset in memory structure of the field to insert
+///\param new_member - IN: New member to be inserted
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void CompType::insertMember( const string& name, size_t offset, const DataType& new_member ) const
{
// Convert string to C-string
@@ -270,7 +376,12 @@ void CompType::insertMember( const string& name, size_t offset, const DataType&
}
}
-// Recursively removes padding from within a compound datatype.
+//--------------------------------------------------------------------------
+// Function: CompType::pack
+///\brief Recursively removes padding from within a compound datatype.
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void CompType::pack() const
{
// Calls C routine H5Tpack to remove padding
@@ -281,7 +392,11 @@ void CompType::pack() const
}
}
-// This destructor just invokes the base-class' destructor
+//--------------------------------------------------------------------------
+// Function: CompType destructor
+///\brief Properly terminates access to this compound datatype.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
CompType::~CompType() {}
#ifndef H5_NO_NAMESPACE
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index 84bed5c..602d9e4 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -38,17 +38,36 @@
namespace H5 {
#endif
-// Default constructor
+//--------------------------------------------------------------------------
+// Function: DataSet default constructor
+///\brief Default constructor: Creates a stub dataset.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
DataSet::DataSet() : AbstractDs() {}
-// Creates a copy of DataSet using an existing id
-DataSet::DataSet( const hid_t dataset_id ) : AbstractDs( dataset_id ) {}
+//--------------------------------------------------------------------------
+// Function: DataSet overloaded constructor
+///\brief Creates an DataSet object using the id of an existing dataset.
+///\param existing_id - IN: Id of an existing dataset
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+DataSet::DataSet(const hid_t existing_id) : AbstractDs(existing_id) {}
-// Copy constructor makes a copy of the original object by using base
-// class' copy constructors
+//--------------------------------------------------------------------------
+// Function: DataSet copy constructor
+///\brief Copy constructor: makes a copy of the original DataSet object.
+///\param original - IN: DataSet instance to copy
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
DataSet::DataSet( const DataSet& original ) : AbstractDs( original ) {}
-// Gets a copy of the dataspace of this dataset
+//--------------------------------------------------------------------------
+// Function: DataSet::getSpace
+///\brief Gets a copy of the dataspace of this dataset.
+///\return DataSpace instance
+///\exception H5::DataSetIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
DataSpace DataSet::getSpace() const
{
// Calls C function H5Dget_space to get the id of the dataspace
@@ -78,7 +97,13 @@ hid_t DataSet::p_getType() const
}
}
-// Gets the dataset creation property list
+//--------------------------------------------------------------------------
+// Function: DataSet::getCreatePlist
+///\brief Gets the dataset creation property list.
+///\return DSetCreatPropList instance
+///\exception H5::DataSetIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
DSetCreatPropList DataSet::getCreatePlist() const
{
hid_t create_plist_id = H5Dget_create_plist( id );
@@ -91,7 +116,13 @@ DSetCreatPropList DataSet::getCreatePlist() const
return( create_plist );
}
-// Returns the amount of storage required for a dataset.
+//--------------------------------------------------------------------------
+// Function: DataSet::getStorageSize
+///\brief Returns the amount of storage required for a dataset.
+///\return Amount of storage
+///\exception H5::DataSetIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
hsize_t DataSet::getStorageSize() const
{
hsize_t storage_size = H5Dget_storage_size( id );
@@ -104,27 +135,75 @@ hsize_t DataSet::getStorageSize() const
}
}
-// Returns the number of bytes required to store VL data.
+//--------------------------------------------------------------------------
+// Function: DataSet::getOffset
+///\brief Returns the address of this dataset in the file.
+///\return Address of dataset
+///\exception H5::DataSetIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+haddr_t DataSet::getOffset() const
+{
+ haddr_t ds_addr; // for address of dataset
+
+ ds_addr = H5Dget_offset(id);
+ if( ds_addr == HADDR_UNDEF )
+ {
+ throw DataSetIException("DataSet::getOffset", "H5Dget_offset returned HADDR_UNDEF");
+ }
+ return(ds_addr);
+}
+
+//--------------------------------------------------------------------------
+// Function: DataSet::getSpaceStatus
+///\brief Determines whether space has been allocated for a dataset.
+///\param status - OUT: Space allocation status
+///\exception H5::DataSetIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void DataSet::getSpaceStatus(H5D_space_status_t& status) const
+{
+ herr_t ret_value = H5Dget_space_status(id, &status);
+ if( ret_value < 0 )
+ {
+ throw DataSetIException("DataSet::getSpaceStatus", "H5Dget_space_status failed");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: DataSet::getVlenBufSize
+///\brief Returns the number of bytes required to store VL data.
+///\return Amount of storage
+///\exception H5::DataSetIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
hsize_t DataSet::getVlenBufSize( DataType& type, DataSpace& space ) const
{
// Obtain identifiers for C API
- //hid_t type_id = type.getId();
- //hid_t space_id = space.getId();
- //hsize_t size;
-
- //herr_t ret_value = H5Dget_vlen_buf_size( id, type_id, space_id, &size );
- //if( ret_value >= 0 )
- // return( size );
- //else
- //{
- //throw DataSetIException();
- //}
- throw DataSetIException( "DataSet::getVlenBufSize",
- "Currently not implemented yet.");
- return (0);
+ hid_t type_id = type.getId();
+ hid_t space_id = space.getId();
+
+ hsize_t size; // for amount of storage
+
+ herr_t ret_value = H5Dvlen_get_buf_size( id, type_id, space_id, &size );
+ if( ret_value < 0 )
+ {
+ throw DataSetIException("DataSet::getStorageSize", "H5Dget_storage_size failed");
+ }
+ return( size );
}
-// Reclaims VL datatype memory buffers.
+//--------------------------------------------------------------------------
+// Function: DataSet::getVlenBufSize
+///\brief Reclaims VL datatype memory buffers.
+///\param type - IN: Datatype, which is the datatype stored in the buffer
+///\param space - IN: Selection for the memory buffer to free the
+/// VL datatypes within
+///\param xfer_plist - IN: Property list used to create the buffer
+///\param buf - IN: Pointer to the buffer to be reclaimed
+///\exception H5::DataSetIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void DataSet::vlenReclaim( DataType& type, DataSpace& space, DSetMemXferPropList& xfer_plist, void* buf ) const
{
// Obtain identifiers for C API
@@ -139,8 +218,21 @@ void DataSet::vlenReclaim( DataType& type, DataSpace& space, DSetMemXferPropList
}
}
-// Reads raw data from the specified dataset into buf, converting from
-// file datatype and dataspace to memory datatype and dataspace.
+//--------------------------------------------------------------------------
+// Function: DataSet::read
+///\brief Reads raw data from the specified dataset.
+///\param buf - IN: Buffer for read data
+///\param mem_type - IN: Memory datatype
+///\param mem_space - IN: Memory dataspace
+///\param file_space - IN: Dataset's dataspace in the file
+///\param xfer_plist - IN: Transfer property list for this I/O operation
+///\exception H5::DataSetIException
+///\par Description
+/// This function reads raw data from this dataset into the
+/// buffer \a buf, converting from file datatype and dataspace
+/// to memory datatype \a mem_type and dataspace \a mem_space.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void DataSet::read( void* buf, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist ) const
{
// Obtain identifiers for C API
@@ -156,6 +248,12 @@ void DataSet::read( void* buf, const DataType& mem_type, const DataSpace& mem_sp
}
}
+//--------------------------------------------------------------------------
+// Function: DataSet::read
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes a reference to a \c std::string for the buffer.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void DataSet::read( string& strg, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist ) const
{
// Allocate C character string for reading
@@ -170,9 +268,22 @@ void DataSet::read( string& strg, const DataType& mem_type, const DataSpace& mem
delete strg_C;
}
-// Writes raw data from an application buffer buffer to a dataset,
-// converting from memory datatype and dataspace to file datatype
-// and dataspace.
+//--------------------------------------------------------------------------
+// Function: DataSet::write
+///\brief Writes raw data from an application buffer to a dataset.
+///\param buf - IN: Buffer containing data to be written
+///\param mem_type - IN: Memory datatype
+///\param mem_space - IN: Memory dataspace
+///\param file_space - IN: Dataset's dataspace in the file
+///\param xfer_plist - IN: Transfer property list for this I/O operation
+///\exception H5::DataSetIException
+///\par Description
+/// This function writes raw data from an application buffer
+/// \a buf to a dataset, converting from memory datatype
+/// \a mem_type and dataspace \a mem_space to file datatype
+/// and dataspace.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void DataSet::write( const void* buf, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist ) const
{
// Obtain identifiers for C API
@@ -188,6 +299,12 @@ void DataSet::write( const void* buf, const DataType& mem_type, const DataSpace&
}
}
+//--------------------------------------------------------------------------
+// Function: DataSet::write
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes a reference to a \c std::string for the buffer.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void DataSet::write( const string& strg, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist ) const
{
// Convert string to C-string
@@ -198,7 +315,23 @@ void DataSet::write( const string& strg, const DataType& mem_type, const DataSpa
write(strg_C, mem_type, mem_space, file_space, xfer_plist);
}
-// Iterates over all selected elements in a dataspace.
+//--------------------------------------------------------------------------
+// Function: DataSet::iterateElems
+///\brief Iterates over all selected elements in a dataspace.
+///\param buf - IN/OUT: Pointer to the buffer in memory containing the
+/// elements to iterate over
+///\param type - IN: Datatype for the elements stored in \a buf
+///\param space - IN: Dataspace for \a buf. Also contains the selection
+/// to iterate over.
+///\param op - IN: Function pointer to the routine to be called for
+/// each element in \a buf iterated over
+///\param op_data - IN/OUT: Pointer to any user-defined data associated
+/// with the operation
+///\exception H5::DataSetIException
+///\note This function may not work correctly yet - it's still
+/// under development.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
int DataSet::iterateElems( void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data )
{
// Obtain identifiers for C API
@@ -213,7 +346,17 @@ int DataSet::iterateElems( void* buf, const DataType& type, const DataSpace& spa
}
}
-// Extends a dataset with unlimited dimension.
+//--------------------------------------------------------------------------
+// Function: DataSet::extend
+///\brief Extends a dataset with unlimited dimension.
+///\param size - IN: Array containing the new magnitude of each dimension
+///\exception H5::DataSetIException
+///\par Description
+/// For more information, please see the Description section in
+/// C layer Reference Manual at:
+/// http:
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void DataSet::extend( const hsize_t* size ) const
{
herr_t ret_value = H5Dextend( id, size );
@@ -223,25 +366,17 @@ void DataSet::extend( const hsize_t* size ) const
}
}
-/*--------------------------------------------------------------------------
- NAME
- fillMemBuf
- PURPOSE
- Fills a selection in memory with a value
- USAGE
- fillMemBuf(fill, fill_type, buf, buf_type, space)
- fillMemBuf(buf, buf_type, space)
- void *buf; IN/OUT: Memory buffer to fill selection within
- DataType& buf_type; IN: Datatype of the elements in buffer
- DataSpace& space; IN: Dataspace describing memory buffer &
- containing selection to use.
- const void *fill; IN: Pointer to fill value to use - default NULL
- DataType& fill_type; IN: Datatype of the fill value
- DESCRIPTION
- Use the selection in the dataspace to fill elements in a memory buffer.
- COMMENTS, BUGS, ASSUMPTIONS
- Second usage uses all zeros as fill value
---------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
+// Function: DataSet::fillMemBuf
+///\brief Fills a selection in memory with a value.
+///\param fill - IN: Pointer to fill value to use - default NULL
+///\param fill_type - IN: Datatype of the fill value
+///\param buf - IN/OUT: Memory buffer to fill selection within
+///\param buf_type - IN: Datatype of the elements in buffer
+///\param space - IN: Dataspace describing memory buffer & containing selection to use
+///\exception H5::DataSetIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void DataSet::fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space)
{
hid_t fill_type_id = fill_type.getId();
@@ -253,6 +388,18 @@ void DataSet::fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataT
throw DataSetIException("DataSet::fillMemBuf", "H5Dfill failed");
}
}
+
+//--------------------------------------------------------------------------
+// Function: DataSet::fillMemBuf
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it only takes the
+/// the last three arguments.
+///\param buf - IN/OUT: Memory buffer to fill selection within
+///\param buf_type - IN: Datatype of the elements in buffer
+///\param space - IN: Dataspace describing memory buffer & containing selection to use
+///\exception H5::DataSetIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space)
{
hid_t buf_type_id = buf_type.getId();
@@ -264,8 +411,83 @@ void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space)
}
}
-// This private function calls the C API H5Dclose to close this dataset.
-// Used by IdComponent::reset
+//--------------------------------------------------------------------------
+// Function: DataSet::Reference
+///\brief Creates a reference to an HDF5 object or a dataset region.
+///\param name - IN: Name of the object to be referenced
+///\param dataspace - IN: Dataspace with selection
+///\param ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION
+///\return A reference
+///\exception H5::ReferenceIException
+// Programmer Binh-Minh Ribler - May, 2004
+//--------------------------------------------------------------------------
+void* DataSet::Reference(const char* name, DataSpace& dataspace, H5R_type_t ref_type) const
+{
+ return(p_reference(name, dataspace.getId(), ref_type));
+}
+
+//--------------------------------------------------------------------------
+// Function: DataSet::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 name - IN: Name of the object to be referenced
+///\return A reference
+///\exception H5::ReferenceIException
+///\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* DataSet::Reference(const char* name) const
+{
+ return(p_reference(name, -1, H5R_OBJECT));
+}
+
+//--------------------------------------------------------------------------
+// Function: DataSet::getObjType
+///\brief Retrieves the type of object that an object reference points to.
+///\param ref_type - IN: Type of reference to query
+///\param ref - IN: 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::ReferenceIException
+// Programmer Binh-Minh Ribler - May, 2004
+//--------------------------------------------------------------------------
+H5G_obj_t DataSet::getObjType(void *ref, H5R_type_t ref_type) const
+{
+ return(p_get_obj_type(ref, ref_type));
+}
+
+//--------------------------------------------------------------------------
+// Function: DataSet::getRegion
+///\brief Retrieves a dataspace with the region pointed to selected.
+///\param ref_type - IN: Type of reference to get region of - default
+/// to H5R_DATASET_REGION
+///\param ref - IN: Reference to get region of
+///\return DataSpace instance
+///\exception H5::ReferenceIException
+// Programmer Binh-Minh Ribler - May, 2004
+//--------------------------------------------------------------------------
+DataSpace DataSet::getRegion(void *ref, H5R_type_t ref_type) const
+{
+ DataSpace dataspace(p_get_region(ref, ref_type));
+ return(dataspace);
+}
+
+//--------------------------------------------------------------------------
+// Function: DataSet::p_close (private)
+///\brief Closes this dataset.
+///\exception H5::DataSetIException
+///\note
+/// This function will be obsolete because its functionality
+/// is recently handled by the C library layer.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void DataSet::p_close() const
{
herr_t ret_value = H5Dclose( id );
@@ -275,16 +497,16 @@ void DataSet::p_close() const
}
}
-// The destructor of this instance calls IdComponent::reset to
-// reset its identifier - no longer true
-// Older compilers (baldric) don't support template member functions
-// and IdComponent::reset is one; so at this time, the resetId is not
-// a member function so it can be template to work around that problem.
+//--------------------------------------------------------------------------
+// Function: DataSet destructor
+///\brief Properly terminates access to this dataset.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
DataSet::~DataSet()
{
// The dataset id will be closed properly
try {
- resetIdComponent( this ); }
+ resetIdComponent( this ); }
catch (Exception close_error) { // thrown by p_close
cerr << "DataSet::~DataSet - " << close_error.getDetailMsg() << endl;
}
diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h
index 9f01eb4..6960757 100644
--- a/c++/src/H5DataSet.h
+++ b/c++/src/H5DataSet.h
@@ -33,6 +33,12 @@ class H5_DLLCPP DataSet : public AbstractDs {
// Gets the storage size of this dataset.
hsize_t getStorageSize() const;
+ // Returns the address of this dataset in the file.
+ haddr_t getOffset() const;
+
+ // Determines whether space has been allocated for a dataset.
+ void getSpaceStatus(H5D_space_status_t& status) const;
+
// not yet implemented??
hsize_t getVlenBufSize( DataType& type, DataSpace& space ) const;
void vlenReclaim( DataType& type, DataSpace& space, DSetMemXferPropList& xfer_plist, void* buf ) const;
@@ -60,18 +66,29 @@ class H5_DLLCPP DataSet : public AbstractDs {
// Fills a selection in memory with zero
void fillMemBuf(void *buf, DataType& buf_type, DataSpace& space);
- // Creates a copy of an existing DataSet using its id
- // Note: used by CommonFG to return a DataSet; should be modified
- // to use friend template function instead)
- DataSet( const hid_t dataset_id );
+ // Creates a reference to a named Hdf5 object in this object.
+ void* Reference(const char* name) const;
+
+ // Creates a reference to a named Hdf5 object or to a dataset region
+ // in this object.
+ void* Reference(const char* name, DataSpace& dataspace, H5R_type_t ref_type = H5R_DATASET_REGION) const;
+
+ // Retrieves the type of object that an object reference points to.
+ H5G_obj_t getObjType(void *ref, H5R_type_t ref_type) const;
+
+ // Retrieves a dataspace with the region pointed to selected.
+ DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const;
+
+ // Creates a copy of an existing DataSet using its id.
+ DataSet(const hid_t existing_id);
- // Used by the API to appropriately close a dataset
+ // Used by the API to appropriately close a dataset.
virtual void p_close() const;
- // Default constructor
+ // Default constructor.
DataSet();
- // Copy constructor
+ // Copy constructor.
DataSet( const DataSet& original );
virtual ~DataSet();
diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp
index 5921274..6b338e2 100644
--- a/c++/src/H5DataSpace.cpp
+++ b/c++/src/H5DataSpace.cpp
@@ -20,8 +20,8 @@
#endif
#include "H5Include.h"
-#include "H5Exception.h"
#include "H5RefCounter.h"
+#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5Idtemplates.h"
#include "H5DataSpace.h"
@@ -32,10 +32,21 @@ namespace H5 {
const DataSpace DataSpace::ALL( H5S_ALL );
-// Default constructor
+//--------------------------------------------------------------------------
+// Function: DataSpace default constructor
+///\brief Default constructor: Creates a stub datatype
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
DataSpace::DataSpace() : IdComponent() {}
-// This constructor creates a DataSpace instance, given a dataspace type
+//--------------------------------------------------------------------------
+// Function: DataSpace overloaded constructor
+///\brief Creates a dataspace given a dataspace type.
+///\param type - IN: Type of the dataspace to be created, which
+/// currently can be either \c H5S_SCALAR or \c H5S_SIMPLE
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
DataSpace::DataSpace( H5S_class_t type ) : IdComponent()
{
id = H5Screate( type );
@@ -45,7 +56,15 @@ DataSpace::DataSpace( H5S_class_t type ) : IdComponent()
}
}
-// Creates a new simple data space and opens it for access.
+//--------------------------------------------------------------------------
+// Function: DataSpace overloaded constructor
+///\brief Creates a new simple dataspace and opens it for access.
+///\param rank - IN: Number of dimensions of dataspace.
+///\param dims - IN: An array of the size of each dimension.
+///\param maxdims - IN: An array of the maximum size of each dimension.
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
DataSpace::DataSpace( int rank, const hsize_t * dims, const hsize_t * maxdims) : IdComponent()
{
id = H5Screate_simple( rank, dims, maxdims );
@@ -55,51 +74,76 @@ DataSpace::DataSpace( int rank, const hsize_t * dims, const hsize_t * maxdims) :
}
}
-/* Constructor that takes an existing dataspace id
-Description:
- Uses an HDF5 id to create a DataSpace identifier instance.
- This id can be either an existing dataspace id or a default
- dataspace id. Design note: in the case of default dataspace,
- the identifier still has reference counter; the p_close function
- will take care of not to call H5Sclose on the default id.
-*/
-DataSpace::DataSpace( const hid_t space_id ) : IdComponent( space_id ) {}
-
-// Copy constructor: makes a copy of the original DataSpace instance
+//--------------------------------------------------------------------------
+// Function: DataSpace overloaded constructor
+///\brief Creates an DataSpace object using the id of an existing
+/// dataspace.
+///\param existing_id - IN: Id of an existing dataspace
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+DataSpace::DataSpace(const hid_t existing_id) : IdComponent(existing_id) {}
+
+//--------------------------------------------------------------------------
+// Function: DataSpace copy constructor
+///\brief Copy constructor: makes a copy of the original DataSpace object.
+///\param original - IN: DataSpace instance to copy
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
DataSpace::DataSpace( const DataSpace& original ) : IdComponent( original ) {}
-// Makes a copy of an existing dataspace
+//--------------------------------------------------------------------------
+// Function: DataSpace::copy
+///\brief Makes a copy of an existing dataspace.
+///\param like_space - IN: Dataspace to be copied
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void DataSpace::copy( const DataSpace& like_space )
{
// reset the identifier of this instance - send 'this' in so that
// H5Sclose can be called appropriately
- try {
- resetIdComponent( this ); }
- catch (Exception close_error) { // thrown by p_close
- throw DataSpaceIException("DataSpace::copy", close_error.getDetailMsg());
- }
+ try {
+ resetIdComponent( this ); }
+ catch (Exception close_error) { // thrown by p_close
+ throw DataSpaceIException("DataSpace::copy", close_error.getDetailMsg());
+ }
// call C routine to copy the dataspace
id = H5Scopy( like_space.getId() );
- // new ref counter for this id
+ // new ref counter for this id
ref_count = new RefCounter;
if( id <= 0 )
- {
throw DataSpaceIException("DataSpace::copy", "H5Scopy failed");
- }
}
-// Makes a copy of the dataspace on the right hand side and stores
-// the new id in the left hand side object.
+//--------------------------------------------------------------------------
+// Function: DataSpace::operator=
+///\brief Assignment operator
+///\param rhs - IN: Reference to the existing dataspace
+///\return Reference to DataSpace instance
+///\exception H5::DataSpaceIException
+// Description
+// Makes a copy of the type on the right hand side and stores
+// the new id in the left hand side object.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
DataSpace& DataSpace::operator=( const DataSpace& rhs )
{
copy(rhs);
return(*this);
}
-// Determines whether this dataspace is a simple dataspace.
+//--------------------------------------------------------------------------
+// Function: DataSpace::isSimple
+///\brief Determines whether this dataspace is a simple dataspace.
+///\return true if the dataspace is a simple dataspace, and false,
+/// otherwise
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
bool DataSpace::isSimple () const
{
htri_t simple = H5Sis_simple( id );
@@ -114,7 +158,18 @@ bool DataSpace::isSimple () const
}
}
-// Sets the offset of this simple dataspace.
+//--------------------------------------------------------------------------
+// Function: DataSpace::offsetSimple
+///\brief Sets the offset of this simple dataspace.
+///\param offset - IN: Offset to position the selection at
+///\exception H5::DataSpaceIException
+///\par Description
+/// This function creates an offset for the selection within
+/// an extent, allowing the same shaped selection to be moved
+/// to different locations within a dataspace without requiring
+/// it to be re-defined.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void DataSpace::offsetSimple ( const hssize_t* offset ) const
{
herr_t ret_value = H5Soffset_simple( id, offset );
@@ -124,7 +179,16 @@ void DataSpace::offsetSimple ( const hssize_t* offset ) const
}
}
-// Retrieves dataspace dimension size and maximum size
+//--------------------------------------------------------------------------
+// Function: DataSpace::getSimpleExtentDims
+///\brief Retrieves dataspace dimension size and maximum size.
+///\param dims - IN: Name of the new member
+///\param maxdims - IN: Pointer to the value of the new member
+///\return Number of dimensions, the same value as returned by
+/// \c DataSpace::getSimpleExtentNdims()
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
int DataSpace::getSimpleExtentDims ( hsize_t *dims, hsize_t *maxdims ) const
{
int ndims = H5Sget_simple_extent_dims( id, dims, maxdims );
@@ -136,7 +200,13 @@ int DataSpace::getSimpleExtentDims ( hsize_t *dims, hsize_t *maxdims ) const
return( ndims );
}
-// Determines the dimensionality of a dataspace
+//--------------------------------------------------------------------------
+// Function: DataSpace::getSimpleExtentNdims
+///\brief Determines the dimensionality of a dataspace.
+///\return Number of dimensions
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
int DataSpace::getSimpleExtentNdims () const
{
int ndims = H5Sget_simple_extent_ndims( id );
@@ -148,10 +218,17 @@ int DataSpace::getSimpleExtentNdims () const
return( ndims );
}
-// Determines the number of elements in a dataspace
-// 12/05/00: due to C API change
-// return type hssize_t vs. hsize_t
-// num_elements = -1 when failure occurs vs. 0
+//--------------------------------------------------------------------------
+// Function: DataSpace::getSimpleExtentNpoints
+///\brief Determines the number of elements in a dataspace.
+///\return Number of elements
+///\exception H5::DataSpaceIException
+// Modification
+// 12/05/00: due to C API change
+// return type hssize_t vs. hsize_t
+// num_elements = -1 when failure occurs vs. 0
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
hssize_t DataSpace::getSimpleExtentNpoints () const
{
hssize_t num_elements = H5Sget_simple_extent_npoints( id );
@@ -165,7 +242,13 @@ hssize_t DataSpace::getSimpleExtentNpoints () const
}
}
-// Determine the current class of a dataspace
+//--------------------------------------------------------------------------
+// Function: DataSpace::getSimpleExtentType
+///\brief Determine the current class of a dataspace.
+///\return Class of the dataspace
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
H5S_class_t DataSpace::getSimpleExtentType () const
{
H5S_class_t class_name = H5Sget_simple_extent_type( id );
@@ -177,7 +260,13 @@ H5S_class_t DataSpace::getSimpleExtentType () const
return( class_name );
}
-// Copies the extent of a dataspace
+//--------------------------------------------------------------------------
+// Function: DataSpace::extentCopy
+///\brief Copies the extent of a dataspace.
+///\param dest_space - IN: DataSpace to copy from
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void DataSpace::extentCopy ( DataSpace& dest_space ) const
{
hid_t dest_space_id = dest_space.getId();
@@ -188,7 +277,15 @@ void DataSpace::extentCopy ( DataSpace& dest_space ) const
}
}
-// Sets or resets the size of an existing dataspace
+//--------------------------------------------------------------------------
+// Function: DataSpace::setExtentSimple
+///\brief Sets or resets the size of an existing dataspace.
+///\param rank - IN: Rank of the dataspace
+///\param current_size - IN: Array containing current size of dataspace
+///\param maximum_size - IN: Array containing maximum size of dataspace
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void DataSpace::setExtentSimple( int rank, const hsize_t *current_size, const hsize_t *maximum_size ) const
{
herr_t ret_value;
@@ -199,7 +296,12 @@ void DataSpace::setExtentSimple( int rank, const hsize_t *current_size, const hs
}
}
-// Removes the extent from a dataspace
+//--------------------------------------------------------------------------
+// Function: DataSpace::setExtentNone
+///\brief Removes the extent from a dataspace.
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void DataSpace::setExtentNone () const
{
herr_t ret_value = H5Sset_extent_none( id );
@@ -209,7 +311,13 @@ void DataSpace::setExtentNone () const
}
}
-// Determines the number of elements in a dataspace selection
+//--------------------------------------------------------------------------
+// Function: DataSpace::getSelectNpoints
+///\brief Returns the number of elements in a dataspace selection.
+///\return Number of elements
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
hssize_t DataSpace::getSelectNpoints () const
{
hssize_t num_elements = H5Sget_select_npoints( id );
@@ -221,7 +329,13 @@ hssize_t DataSpace::getSelectNpoints () const
return( num_elements );
}
-// Get number of hyperslab blocks
+//--------------------------------------------------------------------------
+// Function: DataSpace::getSelectHyperNblocks
+///\brief Returns number of hyperslab blocks.
+///\return Number of hyperslab blocks
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
hssize_t DataSpace::getSelectHyperNblocks () const
{
hssize_t num_blocks = H5Sget_select_hyper_nblocks( id );
@@ -233,7 +347,15 @@ hssize_t DataSpace::getSelectHyperNblocks () const
return( num_blocks );
}
-// Gets the list of hyperslab blocks currently selected
+//--------------------------------------------------------------------------
+// Function: DataSpace::getSelectHyperBlocklist
+///\brief Gets the list of hyperslab blocks currently selected
+///\param startblock - IN: Hyperslab block to start with
+///\param numblocks - IN: Number of hyperslab blocks to get
+///\param buf - IN: List of hyperslab blocks selected
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void DataSpace::getSelectHyperBlocklist( hsize_t startblock, hsize_t numblocks, hsize_t *buf ) const
{
herr_t ret_value;
@@ -245,7 +367,13 @@ void DataSpace::getSelectHyperBlocklist( hsize_t startblock, hsize_t numblocks,
}
}
-// Gets the number of element points in the current selection
+//--------------------------------------------------------------------------
+// Function: DataSpace::getSelectElemNpoints
+///\brief Returns the number of element points in the current selection.
+///\return Number of element points
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
hssize_t DataSpace::getSelectElemNpoints () const
{
hssize_t num_points = H5Sget_select_elem_npoints( id );
@@ -257,7 +385,19 @@ hssize_t DataSpace::getSelectElemNpoints () const
return( num_points );
}
-// Gets the list of element points currently selected
+//--------------------------------------------------------------------------
+// Function: DataSpace::getSelectElemPointlist
+///\brief Gets the list of element points currently selected
+///\param startpoint - IN: Element point to start with
+///\param numpoints - IN: Number of element points to get
+///\param buf - IN: List of element points selected
+///\exception H5::DataSpaceIException
+///\par Description
+/// For more information, please refer to the C layer Reference
+/// Manual at:
+/// http:
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void DataSpace::getSelectElemPointlist ( hsize_t startpoint, hsize_t numpoints, hsize_t *buf ) const
{
herr_t ret_value;
@@ -269,7 +409,19 @@ void DataSpace::getSelectElemPointlist ( hsize_t startpoint, hsize_t numpoints,
}
}
-// Gets the bounding box containing the current selection
+//--------------------------------------------------------------------------
+// Function: DataSpace::getSelectBounds
+///\brief Gets the bounding box containing the current selection.
+///\param start - IN: Starting coordinates of the bounding box
+///\param end - IN: Ending coordinates of the bounding box, i.e.,
+/// the coordinates of the diagonally opposite corner
+///\exception H5::DataSpaceIException
+///\par Description
+/// For more information, please refer to the C layer Reference
+/// Manual at:
+/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5S.html#Dataspace-SelectBounds
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void DataSpace::getSelectBounds ( hssize_t* start, hssize_t* end ) const
{
herr_t ret_value = H5Sget_select_bounds( id, start, end );
@@ -280,7 +432,22 @@ void DataSpace::getSelectBounds ( hssize_t* start, hssize_t* end ) const
}
}
-// Selects array elements to be included in the selection for a dataspace
+//--------------------------------------------------------------------------
+// Function: DataSpace::H5Sselect_elements
+///\brief Selects array elements to be included in the selection for
+/// this dataspace.
+///\param op - IN: Operator specifying how the new selection is to be
+/// combined with the existing selection for the dataspace
+///\param num_elements - IN: Number of elements to be selected
+///\param coord - IN: A 2-dimensional array of 0-based values
+/// specifying the coordinates of the elements being selected
+///\exception H5::DataSpaceIException
+///\par Description
+/// For more information, please refer to the C layer Reference
+/// Manual at:
+/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5S.html#Dataspace-SelectElements
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void DataSpace::selectElements ( H5S_seloper_t op, const size_t num_elements, const hssize_t *coord[ ] ) const
{
herr_t ret_value;
@@ -292,7 +459,12 @@ void DataSpace::selectElements ( H5S_seloper_t op, const size_t num_elements, co
}
}
-// Selects the entire dataspace
+//--------------------------------------------------------------------------
+// Function: DataSpace::selectAll
+///\brief Selects the entire dataspace.
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void DataSpace::selectAll () const
{
herr_t ret_value = H5Sselect_all( id );
@@ -302,7 +474,12 @@ void DataSpace::selectAll () const
}
}
-//Resets the selection region to include no elements
+//--------------------------------------------------------------------------
+// Function: DataSpace::selectNone
+///\brief Resets the selection region to include no elements.
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void DataSpace::selectNone () const
{
herr_t ret_value = H5Sselect_none( id );
@@ -313,7 +490,15 @@ void DataSpace::selectNone () const
}
}
-// Verifies that the selection is within the extent of the dataspace
+//--------------------------------------------------------------------------
+// Function: DataSpace::selectValid
+///\brief Verifies that the selection is within the extent of the
+/// dataspace.
+///\return true if the selection is within the extent of the
+/// dataspace, and false, otherwise
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
bool DataSpace::selectValid () const
{
htri_t ret_value = H5Sselect_valid( id );
@@ -328,7 +513,21 @@ bool DataSpace::selectValid () const
}
}
-// Selects a hyperslab region to add to the current selected region
+//--------------------------------------------------------------------------
+// Function: DataSpace::selectHyperslab
+///\brief Selects a hyperslab region to add to the current selected region.
+///\param op - IN: Operation to perform on current selection
+///\param count - IN: Offset of the start of hyperslab
+///\param start - IN: Number of blocks included in the hyperslab
+///\param stride - IN: Hyperslab stride
+///\param block - IN: Size of block in the hyperslab
+///\exception H5::DataSpaceIException
+///\par Description
+/// For more information, please refer to the C layer Reference
+/// Manual at:
+/// http:
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void DataSpace::selectHyperslab( H5S_seloper_t op, const hsize_t *count, const hssize_t *start, const hsize_t *stride, const hsize_t *block ) const
{
herr_t ret_value;
@@ -354,11 +553,11 @@ void DataSpace::p_close() const
}
}
-// The destructor of this instance calls IdComponent::reset to
-// reset its identifier - no longer true
-// Older compilers (baldric) don't support template member functions
-// and IdComponent::reset is one; so at this time, the resetId is not
-// a member function so it can be template to work around that problem.
+//--------------------------------------------------------------------------
+// Function: DataSpace destructor
+///\brief Properly terminates access to this dataspace.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
DataSpace::~DataSpace()
{
// The dataspace id will be closed properly
diff --git a/c++/src/H5EnumType.cpp b/c++/src/H5EnumType.cpp
index edbc1bc..8567a6d 100644
--- a/c++/src/H5EnumType.cpp
+++ b/c++/src/H5EnumType.cpp
@@ -33,20 +33,48 @@
namespace H5 {
#endif
-// Creates an empty enumeration datatype based on a native signed
-// integer type.
-EnumType::EnumType( size_t size ) : DataType( H5T_ENUM, size ) {}
-
-// Default constructor
+//--------------------------------------------------------------------------
+// Function: EnumType default constructor
+///\brief Default constructor: Creates a stub datatype
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
EnumType::EnumType() : DataType() {}
-// Creates a enumeration datatype using an existing id
+//--------------------------------------------------------------------------
+// Function: EnumType overloaded constructor
+///\brief Creates an EnumType object using the id of an existing datatype.
+///\param existing_id - IN: Id of an existing datatype
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
EnumType::EnumType( const hid_t existing_id ) : DataType( existing_id ) {}
-// Copy constructor: makes a copy of the original EnumType object.
+//--------------------------------------------------------------------------
+// Function: EnumType copy constructor
+///\brief Copy constructor: makes a copy of the original EnumType object.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
EnumType::EnumType( const EnumType& original ) : DataType( original ) {}
-// Gets the enum datatype of the specified dataset
+//--------------------------------------------------------------------------
+// Function: EnumType overloaded constructor
+///\brief Creates an empty enumeration datatype given a size, in bytes.
+///\param size - IN: Number of bytes in the datatype to create
+///\exception H5::DataTypeIException
+// Description
+// The DataType constructor calls the C API H5Tcreate to create
+// the enum datatype.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+EnumType::EnumType( size_t size ) : DataType( H5T_ENUM, size ) {}
+
+//--------------------------------------------------------------------------
+// Function: EnumType overloaded constructor
+///\brief Gets the enum datatype of the specified dataset.
+///\param dataset - IN: Dataset that this enum datatype associates with
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
EnumType::EnumType( const DataSet& dataset ) : DataType()
{
// Calls C function H5Dget_type to get the id of the datatype
@@ -59,7 +87,13 @@ EnumType::EnumType( const DataSet& dataset ) : DataType()
}
}
-// Creates a new enum datatype based on an integer datatype
+//--------------------------------------------------------------------------
+// Function: EnumType overloaded constructor
+///\brief Creates a new enum datatype based on an integer datatype.
+///\param data_type - IN: Base datatype
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
EnumType::EnumType( const IntType& data_type ) : DataType()
{
// Calls C function H5Tenum_create to get the id of the datatype
@@ -72,11 +106,14 @@ EnumType::EnumType( const IntType& data_type ) : DataType()
}
}
-// Inserts a new member to this enumeration datatype.
-void EnumType::insert( const string& name, void *value ) const
-{
- insert( name.c_str(), value );
-}
+//--------------------------------------------------------------------------
+// Function: EnumType::insert
+///\brief Inserts a new member to this enumeration datatype.
+///\param name - IN: Name of the new member
+///\param value - IN: Pointer to the value of the new member
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void EnumType::insert( const char* name, void *value ) const
{
// Calls C routine H5Tenum_insert to insert the new enum datatype member.
@@ -87,7 +124,27 @@ void EnumType::insert( const char* name, void *value ) const
}
}
-// Returns the symbol name corresponding to a specified member of an enumeration datatype.
+//--------------------------------------------------------------------------
+// Function: EnumType::insert
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function only in the type of
+/// argument \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void EnumType::insert( const string& name, void *value ) const
+{
+ insert( name.c_str(), value );
+}
+
+//--------------------------------------------------------------------------
+// Function: EnumType::nameOf
+///\brief Returns the symbol name corresponding to a specified member
+/// of this enumeration datatype.
+///\param value - IN: Pointer to the value of the enum datatype
+///\param size - IN: Size for the name
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
string EnumType::nameOf( void *value, size_t size ) const
{
char* name_C = new char[size+1]; // temporary C-string for C API
@@ -102,16 +159,19 @@ string EnumType::nameOf( void *value, size_t size ) const
}
// otherwise, create the string to hold the datatype name and return it
string name = string( name_C );
- delete name_C;
+ delete [] name_C;
return( name );
}
-// Retrieves the value corresponding to a member of an enumeration
-// datatype, given the member's name.
-void EnumType::valueOf( const string& name, void *value ) const
-{
- valueOf( name.c_str(), value );
-}
+//--------------------------------------------------------------------------
+// Function: EnumType::valueOf
+///\brief Retrieves the value corresponding to a member of this
+/// enumeration datatype, given the member's name.
+///\param name - IN: Name of the queried member
+///\param value - OUT: Pointer to the retrieved value
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void EnumType::valueOf( const char* name, void *value ) const
{
// Calls C routine H5Tenum_valueof to get the enum datatype value
@@ -122,20 +182,28 @@ void EnumType::valueOf( const char* name, void *value ) const
}
}
-/*-------------------------------------------------------------------------
- * Function: getMemberIndex
- *
- * Purpose: Returns the index of a member in an enumeration data type.
- * Members are stored in no particular order with numbers 0
- * through N-1, where N is the value returned by the member
- * function getNmembers.
- *
- * Return: Success: index of the member if exists.
- * Failure: DataTypeIException
- *
- * BMR - May 16, 2002
- *-------------------------------------------------------------------------
- */
+//--------------------------------------------------------------------------
+// Function: EnumType::valueOf
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function only in the type of
+/// argument \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void EnumType::valueOf( const string& name, void *value ) const
+{
+ valueOf( name.c_str(), value );
+}
+
+//--------------------------------------------------------------------------
+// Function: EnumType::getMemberIndex
+///\brief Returns the index of a member in this enumeration datatype.
+///\param name - IN: Name of the queried member
+///\return Index of the member if it exists. Index will have the value
+/// between 0 and \c N-1, where \c N is the value returned by the
+/// member function \c EnumType::getNmembers.
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - May 16, 2002
+//--------------------------------------------------------------------------
int EnumType::getMemberIndex(const char *name) const
{
int member_index = H5Tget_member_index(id, name);
@@ -146,13 +214,46 @@ int EnumType::getMemberIndex(const char *name) const
}
return( member_index );
}
+
+//--------------------------------------------------------------------------
+// Function: EnumType::getMemberIndex
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function only in the type of
+/// argument \a name.
+// Programmer Binh-Minh Ribler - May 16, 2002
+//--------------------------------------------------------------------------
int EnumType::getMemberIndex(const string& name) const
{
return(EnumType::getMemberIndex(name.c_str()));
}
-// Retrieves the value of a member in this enumeration datatype, given the
-// member's index.
+//--------------------------------------------------------------------------
+// Function: EnumType::getNmembers
+///\brief Returns the number of members in this enumeration datatype.
+///\return Number of members
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - May, 2004
+//--------------------------------------------------------------------------
+int EnumType::getNmembers() const
+{
+ int num_members = H5Tget_nmembers( id );
+ if( num_members < 0 )
+ {
+ throw DataTypeIException("CompType::getNmembers",
+ "H5Tget_nmembers returns negative number of members");
+ }
+ return( num_members );
+}
+
+//--------------------------------------------------------------------------
+// Function: EnumType::getMemberValue
+///\brief Retrieves the value of a member in this enumeration datatype,
+/// given the member's index.
+///\param memb_no - IN: Index of the queried member
+///\param value - OUT: Pointer to the retrieved value
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void EnumType::getMemberValue( int memb_no, void *value ) const
{
// Call C routine H5Tget_member_value to get the datatype member's value
@@ -163,7 +264,11 @@ void EnumType::getMemberValue( int memb_no, void *value ) const
}
}
-// Default destructor
+//--------------------------------------------------------------------------
+// Function: EnumType destructor
+///\brief Properly terminates access to this enum datatype.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
EnumType::~EnumType() {}
#ifndef H5_NO_NAMESPACE
diff --git a/c++/src/H5EnumType.h b/c++/src/H5EnumType.h
index efeee26..cca253a 100644
--- a/c++/src/H5EnumType.h
+++ b/c++/src/H5EnumType.h
@@ -59,6 +59,9 @@ class H5_DLLCPP EnumType : public DataType {
int getMemberIndex(const char* name) const;
int getMemberIndex(const string& name) const;
+ // Returns the number of members in this enumeration datatype.
+ int getNmembers () const;
+
// Returns the value of an enumeration datatype member
void getMemberValue( int memb_no, void *value ) const;
diff --git a/c++/src/H5FloatType.cpp b/c++/src/H5FloatType.cpp
index 6d3525d..010d8a3 100644
--- a/c++/src/H5FloatType.cpp
+++ b/c++/src/H5FloatType.cpp
@@ -33,23 +33,51 @@
namespace H5 {
#endif
-// Default constructor
+//--------------------------------------------------------------------------
+// Function: FloatType default constructor
+///\brief Default constructor: Creates a stub floating-point datatype
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
FloatType::FloatType() {}
-// Creates a floating-point type using a predefined type
+//--------------------------------------------------------------------------
+// Function: FloatType overloaded constructor
+///\brief Creates a floating-point datatype using a predefined type.
+///\param pred_type - IN: Predefined datatype
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
FloatType::FloatType( const PredType& pred_type ) : AtomType()
{
// use DataType::copy to make a copy of this predefined type
copy( pred_type );
}
-// Creates a floating-point datatype using an existing id
+//--------------------------------------------------------------------------
+// Function: FloatType overloaded constructor
+///\brief Creates an FloatType object using the id of an existing
+/// datatype.
+///\param existing_id - IN: Id of an existing datatype
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
FloatType::FloatType( const hid_t existing_id ) : AtomType( existing_id ) {}
-// Copy constructor: makes a copy of the original FloatType object
+//--------------------------------------------------------------------------
+// Function: FloatType copy constructor
+///\brief Copy constructor: makes a copy of the original FloatType object.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
FloatType::FloatType( const FloatType& original ) : AtomType( original ){}
-// Gets the floating-point datatype of the specified dataset - will reimplement
+//--------------------------------------------------------------------------
+// Function: EnumType overloaded constructor
+///\brief Gets the floating-point datatype of the specified dataset
+///\param dataset - IN: Dataset that this floating-point datatype
+/// associates with
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
FloatType::FloatType( const DataSet& dataset ) : AtomType()
{
// Calls C function H5Dget_type to get the id of the datatype
@@ -61,7 +89,17 @@ FloatType::FloatType( const DataSet& dataset ) : AtomType()
}
}
-// Retrieves floating point datatype bit field information.
+//--------------------------------------------------------------------------
+// Function: FloatType::getFields
+///\brief Retrieves floating point datatype bit field information.
+///\param spos - OUT: Retrieved floating-point sign bit
+///\param epos - OUT: Retrieved exponent bit-position
+///\param esize - OUT: Retrieved size of exponent, in bits
+///\param mpos - OUT: Retrieved mantissa bit-position
+///\param msize - OUT: Retrieved size of mantissa, in bits
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void FloatType::getFields( size_t& spos, size_t& epos, size_t& esize, size_t& mpos, size_t& msize ) const
{
herr_t ret_value = H5Tget_fields( id, &spos, &epos, &esize, &mpos, &msize );
@@ -71,7 +109,18 @@ void FloatType::getFields( size_t& spos, size_t& epos, size_t& esize, size_t& mp
}
}
-// Sets locations and sizes of floating point bit fields.
+//--------------------------------------------------------------------------
+// Function: FloatType::setFields
+///\brief Sets locations and sizes of floating point bit fields.
+///\param spos - OUT: Sign position, i.e., the bit offset of the
+/// floating-point sign bit.
+///\param epos - OUT: Exponent bit position
+///\param esize - OUT: Size of exponent, in bits
+///\param mpos - OUT: Mantissa bit-position
+///\param msize - OUT: Size of mantissa, in bits
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void FloatType::setFields( size_t spos, size_t epos, size_t esize, size_t mpos, size_t msize ) const
{
herr_t ret_value = H5Tset_fields( id, spos, epos, esize, mpos, msize );
@@ -81,7 +130,13 @@ void FloatType::setFields( size_t spos, size_t epos, size_t esize, size_t mpos,
}
}
-// Retrieves the exponent bias of a floating-point type.
+//--------------------------------------------------------------------------
+// Function: FloatType::getEbias
+///\brief Retrieves the exponent bias of a floating-point type.
+///\return Exponent bias
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
size_t FloatType::getEbias() const
{
size_t ebias = H5Tget_ebias( id );
@@ -93,7 +148,13 @@ size_t FloatType::getEbias() const
return( ebias );
}
-// Sets the exponent bias of a floating-point type.
+//--------------------------------------------------------------------------
+// Function: FloatType::setEbias
+///\brief Sets the exponent bias of a floating-point type.
+///\param ebias - Exponent bias value
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void FloatType::setEbias( size_t ebias ) const
{
herr_t ret_value = H5Tset_ebias( id, ebias );
@@ -103,7 +164,21 @@ void FloatType::setEbias( size_t ebias ) const
}
}
-// Retrieves mantissa normalization of a floating-point datatype.
+//--------------------------------------------------------------------------
+// Function: FloatType::getNorm
+///\brief Retrieves mantissa normalization of a floating-point datatype.
+///\param norm_string - OUT: Text string of the normalization type
+///\return Valid normalization type, which can be:
+/// \li \c H5T_NORM_IMPLIED (0) - MSB of mantissa is not stored
+/// \li \c H5T_NORM_MSBSET (1) - MSB of mantissa is always 1
+/// \li \c H5T_NORM_NONE (2) - Mantissa is not normalized
+///\exception H5::DataTypeIException
+///\par Description
+/// For your convenience, this function also provides the text
+/// string of the returned normalization type, via parameter
+/// \a norm_string.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
H5T_norm_t FloatType::getNorm( string& norm_string ) const
{
H5T_norm_t norm = H5Tget_norm( id ); // C routine
@@ -121,7 +196,18 @@ H5T_norm_t FloatType::getNorm( string& norm_string ) const
return( norm );
}
-// Sets the mantissa normalization of a floating-point datatype.
+//--------------------------------------------------------------------------
+// Function: FloatType::setNorm
+///\brief Sets the mantissa normalization of a floating-point datatype.
+///\param norm - IN: Mantissa normalization type
+///\exception H5::DataTypeIException
+///\par Description
+/// Valid values for normalization type include:
+/// \li \c H5T_NORM_IMPLIED (0) - MSB of mantissa is not stored
+/// \li \c H5T_NORM_MSBSET (1) - MSB of mantissa is always 1
+/// \li \c H5T_NORM_NONE (2) - Mantissa is not normalized
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void FloatType::setNorm( H5T_norm_t norm ) const
{
herr_t ret_value = H5Tset_norm( id, norm );
@@ -131,7 +217,21 @@ void FloatType::setNorm( H5T_norm_t norm ) const
}
}
-// Retrieves the internal padding type for unused bits in floating-point datatypes.
+//--------------------------------------------------------------------------
+// Function: FloatType::getInpad
+///\brief Retrieves the internal padding type for unused bits in
+/// this floating-point datatypes.
+///\return Internal padding type, which can be:
+/// \li \c H5T_PAD_ZERO (0) - Set background to zeros
+/// \li \c H5T_PAD_ONE (1) - Set background to ones
+/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone
+///\exception H5::DataTypeIException
+///\par Description
+/// For your convenience, this function also provides the text
+/// string of the returned internal padding type, via parameter
+/// \a pad_string.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
H5T_pad_t FloatType::getInpad( string& pad_string ) const
{
H5T_pad_t pad_type = H5Tget_inpad( id );
@@ -149,7 +249,23 @@ H5T_pad_t FloatType::getInpad( string& pad_string ) const
return( pad_type );
}
-// Fills unused internal floating point bits.
+//--------------------------------------------------------------------------
+// Function: FloatType::setInpad
+///\brief Fills unused internal floating point bits.
+///\param inpad - IN: Internal padding type
+///\exception H5::DataTypeIException
+///\par Description
+/// If any internal bits of a floating point type are unused
+/// (that is, those significant bits which are not part of the
+/// sign, exponent, or mantissa), then they will be filled
+/// according to the padding value provided by \a inpad.
+///\par
+/// Valid values for normalization type include:
+/// \li \c H5T_PAD_ZERO (0) - Set background to zeros
+/// \li \c H5T_PAD_ONE (1) - Set background to ones
+/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void FloatType::setInpad( H5T_pad_t inpad ) const
{
herr_t ret_value = H5Tset_inpad( id, inpad );
@@ -159,7 +275,11 @@ void FloatType::setInpad( H5T_pad_t inpad ) const
}
}
-// Default destructor
+//--------------------------------------------------------------------------
+// Function: FloatType destructor
+///\brief Noop destructor.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
FloatType::~FloatType() {}
#ifndef H5_NO_NAMESPACE
diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp
index 3140836..503fc2e 100644
--- a/c++/src/H5IdComponent.cpp
+++ b/c++/src/H5IdComponent.cpp
@@ -1,7 +1,7 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by the Board of Trustees of the University of Illinois. *
- * All rights reserved. *
- * *
+ * 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 *
@@ -25,22 +25,36 @@
namespace H5 {
#endif
-// Default constructor - private
+//--------------------------------------------------------------------------
+// Function: IdComponent default constructor - private
+///\brief Default constructor.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
IdComponent::IdComponent() : id( -1 )
{
// starts counting object references
ref_count = new RefCounter;
}
-// Constructor that takes an HDF5 object id. It creates an instance
-// of IdComponent to hold the HDF5 id
+//--------------------------------------------------------------------------
+// Function: IdComponent overloaded constructor
+///\brief Creates an IdComponent object using the id of an existing object.
+///\param h5_id - IN: Id of an existing object
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
IdComponent::IdComponent( const hid_t h5_id ) : id( h5_id )
{
// starts counting object references
ref_count = new RefCounter;
}
-// Copy constructor: makes a copy of the original object
+//--------------------------------------------------------------------------
+// Function: IdComponent copy constructor
+///\brief Copy constructor: makes a copy of the original IdComponent object.
+///\param original - IN: IdComponent instance to copy
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
IdComponent::IdComponent( const IdComponent& original )
{
id = original.id;
@@ -48,13 +62,26 @@ IdComponent::IdComponent( const IdComponent& original )
ref_count->increment(); // increment number of references to this id
}
-// Increment reference counter
+//--------------------------------------------------------------------------
+// Function: IdComponent::incRefCount
+///\brief Increment id reference counter.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void IdComponent::incRefCount() { ref_count->increment(); }
-// Decrement reference counter
+//--------------------------------------------------------------------------
+// Function: IdComponent::decRefCount
+///\brief Decrement id reference counter.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void IdComponent::decRefCount() { ref_count->decrement(); }
-// Get the reference counter to this identifier
+//--------------------------------------------------------------------------
+// Function: IdComponent::getCounter
+///\brief Returns the reference counter to this identifier.
+///\return Reference count
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
int IdComponent::getCounter() { return( ref_count->getCounter()); }
// Decrements the reference counter then determines if there are no more
@@ -66,13 +93,20 @@ bool IdComponent::noReference()
return( ref_count->getCounter() == 0 ? true:false );
}
-/* Assignment operator.
- Description:
- Reset the identifier of this object so that the HDF5 id can be properly
- closed. Copy the new identifier to this object, then increment the
- reference counter of the identifier to indicate that another object
- is referencing the identifier.
-*/
+//--------------------------------------------------------------------------
+// Function: IdComponent::operator=
+///\brief Assignment operator.
+///\param rhs - IN: Reference to the existing object
+///\return Reference to IdComponent instance
+///\exception H5::IdComponentException when attempt to close the HDF5
+/// object fails
+// Description
+// Reset the identifier of this object so that the HDF5 id can
+// be properly closed. Copy the id from rhs to this object,
+// then increment the reference counter of the id to indicate
+// that another object is referencing it.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
IdComponent& IdComponent::operator=( const IdComponent& rhs )
{
// reset the identifier of this object - resetIdComponent will call the
@@ -93,13 +127,18 @@ IdComponent& IdComponent::operator=( const IdComponent& rhs )
return( *this );
}
-/* Sets the identifier of this object to a new value
- Description:
- Reset the current identifier of this object so that the HDF5
- id can be appropriately closed. If only this object references
- its identifier, its reference counter will be deleted. A new
- reference counter is created for the new HDF5 object id.
-*/
+//--------------------------------------------------------------------------
+// Function: IdComponent::setId
+///\brief Sets the identifier of this object to a new value.
+///\exception H5::IdComponentException when the attempt to close the HDF5
+/// object fails
+// Description:
+// Reset the current id of this object so that the HDF5
+// id can be appropriately closed. If only this object references
+// its id, its reference counter will be deleted. A new
+// reference counter is created for the new HDF5 object id.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void IdComponent::setId( hid_t new_id )
{
// reset the identifier of this object, call appropriate H5Xclose
@@ -115,7 +154,12 @@ void IdComponent::setId( hid_t new_id )
ref_count = new RefCounter;
}
-// Gets the id of this object
+//--------------------------------------------------------------------------
+// Function: IdComponent::getId
+///\brief Returns the id of this object
+///\return HDF5 id
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
hid_t IdComponent::getId () const
{
return( id );
@@ -128,7 +172,11 @@ void IdComponent::reset ()
ref_count = NULL;
}
-// Default destructor
+//--------------------------------------------------------------------------
+// Function: IdComponent destructor
+///\brief Noop destructor.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
IdComponent::~IdComponent() {
/* uncomment this block and complete it when deciding to use dontAtExit
@@ -155,6 +203,80 @@ IdComponent::~IdComponent() {
*/
}
+//
+// Implementation of protected functions for HDF5 Reference Interface.
+//
+
+//--------------------------------------------------------------------------
+// Function: IdComponent::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
+// Return A reference
+// Exception H5::IdComponentException
+// Programmer Binh-Minh Ribler - May, 2004
+//--------------------------------------------------------------------------
+void* IdComponent::p_reference(const char* name, hid_t space_id, H5R_type_t ref_type) const
+{
+ void *ref;
+ herr_t ret_value = H5Rcreate(ref, id, name, ref_type, space_id);
+ if (ret_value < 0)
+ {
+ throw IdComponentException("IdComponent::p_reference",
+ "H5Rcreate failed");
+ }
+ return(ref);
+}
+
+//--------------------------------------------------------------------------
+// Function: IdComponent::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 IdComponent::p_get_obj_type(void *ref, H5R_type_t ref_type) const
+{
+ H5G_obj_t obj_type = H5Rget_obj_type(id, ref_type, ref);
+ if (obj_type == H5G_UNKNOWN)
+ {
+ throw IdComponentException("IdComponent::p_get_obj_type",
+ "H5R_get_obj_type failed");
+ }
+ return(obj_type);
+}
+
+//--------------------------------------------------------------------------
+// Function: IdComponent::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 IdComponent::p_get_region(void *ref, H5R_type_t ref_type) const
+{
+ hid_t space_id = H5Rget_region(id, ref_type, ref);
+ if (space_id < 0)
+ {
+ throw IdComponentException("IdComponent::p_get_region",
+ "H5Rget_region failed");
+ }
+ return(space_id);
+}
+
#ifndef H5_NO_NAMESPACE
}
#endif
diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h
index 85dc83f..fedca0e 100644
--- a/c++/src/H5IdComponent.h
+++ b/c++/src/H5IdComponent.h
@@ -58,9 +58,6 @@ class H5_DLLCPP IdComponent {
// Assignment operator
IdComponent& operator=( const IdComponent& rhs );
- // Resets this IdComponent instance
- //template <class Type>
- //void reset( Type* parent );
void reset();
void resetId();
@@ -75,35 +72,20 @@ class H5_DLLCPP IdComponent {
// Default constructor
IdComponent();
+ // 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(const char* name, hid_t space_id, H5R_type_t ref_type) const;
+
+ // 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;
+
+ // Retrieves a dataspace with the region pointed to selected.
+ hid_t p_get_region(void *ref, H5R_type_t ref_type) const;
+
}; // end class IdComponent
-// BMR - including template member function implementation here to
-// prevent compilation errors. When the compilers support template
-// member functions in *.C files, move them to IdComponent.C.
-
-// This function makes sure that this IdComponent instance actually
-// represents an HDF5 component and that this HDF5 component is no longer
-// referenced, then calls the parent function p_close to close the
-// appropriate HDF5 component. In addition, this identifier instance
-// will delete itself.
-// Type is the class of the instance to whom this IdComponent object
-// belongs.
-/* 11/10/00 - BMR: commented this member function because many compilers
- still have no support for member template function. The function is
- replaced by resetIdComponent in H5Idtemplates.h
-template <class Type>
-void IdComponent::reset( Type* parent )
-{
- if( ref_count->noReference()) // ref_count is decremented here
- {
- if( id > 0 )
- parent->p_close(); // which p_close depends on whom this
- // IdComponent object belongs to
- delete ref_count; // delete the reference counter
- delete this; // this IdComponent object deletes itself
- }
-}
-*/
#ifndef H5_NO_NAMESPACE
}
#endif
diff --git a/c++/src/H5IntType.cpp b/c++/src/H5IntType.cpp
index ff9f9e3..3986b3b 100644
--- a/c++/src/H5IntType.cpp
+++ b/c++/src/H5IntType.cpp
@@ -33,31 +33,51 @@
namespace H5 {
#endif
-// Default constructor
+
+//--------------------------------------------------------------------------
+// Function: IntType default constructor
+///\brief Default constructor: Creates a stub integer datatype
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
IntType::IntType() {}
-// Copy constructor: makes copy of the original IntType object
+//--------------------------------------------------------------------------
+// Function: IntType copy constructor
+///\brief Copy constructor: makes a copy of the original IntType object.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
IntType::IntType( const IntType& original ) : AtomType( original ) {}
-// Creates a integer type using a predefined type
+//--------------------------------------------------------------------------
+// Function: IntType overloaded constructor
+///\brief Creates a integer type using a predefined type
+///\param pred_type - IN: Predefined datatype
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
IntType::IntType( const PredType& pred_type ) : AtomType()
{
// use DataType::copy to make a copy of this predefined type
copy( pred_type );
}
-/* BMR - may not keep
-IntType& IntType::operator=( const PredType& rhs )
-{
- copy(rhs);
- return(*this);
-}
-*/
-
-// Creates a integer datatype using an existing id
+//--------------------------------------------------------------------------
+// Function: IntType overloaded constructor
+///\brief Creates an integer datatype using the id of an existing
+/// datatype.
+///\param existing_id - IN: Id of an existing datatype
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
IntType::IntType( const hid_t existing_id ) : AtomType( existing_id ) {}
-// Gets the integer datatype of the specified dataset - may reimplement -BMR
+//--------------------------------------------------------------------------
+// Function: IntType overloaded constructor
+///\brief Gets the integer datatype of the specified dataset.
+///\param dataset - IN: Dataset that this integer datatype associates with
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
IntType::IntType( const DataSet& dataset ) : AtomType()
{
// Calls C function H5Dget_type to get the id of the datatype
@@ -69,11 +89,18 @@ IntType::IntType( const DataSet& dataset ) : AtomType()
}
}
-// Retrieves the sign type for an integer type
+//--------------------------------------------------------------------------
+// Function: IntType::getSign
+///\brief Retrieves the sign type for an integer type.
+///\return Valid sign type
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
H5T_sign_t IntType::getSign() const
{
H5T_sign_t type_sign = H5Tget_sign( id ); // C routine
- // Returns a valid sign type if successful
+
+ // Returns a valid sign type if no errors
if( type_sign == H5T_SGN_ERROR )
{
throw DataTypeIException("IntType::getSign",
@@ -82,7 +109,13 @@ H5T_sign_t IntType::getSign() const
return( type_sign );
}
-// Sets the sign proprety for an integer type.
+//--------------------------------------------------------------------------
+// Function: IntType::getSign
+///\brief Sets the sign property for an integer type.
+///\param sign - IN: Sign type
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void IntType::setSign( H5T_sign_t sign ) const
{
// Call C routine to set the sign property
@@ -93,7 +126,11 @@ void IntType::setSign( H5T_sign_t sign ) const
}
}
-// This destructor terminates access to the datatype
+//--------------------------------------------------------------------------
+// Function: IntType destructor
+///\brief Noop destructor.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
IntType::~IntType() {}
#ifndef H5_NO_NAMESPACE
diff --git a/c++/src/H5Library.cpp b/c++/src/H5Library.cpp
index b0afb44..a449dc2 100644
--- a/c++/src/H5Library.cpp
+++ b/c++/src/H5Library.cpp
@@ -25,7 +25,12 @@ namespace H5 {
// This static variable will be set to true when dontAtExit is called
bool H5Library::need_cleanup = false;
-// Initializes the HDF5 library.
+//--------------------------------------------------------------------------
+// Function: H5Library::open
+///\brief Initializes the HDF5 library.
+///\exception H5::LibraryIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void H5Library::open()
{
herr_t ret_value = H5open();
@@ -35,7 +40,12 @@ void H5Library::open()
}
}
-// Flushes all data to disk, closes files, and cleans up memory.
+//--------------------------------------------------------------------------
+// Function: H5Library::close
+///\brief Flushes all data to disk, closes files, and cleans up memory.
+///\exception H5::LibraryIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void H5Library::close()
{
herr_t ret_value = H5close();
@@ -45,7 +55,12 @@ void H5Library::close()
}
}
-// Instructs library not to install atexit cleanup routine
+//--------------------------------------------------------------------------
+// Function: H5Library::dontAtExit
+///\brief Instructs library not to install atexit cleanup routine
+///\exception H5::LibraryIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void H5Library::dontAtExit()
{
herr_t ret_value = H5dont_atexit();
@@ -55,7 +70,15 @@ void H5Library::dontAtExit()
}
}
-// Returns the HDF library release number.
+//--------------------------------------------------------------------------
+// Function: H5Library::getLibVersion
+///\brief Returns the HDF library release number.
+///\param majnum - OUT: Major version of the library
+///\param minnum - OUT: Minor version of the library
+///\param relnum - OUT: Release number of the library
+///\exception H5::LibraryIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void H5Library::getLibVersion( unsigned& majnum, unsigned& minnum, unsigned& relnum )
{
herr_t ret_value = H5get_libversion( &majnum, &minnum, &relnum );
@@ -65,17 +88,84 @@ void H5Library::getLibVersion( unsigned& majnum, unsigned& minnum, unsigned& rel
}
}
-// Verifies that the arguments match the version numbers compiled
-// into the library
-void H5Library::checkVersion( unsigned majnum, unsigned minnum, unsigned relnum )
+//--------------------------------------------------------------------------
+// Function: H5Library::checkVersion
+///\brief Verifies that the arguments match the version numbers
+/// compiled into the library
+///\param majnum - OUT: Major version of the library
+///\param minnum - OUT: Minor version of the library
+///\param relnum - OUT: Release number of the library
+///\exception H5::LibraryIException
+///\par Description
+/// For information about library version, please refer to
+/// the C layer Reference Manual at:
+/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5.html#Library-VersCheck
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void H5Library::checkVersion(unsigned majnum, unsigned minnum, unsigned relnum)
{
- herr_t ret_value = H5check_version( majnum, minnum, relnum );
+ herr_t ret_value = H5check_version(majnum, minnum, relnum);
if( ret_value < 0 )
{
throw LibraryIException("H5Library::checkVersion", "H5check_version failed");
}
}
+//--------------------------------------------------------------------------
+// Function: H5Library::garbageCollect
+///\brief Walks through all the garbage collection routines for the
+/// library, which are supposed to free any unused memory they
+/// have allocated.
+///\exception H5::LibraryIException
+///\par Description
+/// It is not required that H5Library::garbageCollect be called
+/// at any particular time; it is only necessary in certain
+/// situations, such as when the application has performed actions
+/// that cause the library to allocate many objects. The
+/// application should call H5Library::garbageCollect if it
+/// eventually releases those objects and wants to reduce the
+/// memory used by the library from the peak usage required.
+///\par
+/// The library automatically garbage collects all the free
+/// lists when the application ends.
+// Programmer Binh-Minh Ribler - May, 2004
+//--------------------------------------------------------------------------
+void H5Library::garbageCollect()
+{
+ herr_t ret_value = H5garbage_collect();
+ if( ret_value < 0 )
+ {
+ throw LibraryIException("H5Library::garbageCollect", "H5garbage_collect failed");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Library::setFreeListLimits
+///\brief Sets limits on the different kinds of free lists.
+///\param reg_global_lim - IN: Limit on all "regular" free list memory used
+///\param reg_list_lim - IN: Limit on memory used in each "regular" free list
+///\param arr_global_lim - IN: Limit on all "array" free list memory used
+///\param arr_list_lim - IN: Limit on memory used in each "array" free list
+///\param blk_global_lim - IN: Limit on all "block" free list memory used
+///\param blk_list_lim - IN: Limit on memory used in each "block" free list
+///\exception H5::LibraryIException
+///\par Description
+/// Setting a value of -1 for a limit means no limit of that type.
+/// For more information on free list limits, please refer to C
+/// layer Reference Manual at:
+/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5.html#Library-SetFreeListLimits
+// Programmer Binh-Minh Ribler - May, 2004
+//--------------------------------------------------------------------------
+void H5Library::setFreeListLimits(int reg_global_lim, int reg_list_lim,
+ int arr_global_lim, int arr_list_lim, int blk_global_lim,
+ int blk_list_lim)
+{
+ herr_t ret_value = H5set_free_list_limits(reg_global_lim, reg_list_lim, arr_global_lim, arr_list_lim, blk_global_lim, blk_list_lim);
+ if( ret_value < 0 )
+ {
+ throw LibraryIException("H5Library::setFreeListLimits", "H5set_free_list_limits failed");
+ }
+}
#ifndef H5_NO_NAMESPACE
} // end namespace
#endif
diff --git a/c++/src/H5Library.h b/c++/src/H5Library.h
index 3e5b295..34b816b 100644
--- a/c++/src/H5Library.h
+++ b/c++/src/H5Library.h
@@ -46,6 +46,14 @@ class H5_DLLCPP H5Library {
// into the library
static void checkVersion( unsigned majnum, unsigned minnum, unsigned relnum );
+ // Walks through all the garbage collection routines for the library,
+ // which are supposed to free any unused memory they have allocated.
+ static void garbageCollect();
+
+ // Sets limits on the different kinds of free lists.
+ static void setFreeListLimits(int reg_global_lim, int reg_list_lim, int
+ arr_global_lim, int arr_list_lim, int blk_global_lim, int blk_list_lim);
+
private:
// Default constructor - no instance ever created
H5Library() {};
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp
index d4243eb..811ce75 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -45,17 +45,54 @@ extern "C" herr_t userAttrOpWrpr( hid_t loc_id, const char* attr_name, void* op_
return 0;
}
-// Default constructor - set id to 0 by default here but may be set
-// to a valid HDF5 id, if any, by a subclass constructor.
+//--------------------------------------------------------------------------
+// Function: H5Object default constructor (protected)
+// Description
+// The id is set to 0 here but subclass constructor will set
+// it to a valid HDF5 id.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
H5Object::H5Object() : IdComponent() {}
-// Constructs an object from an existing HDF5 id
+//--------------------------------------------------------------------------
+// Function: H5Object overloaded constructor (protected)
+// Purpose Creates an H5Object object using the id of an existing H5
+// object.
+// Parameters object_id - IN: Id of an existing H5 object
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
H5Object::H5Object( const hid_t object_id ) : IdComponent( object_id ) {}
-// Copy constructor: makes a copy of the original H5Object instance
+//--------------------------------------------------------------------------
+// Function: H5Object copy constructor
+///\brief Copy constructor: makes a copy of the original H5Object
+/// instance.
+///\param original - IN: H5Object instance to copy
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
H5Object::H5Object( const H5Object& original ) : IdComponent( original ) {}
-// Creates an attribute for a group, dataset, or named datatype.
+//--------------------------------------------------------------------------
+// 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();
@@ -75,13 +112,26 @@ Attribute H5Object::createAttribute( const char* name, const DataType& data_type
}
}
-// Creates an attribute for a group, dataset, or named datatype.
+//--------------------------------------------------------------------------
+// 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 std::string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
Attribute H5Object::createAttribute( const 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 ));
}
-// Opens an attribute given its name; name is given as char*
+//--------------------------------------------------------------------------
+// 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_name( id, name );
@@ -96,13 +146,26 @@ Attribute H5Object::openAttribute( const char* name ) const
}
}
-// Opens an attribute given its name; name is given as string
+//--------------------------------------------------------------------------
+// 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 std::string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
Attribute H5Object::openAttribute( const string& name ) const
{
return( openAttribute( name.c_str()) );
}
-// Opens an attribute given its index.
+//--------------------------------------------------------------------------
+// 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_idx( id, idx );
@@ -117,7 +180,22 @@ Attribute H5Object::openAttribute( const unsigned int idx ) const
}
}
-// Iterates a user's function over all the attributes of the dataset
+//--------------------------------------------------------------------------
+// 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
+/// For information, please refer to the C layer Reference Manual
+/// at:
+/// http://hdf.ncsa.uiuc.edu/HDF5/doc/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
@@ -140,7 +218,13 @@ int H5Object::iterateAttrs( attr_operator_t user_op, unsigned * idx, void *op_da
}
}
-// Determines the number of attributes attached to
+//--------------------------------------------------------------------------
+// Function: H5Object::getNumAttrs
+///\brief Returns the number of attributes attached to this H5 object.
+///\return Number of attributes
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
int H5Object::getNumAttrs() const
{
int num_attrs = H5Aget_num_attrs( id );
@@ -153,7 +237,13 @@ int H5Object::getNumAttrs() const
return( num_attrs );
}
-// Removes the named attribute from this object.
+//--------------------------------------------------------------------------
+// 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( id, name );
@@ -162,12 +252,31 @@ void H5Object::removeAttr( const char* name ) const
throw AttributeIException("H5Object::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 std::string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void H5Object::removeAttr( const string& name ) const
{
removeAttr( name.c_str() );
}
-// Flushes all buffers associated with a file to disk.
+//--------------------------------------------------------------------------
+// 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( id, scope );
@@ -177,9 +286,58 @@ void H5Object::flush(H5F_scope_t scope ) const
}
}
-// each subclass' destructor calls the template function resetIdComponent()
-// to reset the corresponding IdComponent object and close the HDF5 object
-// where appropriate.
+//--------------------------------------------------------------------------
+// Function: H5Object::Reference
+///\brief Creates a reference to an Hdf5 object or to a dataset region.
+///\param name - IN: Name of the object to be referenced
+///\param dataspace - IN: Dataspace with selection
+///\param ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION
+///\return A reference
+///\exception H5::ReferenceIException
+// Programmer Binh-Minh Ribler - May, 2004
+//--------------------------------------------------------------------------
+void* H5Object::Reference(const char* name, DataSpace& dataspace, H5R_type_t ref_type) const
+{
+ void *ref;
+ herr_t ret_value = H5Rcreate(ref, id, name, ref_type, dataspace.getId());
+ if (ret_value < 0)
+ {
+ throw AttributeIException("H5Object::Reference",
+ "H5Rcreate failed");
+ }
+ return(ref);
+}
+
+//--------------------------------------------------------------------------
+// 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 name - IN: Name of the object to be referenced
+///\return A reference
+///\exception H5::ReferenceIException
+///\par Description
+// This function passes H5R_OBJECT and -1 to the C API H5Rcreate
+// to create a reference to the named object. The next function
+// will create a reference to a dataset region.
+// Programmer Binh-Minh Ribler - May, 2004
+//--------------------------------------------------------------------------
+void* H5Object::Reference(const char* name) const
+{
+ void *ref;
+ herr_t ret_value = H5Rcreate(ref, id, name, H5R_OBJECT, -1);
+ if (ret_value < 0)
+ {
+ throw AttributeIException("H5Object::Reference",
+ "H5Rcreate failed");
+ }
+ return(ref);
+}
+//--------------------------------------------------------------------------
+// Function: H5Object destructor
+///\brief Noop destructor.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
H5Object::~H5Object() {}
#ifndef H5_NO_NAMESPACE
diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h
index cc8b891..b6577a2 100644
--- a/c++/src/H5Object.h
+++ b/c++/src/H5Object.h
@@ -46,31 +46,20 @@ class UserData4Aiterate { // user data for attribute iteration
class H5_DLLCPP H5Object : public IdComponent {
public:
- // Pure virtual function so appropriate close function can
- // be called by subclasses' for the corresponding HDF5 object
- //virtual void p_close() const = 0;
-
// Copy constructor: makes copy of an H5Object object.
H5Object( const H5Object& original );
// Flushes all buffers associated with this object to disk
void flush( H5F_scope_t scope ) const;
- // Assignment operator
- //H5Object& operator=( const H5Object& rhs );
-
- // Sets and gets H5Object's data member
- //void setId( hid_t new_id );
- //hid_t getId () const;
-
// 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 string& name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT ) const;
// Opens an attribute given its name.
- Attribute openAttribute( const string& name ) const;
Attribute openAttribute( const char* name ) const;
+ Attribute openAttribute( const string& name ) const;
// Opens an attribute given its index.
Attribute openAttribute( const unsigned int idx ) const;
@@ -82,9 +71,14 @@ class H5_DLLCPP H5Object : public IdComponent {
int getNumAttrs() const;
// Removes the named attribute from this object.
- void removeAttr( const string& name ) const;
void removeAttr( const char* name ) const;
+ void removeAttr( const string& name ) const;
+
+ // Creates a reference to a named Hdf5 object in this object.
+ void* Reference(const char* name) const;
+ // Creates a reference to a dataset region in this object.
+ void* Reference(const char* name, DataSpace& dataspace, H5R_type_t ref_type = H5R_DATASET_REGION) const;
virtual ~H5Object();
protected:
diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp
index 5fab4a9..cba7a58 100644
--- a/c++/src/H5PredType.cpp
+++ b/c++/src/H5PredType.cpp
@@ -29,20 +29,47 @@
namespace H5 {
#endif
-// Default constructor
+//--------------------------------------------------------------------------
+// Function: PredType default constructor
+///\brief Default constructor: Creates a stub predefined datatype
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
PredType::PredType() : AtomType() {}
-// creates predefined datatype, so set DataType::is_predtype to true by default
+//--------------------------------------------------------------------------
+// Function: PredType overloaded constructor
+///\brief Creates a PredType object using the id of an existing
+/// predefined datatype.
+///\param predtype_id - IN: Id of a predefined datatype
+// Description
+// This constructor creates a predefined datatype, so it sets
+// DataType::is_predtype to true.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
PredType::PredType( const hid_t predtype_id ) : AtomType( predtype_id )
{
is_predtype = true;
}
-// Copy constructor: makes a copy of this PredType object.
+//--------------------------------------------------------------------------
+// Function: PredType copy constructor
+///\brief Copy constructor: makes a copy of the original PredType object.
+///\param original - IN: PredType instance to copy
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
PredType::PredType( const PredType& original ) : AtomType( original ) {}
-// Makes a copy of the predefined type and stores the new
-// id in the left hand side object.
+//--------------------------------------------------------------------------
+// Function: PredType::operator=
+///\brief Assignment operator.
+///\param rhs - IN: Reference to the predefined datatype
+///\return Reference to PredType instance
+///\exception H5::DataTypeIException
+// Description
+// Makes a copy of the type on the right hand side and stores
+// the new id in the left hand side object.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
PredType& PredType::operator=( const PredType& rhs )
{
copy(rhs);
@@ -197,6 +224,12 @@ const PredType PredType::NATIVE_UINT_LEAST64( E_NATIVE_UINT_LEAST64 );
const PredType PredType::NATIVE_INT_FAST64( E_NATIVE_INT_FAST64 );
const PredType PredType::NATIVE_UINT_FAST64( E_NATIVE_UINT_FAST64 );
+//--------------------------------------------------------------------------
+// Function: PredType::getId
+///\brief Returns the HDF5 predefined type id.
+///\return HDF5 predefined type id or INVALID
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
hid_t PredType::getId() const
{
switch( id ) {
diff --git a/c++/src/H5StrType.cpp b/c++/src/H5StrType.cpp
index 683fc0b..1961365 100644
--- a/c++/src/H5StrType.cpp
+++ b/c++/src/H5StrType.cpp
@@ -33,19 +33,45 @@
namespace H5 {
#endif
-// Default constructor
+//--------------------------------------------------------------------------
+// Function: StrType default constructor
+///\brief Default constructor: Creates a stub string datatype
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
StrType::StrType() : AtomType() {}
-// Creates a string type using a predefined type
+//--------------------------------------------------------------------------
+// Function: StrType overloaded constructor
+///\brief Creates a string datatype using a predefined type.
+///\param pred_type - IN: Predefined datatype
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
StrType::StrType( const PredType& pred_type ) : AtomType()
{
// use DataType::copy to make a copy of this predefined type
copy( pred_type );
}
-// Creates a string type with a specified length - 1st argument could
-// have been skipped, but this constructor will collide with the one
-// that takes an existing id below
+//--------------------------------------------------------------------------
+// Function: StrType overloaded constructor
+///\brief Creates a string datatype with a specified length
+///\param existing_id - IN: Id of an existing datatype
+///\exception H5::DataTypeIException
+// Description
+// The 1st argument could have been skipped, but this
+// constructor will collide with the one that takes an
+// existing id.
+//
+// Update: by passing 'size' by reference will avoid the
+// clashing problem, so the 1st argument can actually be
+// omitted. This constructor should be replaced by the
+// other after announcing. - May, 2004
+///\note
+/// This constructor will be obsolete in later releases,
+/// please use StrType( const size_t& size ) instead.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
StrType::StrType( const PredType& pred_type, const size_t size ) : AtomType()
{
// use DataType::copy to make a copy of the string predefined type
@@ -53,14 +79,37 @@ StrType::StrType( const PredType& pred_type, const size_t size ) : AtomType()
copy(pred_type);
setSize(size);
}
+StrType::StrType( const size_t& size ) : AtomType()
+{
+ // use DataType::copy to make a copy of the string predefined type
+ // then set its length
+ copy(H5T_C_S1);
+ setSize(size);
+}
-// Creates a string datatype using an existing id
+//--------------------------------------------------------------------------
+// Function: StrType overloaded constructor
+///\brief Creates an StrType object using the id of an existing datatype.
+///\param existing_id - IN: Id of an existing datatype
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
StrType::StrType( const hid_t existing_id ) : AtomType( existing_id ) {}
-// Copy constructor: makes copy of the original StrType object
+//--------------------------------------------------------------------------
+// Function: StrType copy constructor
+///\brief Copy constructor: makes a copy of the original StrType object.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
StrType::StrType( const StrType& original ) : AtomType ( original ) {}
-// Gets the string datatype of the specified dataset - will reimplement - BMR
+//--------------------------------------------------------------------------
+// Function: EnumType overloaded constructor
+///\brief Gets the string datatype of the specified dataset
+///\param dataset - IN: Dataset that this string datatype associates with
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
StrType::StrType( const DataSet& dataset ) : AtomType ()
{
// Calls C function H5Dget_type to get the id of the datatype
@@ -72,7 +121,14 @@ StrType::StrType( const DataSet& dataset ) : AtomType ()
}
}
-// Retrieves the character set type of a string datatype.
+//--------------------------------------------------------------------------
+// Function: StrType::getCset
+///\brief Retrieves the character set type of this string datatype.
+///\return Character set type, which can be:
+/// \li \c H5T_CSET_ASCII (0) - Character set is US ASCII.
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
H5T_cset_t StrType::getCset() const
{
H5T_cset_t cset = H5Tget_cset( id );
@@ -85,7 +141,14 @@ H5T_cset_t StrType::getCset() const
return( cset );
}
-// Sets character set to be used.
+//--------------------------------------------------------------------------
+// Function: StrType::setCset
+///\brief Sets character set to be used.
+///\param cset - IN: character set type
+///\exception H5::DataTypeIException
+/// \li \c H5T_CSET_ASCII (0) - Character set is US ASCII.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void StrType::setCset( H5T_cset_t cset ) const
{
herr_t ret_value = H5Tset_cset( id, cset );
@@ -96,7 +159,16 @@ void StrType::setCset( H5T_cset_t cset ) const
}
}
-// Retrieves the string padding method for a string datatype.
+//--------------------------------------------------------------------------
+// Function: StrType::getCset
+///\brief Retrieves the storage mechanism for of this string datatype.
+///\return String storage mechanism, which can be:
+/// \li \c H5T_STR_NULLTERM (0) - Null terminate (as C does)
+/// \li \c H5T_STR_NULLPAD (0) - Pad with zeros
+/// \li \c H5T_STR_SPACEPAD (0) - pad with spaces (as FORTRAN does)
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
H5T_str_t StrType::getStrpad() const
{
H5T_str_t strpad = H5Tget_strpad( id );
@@ -110,7 +182,16 @@ H5T_str_t StrType::getStrpad() const
return( strpad );
}
-// Defines the storage mechanism for character strings.
+//--------------------------------------------------------------------------
+// Function: StrType::setStrpad
+///\brief Defines the storage mechanism for this string datatype.
+///\param strpad - IN: String padding type
+///\exception H5::DataTypeIException
+///\par Description
+/// For detail, please refer to the C layer Reference Manual at:
+/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5T.html#Datatype-SetStrpad
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
void StrType::setStrpad( H5T_str_t strpad ) const
{
herr_t ret_value = H5Tset_strpad( id, strpad );
@@ -121,7 +202,11 @@ void StrType::setStrpad( H5T_str_t strpad ) const
}
}
-// This destructor terminates access to the datatype
+//--------------------------------------------------------------------------
+// Function: StrType destructor
+///\brief Properly terminates access to this string datatype.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
StrType::~StrType() {}
#ifndef H5_NO_NAMESPACE
diff --git a/c++/src/H5StrType.h b/c++/src/H5StrType.h
index 8d6070c..6ee6025 100644
--- a/c++/src/H5StrType.h
+++ b/c++/src/H5StrType.h
@@ -29,6 +29,9 @@ class H5_DLLCPP StrType : public AtomType {
StrType( const PredType& pred_type );
// Creates a string type with specified length
+ StrType( const size_t& size );
+
+ // Creates a string type with specified length - will be obsolete
StrType( const PredType& pred_type, const size_t size );
// Creates a string datatype using an existing id