diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2000-12-07 00:04:08 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2000-12-07 00:04:08 (GMT) |
commit | f148ff3caf533e9f6029798617f0a8087bcd6c05 (patch) | |
tree | 00bb6ca4d0e50aa0e591eed6a0d739c04c93c5e7 /c++/src/H5IntType.cpp | |
parent | 7df8cd5cfe22372f603ea058334647fe4017008e (diff) | |
download | hdf5-f148ff3caf533e9f6029798617f0a8087bcd6c05.zip hdf5-f148ff3caf533e9f6029798617f0a8087bcd6c05.tar.gz hdf5-f148ff3caf533e9f6029798617f0a8087bcd6c05.tar.bz2 |
[svn-r3080]
Purpose:
Support portability
Description:
I forgot that source file extension .C will not work on Windows.
Solution:
Changed all source file from *.C to *.cpp for portability.
Platforms tested:
arabica (sparc-sun-solaris 2.7)
Diffstat (limited to 'c++/src/H5IntType.cpp')
-rw-r--r-- | c++/src/H5IntType.cpp | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/c++/src/H5IntType.cpp b/c++/src/H5IntType.cpp new file mode 100644 index 0000000..bc1e1bc --- /dev/null +++ b/c++/src/H5IntType.cpp @@ -0,0 +1,78 @@ +#include <string> + +#include "H5Include.h" +#include "H5RefCounter.h" +#include "H5Exception.h" +#include "H5IdComponent.h" +#include "H5PropList.h" +#include "H5Object.h" +#include "H5DataType.h" +#include "H5AbstractDs.h" +#include "H5DxferProp.h" +#include "H5DataSpace.h" +#include "H5AtomType.h" +#include "H5IntType.h" +#include "H5DataSet.h" +#include "H5PredType.h" + +#ifndef H5_NO_NAMESPACE +namespace H5 { +#endif + +// Default constructor +IntType::IntType() {} + +// Copy constructor: makes copy of the original IntType object +IntType::IntType( const IntType& original ) : AtomType( original ) {} + +// Creates a integer type using a predefined type +IntType::IntType( const PredType& pred_type ) : AtomType() +{ + // use DataType::copy to make a copy of this predefined type + copy( pred_type ); +} + +// Creates a integer datatype using an existing id +IntType::IntType( const hid_t existing_id ) : AtomType( existing_id ) {} + +// Gets the integer datatype of the specified dataset - will reimplement +IntType::IntType( const DataSet& dataset ) : AtomType() +{ + // Calls C function H5Dget_type to get the id of the datatype + id = H5Dget_type( dataset.getId() ); + + if( id <= 0 ) + { + throw DataSetIException(); + } +} + +// Retrieves the sign type for an integer type +H5T_sign_t IntType::getSign() const +{ + H5T_sign_t type_sign = H5Tget_sign( id ); // C routine + // Returns a valid sign type if successful + if( type_sign == H5T_SGN_ERROR ) + { + throw DataTypeIException(); + } + return( type_sign ); +} + +// Sets the sign proprety for an integer type. +void IntType::setSign( H5T_sign_t sign ) const +{ + // Call C routine to set the sign property + herr_t ret_value = H5Tset_sign( id, sign ); + if( ret_value < 0 ) + { + throw DataTypeIException(); + } +} + +// This destructor terminates access to the datatype +IntType::~IntType() {} + +#ifndef H5_NO_NAMESPACE +} // end namespace +#endif |