diff options
Diffstat (limited to 'c++/src')
-rw-r--r-- | c++/src/H5FloatType.cpp | 148 | ||||
-rw-r--r-- | c++/src/H5IntType.cpp | 72 | ||||
-rw-r--r-- | c++/src/H5IntType.h | 4 |
3 files changed, 189 insertions, 35 deletions
diff --git a/c++/src/H5FloatType.cpp b/c++/src/H5FloatType.cpp index 6d3525d..1bb2ed9 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 Properly terminates access to this file. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- FloatType::~FloatType() {} #ifndef H5_NO_NAMESPACE diff --git a/c++/src/H5IntType.cpp b/c++/src/H5IntType.cpp index ff9f9e3..dc27904 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,19 @@ 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. +///\param dataset - IN: Dataset that this integer datatype associates with +///\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 +110,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 +127,11 @@ void IntType::setSign( H5T_sign_t sign ) const } } -// This destructor terminates access to the datatype +//-------------------------------------------------------------------------- +// Function: IntType destructor +///\brief Properly terminates access to this integer datatype. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- IntType::~IntType() {} #ifndef H5_NO_NAMESPACE diff --git a/c++/src/H5IntType.h b/c++/src/H5IntType.h index 5d8b1f9..0cff95f 100644 --- a/c++/src/H5IntType.h +++ b/c++/src/H5IntType.h @@ -37,10 +37,6 @@ class H5_DLLCPP IntType : public AtomType { // Gets the integer datatype of the specified dataset IntType( const DataSet& dataset ); - // Assignment operator that takes a predefined type - // may not use - BMR - // virtual IntType& operator=( const PredType& rhs ); - // Retrieves the sign type for an integer type H5T_sign_t getSign() const; |