diff options
-rw-r--r-- | c++/src/H5DataSpace.cpp | 8 | ||||
-rw-r--r-- | c++/src/H5DataSpace.h | 37 | ||||
-rw-r--r-- | c++/src/H5DataType.cpp | 16 | ||||
-rw-r--r-- | c++/src/H5DataType.h | 16 | ||||
-rw-r--r-- | c++/src/H5Exception.cpp | 3 | ||||
-rw-r--r-- | c++/src/H5IdComponent.h | 8 | ||||
-rw-r--r-- | c++/src/H5Include.h | 6 | ||||
-rw-r--r-- | c++/src/H5IntType.cpp | 10 | ||||
-rw-r--r-- | c++/src/H5IntType.h | 4 | ||||
-rw-r--r-- | c++/src/H5PredType.cpp | 551 | ||||
-rw-r--r-- | c++/src/H5PredType.h | 52 | ||||
-rw-r--r-- | c++/src/H5PropList.cpp | 8 | ||||
-rw-r--r-- | c++/src/H5PropList.h | 6 |
13 files changed, 552 insertions, 173 deletions
diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp index dc4ed9a..4e9533f 100644 --- a/c++/src/H5DataSpace.cpp +++ b/c++/src/H5DataSpace.cpp @@ -68,6 +68,14 @@ void DataSpace::copy( const DataSpace& like_space ) } } +// Makes a copy of the dataspace on the right hand side and stores +// the new id in the left hand side object. +DataSpace& DataSpace::operator=( const DataSpace& rhs ) +{ + copy(rhs); + return(*this); +} + // Determines whether this dataspace is a simple dataspace. bool DataSpace::isSimple () const { diff --git a/c++/src/H5DataSpace.h b/c++/src/H5DataSpace.h index 8c3471f..67f4537 100644 --- a/c++/src/H5DataSpace.h +++ b/c++/src/H5DataSpace.h @@ -20,64 +20,67 @@ class DataSpace : public IdComponent { // Makes copy of an existing dataspace. void copy( const DataSpace& like_space ); // H5Scopy + // Assignment operator + virtual DataSpace& operator=( const DataSpace& rhs ); + // Determines if this dataspace is a simple one. - bool isSimple () const; + bool isSimple() const; // Sets the offset of this simple dataspace. - void offsetSimple ( const hssize_t* offset ) const; + void offsetSimple( const hssize_t* offset ) const; // Retrieves dataspace dimension size and maximum size. - int getSimpleExtentDims ( hsize_t *dims, hsize_t *maxdims = NULL ) const; + int getSimpleExtentDims( hsize_t *dims, hsize_t *maxdims = NULL ) const; // Gets the dimensionality of this dataspace. - int getSimpleExtentNdims () const; + int getSimpleExtentNdims() const; // Gets the number of elements in this dataspace. // 12/05/00 - changed return type to hssize_t from hsize_t - C API - hssize_t getSimpleExtentNpoints () const; + hssize_t getSimpleExtentNpoints() const; // Gets the current class of this dataspace. - H5S_class_t getSimpleExtentType () const; + H5S_class_t getSimpleExtentType() const; // Copies the extent of this dataspace. - void extentCopy ( DataSpace& dest_space ) const; + void extentCopy( DataSpace& dest_space ) const; // Sets or resets the size of this dataspace. void setExtentSimple( int rank, const hsize_t *current_size, const hsize_t *maximum_size = NULL ) const; // Removes the extent from this dataspace. - void setExtentNone () const; + void setExtentNone() const; // Gets the number of elements in this dataspace selection. - hssize_t getSelectNpoints () const; + hssize_t getSelectNpoints() const; // Get number of hyperslab blocks. - hssize_t getSelectHyperNblocks () const; + hssize_t getSelectHyperNblocks() const; // Gets the list of hyperslab blocks currently selected. void getSelectHyperBlocklist( hsize_t startblock, hsize_t numblocks, hsize_t *buf ) const; // Gets the number of element points in the current selection. - hssize_t getSelectElemNpoints () const; + hssize_t getSelectElemNpoints() const; // Retrieves the list of element points currently selected. - void getSelectElemPointlist ( hsize_t startpoint, hsize_t numpoints, hsize_t *buf ) const; + void getSelectElemPointlist( hsize_t startpoint, hsize_t numpoints, hsize_t *buf ) const; // Gets the bounding box containing the current selection. - void getSelectBounds ( hsize_t* start, hsize_t* end ) const; + void getSelectBounds( hsize_t* start, hsize_t* end ) const; // Selects array elements to be included in the selection for // this dataspace. - void selectElements ( H5S_seloper_t op, const size_t num_elements, const hssize_t *coord[ ] ) const; + void selectElements( H5S_seloper_t op, const size_t num_elements, const hssize_t *coord[ ] ) const; // Selects the entire dataspace. - void selectAll () const; + void selectAll() const; // Resets the selection region to include no elements. - void selectNone () const; + void selectNone() const; // Verifies that the selection is within the extent of the dataspace. - bool selectValid () const; + bool selectValid() const; // Selects a hyperslab region to add to the current selected region. void selectHyperslab( H5S_seloper_t op, const hsize_t *count, const hssize_t *start, const hsize_t *stride = NULL, const hsize_t *block = NULL ) const; diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index e8c00eb..a7de20b 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -68,6 +68,22 @@ void DataType::copy( const DataType& like_type ) } } +// Makes a copy of the type on the right hand side and stores the new +// id in the left hand side object. +DataType& DataType::operator=( const DataType& rhs ) +{ + copy(rhs); + return(*this); +} + +// Makes a copy of the predefined type and stores the new +// id in the left hand side object. +DataType& DataType::operator=( const PredType& rhs ) +{ + copy(rhs); + return(*this); +} + // Determines whether two datatypes refer to the same actual datatype. bool DataType::operator==(const DataType& compared_type ) const { diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index a71e1ba..ebe7ded 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -14,10 +14,6 @@ class DataType : public H5Object { // Copy constructor: makes a copy of the original object DataType( const DataType& original ); - // Creates a new variable-length datatype - not implemented yet - // Will be moved into a subclass when completed - //DataType vlenCreate( const DataType& base_type ); - // Copies an existing datatype to this datatype object void copy( const DataType& like_type ); @@ -46,7 +42,13 @@ class DataType : public H5Object { // Returns a pointer to the current global overflow function. H5T_overflow_t getOverflow(void) const; - // Determines whether two datatypes are the same. ??? + // Assignment operator that takes a predefined type + virtual DataType& operator=( const PredType& rhs ); + + // Assignment operator + virtual DataType& operator=( const DataType& rhs ); + + // Determines whether two datatypes are the same. bool operator==(const DataType& compared_type ) const; // Locks a datatype. @@ -74,6 +76,10 @@ class DataType : public H5Object { // Gets the tag associated with an opaque datatype. string getTag() const; + // Creates a new variable-length datatype - not implemented yet + // Will be moved into a subclass when completed + //DataType vlenCreate( const DataType& base_type ); + // Used by the API to appropriately close a datatype void p_close() const; diff --git a/c++/src/H5Exception.cpp b/c++/src/H5Exception.cpp index 3eeb2b8..86b399f 100644 --- a/c++/src/H5Exception.cpp +++ b/c++/src/H5Exception.cpp @@ -35,7 +35,8 @@ Exception::Exception(const string& func_name, const string& message) : detailMes Exception::Exception(const char* func_name, const char* message) { detailMessage = string(message); - funcName = string(func_name); + if (func_name != NULL) + funcName = string(func_name); } // copy constructor diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h index 66deeb5..31e9acd 100644 --- a/c++/src/H5IdComponent.h +++ b/c++/src/H5IdComponent.h @@ -26,7 +26,7 @@ class IdComponent { IdComponent( const IdComponent& original ); // Gets the value of IdComponent's data member - hid_t getId () const; + virtual hid_t getId () const; // Increment reference counter void incRefCount(); @@ -41,6 +41,9 @@ class IdComponent { // reference to this object bool noReference(); + // Assignment operator + virtual IdComponent& operator=( const IdComponent& rhs ); + // Resets this IdComponent instance //template <class Type> //void reset( Type* parent ); @@ -55,9 +58,6 @@ class IdComponent { RefCounter* ref_count; // used to keep track of the // number of copies of an object - // Assignment operator - IdComponent& operator=( const IdComponent& rhs ); - // Default constructor IdComponent(); diff --git a/c++/src/H5Include.h b/c++/src/H5Include.h index 20bfa64..b64511a 100644 --- a/c++/src/H5Include.h +++ b/c++/src/H5Include.h @@ -1,8 +1,8 @@ // C++ informative line for the emacs editor: -*- C++ -*- // Added this line for CC to compile at this time. Will remove it when // the problem of "Multiple declaration for RcsId" is fixed. BMR - 10/30/00 -#ifdef RCSID -#undef RCSID -#endif + +// This problem is removed. I could replace all #include "H5Include.h" +// by #include <hdf5.h>, but decide not to. BMR - 3/22/01 #include <hdf5.h> diff --git a/c++/src/H5IntType.cpp b/c++/src/H5IntType.cpp index c97daeb..6b48d7b 100644 --- a/c++/src/H5IntType.cpp +++ b/c++/src/H5IntType.cpp @@ -32,10 +32,18 @@ IntType::IntType( const PredType& pred_type ) : AtomType() 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 IntType::IntType( const hid_t existing_id ) : AtomType( existing_id ) {} -// Gets the integer datatype of the specified dataset - will reimplement -BMR +// Gets the integer datatype of the specified dataset - may reimplement -BMR IntType::IntType( const DataSet& dataset ) : AtomType() { // Calls C function H5Dget_type to get the id of the datatype diff --git a/c++/src/H5IntType.h b/c++/src/H5IntType.h index fb9889d..76ef6a9 100644 --- a/c++/src/H5IntType.h +++ b/c++/src/H5IntType.h @@ -23,6 +23,10 @@ class 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; diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp index 3f32f4b..0d0ddcb 100644 --- a/c++/src/H5PredType.cpp +++ b/c++/src/H5PredType.cpp @@ -30,142 +30,421 @@ PredType::PredType( const PredType& original ) : AtomType( original ) {} const PredType PredType::NotAtexit; // only for atexit/global dest. problem // Definition of pre-defined types -const PredType PredType::C_S1( H5T_C_S1 ); -const PredType PredType::FORTRAN_S1( H5T_FORTRAN_S1 ); - -const PredType PredType::STD_I8BE( H5T_STD_I8BE ); -const PredType PredType::STD_I8LE( H5T_STD_I8LE ); -const PredType PredType::STD_I16BE( H5T_STD_I16BE ); -const PredType PredType::STD_I16LE( H5T_STD_I16LE ); -const PredType PredType::STD_I32BE( H5T_STD_I32BE ); -const PredType PredType::STD_I32LE( H5T_STD_I32LE ); -const PredType PredType::STD_I64BE( H5T_STD_I64BE ); -const PredType PredType::STD_I64LE( H5T_STD_I64LE ); -const PredType PredType::STD_U8BE( H5T_STD_U8BE ); -const PredType PredType::STD_U8LE( H5T_STD_U8LE ); -const PredType PredType::STD_U16BE( H5T_STD_U16BE ); -const PredType PredType::STD_U16LE( H5T_STD_U16LE ); -const PredType PredType::STD_U32BE( H5T_STD_U32BE ); -const PredType PredType::STD_U32LE( H5T_STD_U32LE ); -const PredType PredType::STD_U64BE( H5T_STD_U64BE ); -const PredType PredType::STD_U64LE( H5T_STD_U64LE ); -const PredType PredType::STD_B8BE( H5T_STD_B8BE ); -const PredType PredType::STD_B8LE( H5T_STD_B8LE ); -const PredType PredType::STD_B16BE( H5T_STD_B16BE ); -const PredType PredType::STD_B16LE( H5T_STD_B16LE ); -const PredType PredType::STD_B32BE( H5T_STD_B32BE ); -const PredType PredType::STD_B32LE( H5T_STD_B32LE ); -const PredType PredType::STD_B64BE( H5T_STD_B64BE ); -const PredType PredType::STD_B64LE( H5T_STD_B64LE ); -const PredType PredType::STD_REF_OBJ( H5T_STD_REF_OBJ ); -const PredType PredType::STD_REF_DSETREG( H5T_STD_REF_DSETREG ); - -const PredType PredType::IEEE_F32BE( H5T_IEEE_F32BE ); -const PredType PredType::IEEE_F32LE( H5T_IEEE_F32LE ); -const PredType PredType::IEEE_F64BE( H5T_IEEE_F64BE ); -const PredType PredType::IEEE_F64LE( H5T_IEEE_F64LE ); - -const PredType PredType::UNIX_D32BE( H5T_UNIX_D32BE ); -const PredType PredType::UNIX_D32LE( H5T_UNIX_D32LE ); -const PredType PredType::UNIX_D64BE( H5T_UNIX_D64BE ); -const PredType PredType::UNIX_D64LE( H5T_UNIX_D64LE ); - -const PredType PredType::INTEL_I8( H5T_INTEL_I8 ); -const PredType PredType::INTEL_I16( H5T_INTEL_I16 ); -const PredType PredType::INTEL_I32( H5T_INTEL_I32 ); -const PredType PredType::INTEL_I64( H5T_INTEL_I64 ); -const PredType PredType::INTEL_U8( H5T_INTEL_U8 ); -const PredType PredType::INTEL_U16( H5T_INTEL_U16 ); -const PredType PredType::INTEL_U32( H5T_INTEL_U32 ); -const PredType PredType::INTEL_U64( H5T_INTEL_U64 ); -const PredType PredType::INTEL_B8( H5T_INTEL_B8 ); -const PredType PredType::INTEL_B16( H5T_INTEL_B16 ); -const PredType PredType::INTEL_B32( H5T_INTEL_B32 ); -const PredType PredType::INTEL_B64( H5T_INTEL_B64 ); -const PredType PredType::INTEL_F32( H5T_INTEL_F32 ); -const PredType PredType::INTEL_F64( H5T_INTEL_F64 ); - -const PredType PredType::ALPHA_I8( H5T_ALPHA_I8 ); -const PredType PredType::ALPHA_I16( H5T_ALPHA_I16 ); -const PredType PredType::ALPHA_I32( H5T_ALPHA_I32 ); -const PredType PredType::ALPHA_I64( H5T_ALPHA_I64 ); -const PredType PredType::ALPHA_U8( H5T_ALPHA_U8 ); -const PredType PredType::ALPHA_U16( H5T_ALPHA_U16 ); -const PredType PredType::ALPHA_U32( H5T_ALPHA_U32 ); -const PredType PredType::ALPHA_U64( H5T_ALPHA_U64 ); -const PredType PredType::ALPHA_B8( H5T_ALPHA_B8 ); -const PredType PredType::ALPHA_B16( H5T_ALPHA_B16 ); -const PredType PredType::ALPHA_B32( H5T_ALPHA_B32 ); -const PredType PredType::ALPHA_B64( H5T_ALPHA_B64 ); -const PredType PredType::ALPHA_F32( H5T_ALPHA_F32 ); -const PredType PredType::ALPHA_F64( H5T_ALPHA_F64 ); - -const PredType PredType::MIPS_I8( H5T_MIPS_I8 ); -const PredType PredType::MIPS_I16( H5T_MIPS_I16 ); -const PredType PredType::MIPS_I32( H5T_MIPS_I32 ); -const PredType PredType::MIPS_I64( H5T_MIPS_I64 ); -const PredType PredType::MIPS_U8( H5T_MIPS_U8 ); -const PredType PredType::MIPS_U16( H5T_MIPS_U16 ); -const PredType PredType::MIPS_U32( H5T_MIPS_U32 ); -const PredType PredType::MIPS_U64( H5T_MIPS_U64 ); -const PredType PredType::MIPS_B8( H5T_MIPS_B8 ); -const PredType PredType::MIPS_B16( H5T_MIPS_B16 ); -const PredType PredType::MIPS_B32( H5T_MIPS_B32 ); -const PredType PredType::MIPS_B64( H5T_MIPS_B64 ); -const PredType PredType::MIPS_F32( H5T_MIPS_F32 ); -const PredType PredType::MIPS_F64( H5T_MIPS_F64 ); - -const PredType PredType::NATIVE_CHAR( H5T_NATIVE_CHAR ); -const PredType PredType::NATIVE_INT( H5T_NATIVE_INT ); -const PredType PredType::NATIVE_FLOAT( H5T_NATIVE_FLOAT ); -const PredType PredType::NATIVE_SCHAR( H5T_NATIVE_SCHAR ); -const PredType PredType::NATIVE_UCHAR( H5T_NATIVE_UCHAR ); -const PredType PredType::NATIVE_SHORT( H5T_NATIVE_SHORT ); -const PredType PredType::NATIVE_USHORT( H5T_NATIVE_USHORT ); -const PredType PredType::NATIVE_UINT( H5T_NATIVE_UINT ); -const PredType PredType::NATIVE_LONG( H5T_NATIVE_LONG ); -const PredType PredType::NATIVE_ULONG( H5T_NATIVE_ULONG ); -const PredType PredType::NATIVE_LLONG( H5T_NATIVE_LLONG ); -const PredType PredType::NATIVE_ULLONG( H5T_NATIVE_ULLONG ); -const PredType PredType::NATIVE_DOUBLE( H5T_NATIVE_DOUBLE ); -const PredType PredType::NATIVE_LDOUBLE( H5T_NATIVE_LDOUBLE ); -const PredType PredType::NATIVE_B8( H5T_NATIVE_B8 ); -const PredType PredType::NATIVE_B16( H5T_NATIVE_B16 ); -const PredType PredType::NATIVE_B32( H5T_NATIVE_B32 ); -const PredType PredType::NATIVE_B64( H5T_NATIVE_B64 ); -const PredType PredType::NATIVE_OPAQUE( H5T_NATIVE_OPAQUE ); -const PredType PredType::NATIVE_HSIZE( H5T_NATIVE_HSIZE ); -const PredType PredType::NATIVE_HSSIZE( H5T_NATIVE_HSSIZE ); -const PredType PredType::NATIVE_HERR( H5T_NATIVE_HERR ); -const PredType PredType::NATIVE_HBOOL( H5T_NATIVE_HBOOL ); - -const PredType PredType::NATIVE_INT8( H5T_NATIVE_INT8 ); -const PredType PredType::NATIVE_UINT8( H5T_NATIVE_UINT8 ); -const PredType PredType::NATIVE_INT_LEAST8( H5T_NATIVE_INT_LEAST8 ); -const PredType PredType::NATIVE_UINT_LEAST8( H5T_NATIVE_UINT_LEAST8 ); -const PredType PredType::NATIVE_INT_FAST8( H5T_NATIVE_INT_FAST8 ); -const PredType PredType::NATIVE_UINT_FAST8( H5T_NATIVE_UINT_FAST8 ); - -const PredType PredType::NATIVE_INT16( H5T_NATIVE_INT16 ); -const PredType PredType::NATIVE_UINT16( H5T_NATIVE_UINT16 ); -const PredType PredType::NATIVE_INT_LEAST16( H5T_NATIVE_INT_LEAST16 ); -const PredType PredType::NATIVE_UINT_LEAST16( H5T_NATIVE_UINT_LEAST16 ); -const PredType PredType::NATIVE_INT_FAST16( H5T_NATIVE_INT_FAST16 ); -const PredType PredType::NATIVE_UINT_FAST16( H5T_NATIVE_UINT_FAST16 ); - -const PredType PredType::NATIVE_INT32( H5T_NATIVE_INT32 ); -const PredType PredType::NATIVE_UINT32( H5T_NATIVE_UINT32 ); -const PredType PredType::NATIVE_INT_LEAST32( H5T_NATIVE_INT_LEAST32 ); -const PredType PredType::NATIVE_UINT_LEAST32( H5T_NATIVE_UINT_LEAST32 ); -const PredType PredType::NATIVE_INT_FAST32( H5T_NATIVE_INT_FAST32 ); -const PredType PredType::NATIVE_UINT_FAST32( H5T_NATIVE_UINT_FAST32 ); - -const PredType PredType::NATIVE_INT64( H5T_NATIVE_INT64 ); -const PredType PredType::NATIVE_UINT64( H5T_NATIVE_UINT64 ); -const PredType PredType::NATIVE_INT_LEAST64( H5T_NATIVE_INT_LEAST64 ); -const PredType PredType::NATIVE_UINT_LEAST64( H5T_NATIVE_UINT_LEAST64 ); -const PredType PredType::NATIVE_INT_FAST64( H5T_NATIVE_INT_FAST64 ); -const PredType PredType::NATIVE_UINT_FAST64( H5T_NATIVE_UINT_FAST64 ); +// Note: the parameter E_xxxx_yyyy is the enum value that represents +// the corresponding HDF5 predefined type H5T_xxxx_yyyy. This enum value +// is stored in PredType::id since it is a PredType object id, in a way. +// In addition, this storage makes things safely simpler. When a PredType +// object is used, the virtual PredType::getId will base on the enum +// value to return the correct HDF5 predefined type id. + +const PredType PredType::C_S1( E_C_S1 ); +const PredType PredType::FORTRAN_S1( E_FORTRAN_S1 ); + +const PredType PredType::STD_I8BE( E_STD_I8BE ); +const PredType PredType::STD_I8LE( E_STD_I8LE ); +const PredType PredType::STD_I16BE( E_STD_I16BE ); +const PredType PredType::STD_I16LE( E_STD_I16LE ); +const PredType PredType::STD_I32BE( E_STD_I32BE ); +const PredType PredType::STD_I32LE( E_STD_I32LE ); +const PredType PredType::STD_I64BE( E_STD_I64BE ); +const PredType PredType::STD_I64LE( E_STD_I64LE ); +const PredType PredType::STD_U8BE( E_STD_U8BE ); +const PredType PredType::STD_U8LE( E_STD_U8LE ); +const PredType PredType::STD_U16BE( E_STD_U16BE ); +const PredType PredType::STD_U16LE( E_STD_U16LE ); +const PredType PredType::STD_U32BE( E_STD_U32BE ); +const PredType PredType::STD_U32LE( E_STD_U32LE ); +const PredType PredType::STD_U64BE( E_STD_U64BE ); +const PredType PredType::STD_U64LE( E_STD_U64LE ); +const PredType PredType::STD_B8BE( E_STD_B8BE ); +const PredType PredType::STD_B8LE( E_STD_B8LE ); + +const PredType PredType::STD_B16BE( E_STD_B16BE ); +const PredType PredType::STD_B16LE( E_STD_B16LE ); +const PredType PredType::STD_B32BE( E_STD_B32BE ); +const PredType PredType::STD_B32LE( E_STD_B32LE ); +const PredType PredType::STD_B64BE( E_STD_B64BE ); +const PredType PredType::STD_B64LE( E_STD_B64LE ); +const PredType PredType::STD_REF_OBJ( E_STD_REF_OBJ ); +const PredType PredType::STD_REF_DSETREG( E_STD_REF_DSETREG ); + +const PredType PredType::IEEE_F32BE( E_IEEE_F32BE ); +const PredType PredType::IEEE_F32LE( E_IEEE_F32LE ); +const PredType PredType::IEEE_F64BE( E_IEEE_F64BE ); +const PredType PredType::IEEE_F64LE( E_IEEE_F64LE ); + +const PredType PredType::UNIX_D32BE( E_UNIX_D32BE ); +const PredType PredType::UNIX_D32LE( E_UNIX_D32LE ); +const PredType PredType::UNIX_D64BE( E_UNIX_D64BE ); +const PredType PredType::UNIX_D64LE( E_UNIX_D64LE ); + +const PredType PredType::INTEL_I8( E_INTEL_I8 ); +const PredType PredType::INTEL_I16( E_INTEL_I16 ); +const PredType PredType::INTEL_I32( E_INTEL_I32 ); +const PredType PredType::INTEL_I64( E_INTEL_I64 ); +const PredType PredType::INTEL_U8( E_INTEL_U8 ); +const PredType PredType::INTEL_U16( E_INTEL_U16 ); +const PredType PredType::INTEL_U32( E_INTEL_U32 ); +const PredType PredType::INTEL_U64( E_INTEL_U64 ); +const PredType PredType::INTEL_B8( E_INTEL_B8 ); +const PredType PredType::INTEL_B16( E_INTEL_B16 ); +const PredType PredType::INTEL_B32( E_INTEL_B32 ); +const PredType PredType::INTEL_B64( E_INTEL_B64 ); +const PredType PredType::INTEL_F32( E_INTEL_F32 ); +const PredType PredType::INTEL_F64( E_INTEL_F64 ); + +const PredType PredType::ALPHA_I8( E_ALPHA_I8 ); +const PredType PredType::ALPHA_I16( E_ALPHA_I16 ); +const PredType PredType::ALPHA_I32( E_ALPHA_I32 ); +const PredType PredType::ALPHA_I64( E_ALPHA_I64 ); +const PredType PredType::ALPHA_U8( E_ALPHA_U8 ); +const PredType PredType::ALPHA_U16( E_ALPHA_U16 ); +const PredType PredType::ALPHA_U32( E_ALPHA_U32 ); +const PredType PredType::ALPHA_U64( E_ALPHA_U64 ); +const PredType PredType::ALPHA_B8( E_ALPHA_B8 ); +const PredType PredType::ALPHA_B16( E_ALPHA_B16 ); +const PredType PredType::ALPHA_B32( E_ALPHA_B32 ); +const PredType PredType::ALPHA_B64( E_ALPHA_B64 ); +const PredType PredType::ALPHA_F32( E_ALPHA_F32 ); +const PredType PredType::ALPHA_F64( E_ALPHA_F64 ); + +const PredType PredType::MIPS_I8( E_MIPS_I8 ); +const PredType PredType::MIPS_I16( E_MIPS_I16 ); +const PredType PredType::MIPS_I32( E_MIPS_I32 ); +const PredType PredType::MIPS_I64( E_MIPS_I64 ); +const PredType PredType::MIPS_U8( E_MIPS_U8 ); +const PredType PredType::MIPS_U16( E_MIPS_U16 ); +const PredType PredType::MIPS_U32( E_MIPS_U32 ); +const PredType PredType::MIPS_U64( E_MIPS_U64 ); +const PredType PredType::MIPS_B8( E_MIPS_B8 ); +const PredType PredType::MIPS_B16( E_MIPS_B16 ); +const PredType PredType::MIPS_B32( E_MIPS_B32 ); +const PredType PredType::MIPS_B64( E_MIPS_B64 ); +const PredType PredType::MIPS_F32( E_MIPS_F32 ); +const PredType PredType::MIPS_F64( E_MIPS_F64 ); + +const PredType PredType::NATIVE_CHAR( E_NATIVE_CHAR ); +const PredType PredType::NATIVE_INT( E_NATIVE_INT ); +const PredType PredType::NATIVE_FLOAT( E_NATIVE_FLOAT ); +const PredType PredType::NATIVE_SCHAR( E_NATIVE_SCHAR ); +const PredType PredType::NATIVE_UCHAR( E_NATIVE_UCHAR ); +const PredType PredType::NATIVE_SHORT( E_NATIVE_SHORT ); +const PredType PredType::NATIVE_USHORT( E_NATIVE_USHORT ); +const PredType PredType::NATIVE_UINT( E_NATIVE_UINT ); +const PredType PredType::NATIVE_LONG( E_NATIVE_LONG ); +const PredType PredType::NATIVE_ULONG( E_NATIVE_ULONG ); +const PredType PredType::NATIVE_LLONG( E_NATIVE_LLONG ); +const PredType PredType::NATIVE_ULLONG( E_NATIVE_ULLONG ); +const PredType PredType::NATIVE_DOUBLE( E_NATIVE_DOUBLE ); +const PredType PredType::NATIVE_LDOUBLE( E_NATIVE_LDOUBLE ); +const PredType PredType::NATIVE_B8( E_NATIVE_B8 ); +const PredType PredType::NATIVE_B16( E_NATIVE_B16 ); +const PredType PredType::NATIVE_B32( E_NATIVE_B32 ); +const PredType PredType::NATIVE_B64( E_NATIVE_B64 ); +const PredType PredType::NATIVE_OPAQUE( E_NATIVE_OPAQUE ); +const PredType PredType::NATIVE_HSIZE( E_NATIVE_HSIZE ); +const PredType PredType::NATIVE_HSSIZE( E_NATIVE_HSSIZE ); +const PredType PredType::NATIVE_HERR( E_NATIVE_HERR ); +const PredType PredType::NATIVE_HBOOL( E_NATIVE_HBOOL ); + +const PredType PredType::NATIVE_INT8( E_NATIVE_INT8 ); +const PredType PredType::NATIVE_UINT8( E_NATIVE_UINT8 ); +const PredType PredType::NATIVE_INT_LEAST8( E_NATIVE_INT_LEAST8 ); +const PredType PredType::NATIVE_UINT_LEAST8( E_NATIVE_UINT_LEAST8 ); +const PredType PredType::NATIVE_INT_FAST8( E_NATIVE_INT_FAST8 ); +const PredType PredType::NATIVE_UINT_FAST8( E_NATIVE_UINT_FAST8 ); + +const PredType PredType::NATIVE_INT16( E_NATIVE_INT16 ); +const PredType PredType::NATIVE_UINT16( E_NATIVE_UINT16 ); +const PredType PredType::NATIVE_INT_LEAST16( E_NATIVE_INT_LEAST16 ); +const PredType PredType::NATIVE_UINT_LEAST16( E_NATIVE_UINT_LEAST16 ); +const PredType PredType::NATIVE_INT_FAST16( E_NATIVE_INT_FAST16 ); +const PredType PredType::NATIVE_UINT_FAST16( E_NATIVE_UINT_FAST16 ); + +const PredType PredType::NATIVE_INT32( E_NATIVE_INT32 ); +const PredType PredType::NATIVE_UINT32( E_NATIVE_UINT32 ); +const PredType PredType::NATIVE_INT_LEAST32( E_NATIVE_INT_LEAST32 ); +const PredType PredType::NATIVE_UINT_LEAST32( E_NATIVE_UINT_LEAST32 ); +const PredType PredType::NATIVE_INT_FAST32( E_NATIVE_INT_FAST32 ); +const PredType PredType::NATIVE_UINT_FAST32( E_NATIVE_UINT_FAST32 ); + +const PredType PredType::NATIVE_INT64( E_NATIVE_INT64 ); +const PredType PredType::NATIVE_UINT64( E_NATIVE_UINT64 ); +const PredType PredType::NATIVE_INT_LEAST64( E_NATIVE_INT_LEAST64 ); +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 ); + +hid_t PredType::getId() const +{ + switch( id ) { + case E_C_S1: + return( H5T_C_S1 ); + case E_FORTRAN_S1: + return( H5T_FORTRAN_S1 ); + + case E_STD_I8BE: + return( H5T_STD_I8BE ); + case E_STD_I8LE: + return( H5T_STD_I8LE ); + case E_STD_I16BE: + return( H5T_STD_I16BE ); + case E_STD_I16LE: + return( H5T_STD_I16LE ); + case E_STD_I32BE: + return( H5T_STD_I32BE ); + case E_STD_I32LE: + return( H5T_STD_I32LE ); + case E_STD_I64BE: + return( H5T_STD_I64BE ); + case E_STD_I64LE: + return( H5T_STD_I64LE ); + case E_STD_U8BE: + return( H5T_STD_U8BE ); + case E_STD_U8LE: + return( H5T_STD_U8LE ); + case E_STD_U16BE: + return( H5T_STD_U16BE ); + case E_STD_U16LE: + return( H5T_STD_U16LE ); + case E_STD_U32BE: + return( H5T_STD_U32BE ); + case E_STD_U32LE: + return( H5T_STD_U32LE ); + case E_STD_U64BE: + return( H5T_STD_U64BE ); + case E_STD_U64LE: + return( H5T_STD_U64LE ); + case E_STD_B8BE: + return( H5T_STD_B8BE ); + case E_STD_B8LE: + return( H5T_STD_B8LE ); + + case E_STD_B16BE: + return( H5T_STD_B16BE ); + case E_STD_B16LE: + return( H5T_STD_B16LE ); + case E_STD_B32BE: + return( H5T_STD_B32BE ); + case E_STD_B32LE: + return( H5T_STD_B32LE ); + case E_STD_B64BE: + return( H5T_STD_B64BE ); + case E_STD_B64LE: + return( H5T_STD_B64LE ); + case E_STD_REF_OBJ: + return( H5T_STD_REF_OBJ ); + case E_STD_REF_DSETREG: + return( H5T_STD_REF_DSETREG ); + + case E_IEEE_F32BE: + return( H5T_IEEE_F32BE ); + case E_IEEE_F32LE: + return( H5T_IEEE_F32LE ); + case E_IEEE_F64BE: + return( H5T_IEEE_F64BE ); + case E_IEEE_F64LE: + return( H5T_IEEE_F64LE ); + + case E_UNIX_D32BE: + return( H5T_UNIX_D32BE ); + case E_UNIX_D32LE: + return( H5T_UNIX_D32LE ); + case E_UNIX_D64BE: + return( H5T_UNIX_D64BE ); + case E_UNIX_D64LE: + return( H5T_UNIX_D64LE ); + + case E_INTEL_I8: + return( H5T_INTEL_I8 ); + case E_INTEL_I16: + return( H5T_INTEL_I16 ); + case E_INTEL_I32: + return( H5T_INTEL_I32 ); + case E_INTEL_I64: + return( H5T_INTEL_I64 ); + case E_INTEL_U8: + return( H5T_INTEL_U8 ); + case E_INTEL_U16: + return( H5T_INTEL_U16 ); + case E_INTEL_U32: + return( H5T_INTEL_U32 ); + case E_INTEL_U64: + return( H5T_INTEL_U64 ); + case E_INTEL_B8: + return( H5T_INTEL_B8 ); + case E_INTEL_B16: + return( H5T_INTEL_B16 ); + case E_INTEL_B32: + return( H5T_INTEL_B32 ); + case E_INTEL_B64: + return( H5T_INTEL_B64 ); + case E_INTEL_F32: + return( H5T_INTEL_F32 ); + case E_INTEL_F64: + return( H5T_INTEL_F64 ); + + case E_ALPHA_I8: + return( H5T_ALPHA_I8 ); + case E_ALPHA_I16: + return( H5T_ALPHA_I16 ); + case E_ALPHA_I32: + return( H5T_ALPHA_I32 ); + case E_ALPHA_I64: + return( H5T_ALPHA_I64 ); + case E_ALPHA_U8: + return( H5T_ALPHA_U8 ); + case E_ALPHA_U16: + return( H5T_ALPHA_U16 ); + case E_ALPHA_U32: + return( H5T_ALPHA_U32 ); + case E_ALPHA_U64: + return( H5T_ALPHA_U64 ); + case E_ALPHA_B8: + return( H5T_ALPHA_B8 ); + case E_ALPHA_B16: + return( H5T_ALPHA_B16 ); + case E_ALPHA_B32: + return( H5T_ALPHA_B32 ); + case E_ALPHA_B64: + return( H5T_ALPHA_B64 ); + case E_ALPHA_F32: + return( H5T_ALPHA_F32 ); + case E_ALPHA_F64: + return( H5T_ALPHA_F64 ); + + case E_MIPS_I8: + return( H5T_MIPS_I8 ); + case E_MIPS_I16: + return( H5T_MIPS_I16 ); + case E_MIPS_I32: + return( H5T_MIPS_I32 ); + case E_MIPS_I64: + return( H5T_MIPS_I64 ); + case E_MIPS_U8: + return( H5T_MIPS_U8 ); + case E_MIPS_U16: + return( H5T_MIPS_U16 ); + case E_MIPS_U32: + return( H5T_MIPS_U32 ); + case E_MIPS_U64: + return( H5T_MIPS_U64 ); + case E_MIPS_B8: + return( H5T_MIPS_B8 ); + case E_MIPS_B16: + return( H5T_MIPS_B16 ); + case E_MIPS_B32: + return( H5T_MIPS_B32 ); + case E_MIPS_B64: + return( H5T_MIPS_B64 ); + case E_MIPS_F32: + return( H5T_MIPS_F32 ); + case E_MIPS_F64: + return( H5T_MIPS_F64 ); + + case E_NATIVE_CHAR: + return( H5T_NATIVE_CHAR ); + case E_NATIVE_INT: + return( H5T_NATIVE_INT ); + case E_NATIVE_FLOAT: + return( H5T_NATIVE_FLOAT ); + case E_NATIVE_SCHAR: + return( H5T_NATIVE_SCHAR ); + case E_NATIVE_UCHAR: + return( H5T_NATIVE_UCHAR ); + case E_NATIVE_SHORT: + return( H5T_NATIVE_SHORT ); + case E_NATIVE_USHORT: + return( H5T_NATIVE_USHORT ); + case E_NATIVE_UINT: + return( H5T_NATIVE_UINT ); + case E_NATIVE_LONG: + return( H5T_NATIVE_LONG ); + case E_NATIVE_ULONG: + return( H5T_NATIVE_ULONG ); + case E_NATIVE_LLONG: + return( H5T_NATIVE_LLONG ); + case E_NATIVE_ULLONG: + return( H5T_NATIVE_ULLONG ); + case E_NATIVE_DOUBLE: + return( H5T_NATIVE_DOUBLE ); + case E_NATIVE_LDOUBLE: + return( H5T_NATIVE_LDOUBLE ); + case E_NATIVE_B8: + return( H5T_NATIVE_B8 ); + case E_NATIVE_B16: + return( H5T_NATIVE_B16 ); + case E_NATIVE_B32: + return( H5T_NATIVE_B32 ); + case E_NATIVE_B64: + return( H5T_NATIVE_B64 ); + case E_NATIVE_OPAQUE: + return( H5T_NATIVE_OPAQUE ); + case E_NATIVE_HSIZE: + return( H5T_NATIVE_HSIZE ); + case E_NATIVE_HSSIZE: + return( H5T_NATIVE_HSSIZE ); + case E_NATIVE_HERR: + return( H5T_NATIVE_HERR ); + case E_NATIVE_HBOOL: + return( H5T_NATIVE_HBOOL ); + + case E_NATIVE_INT8: + return( H5T_NATIVE_INT8 ); + case E_NATIVE_UINT8: + return( H5T_NATIVE_UINT8 ); + case E_NATIVE_INT_LEAST8: + return( H5T_NATIVE_INT_LEAST8 ); + case E_NATIVE_UINT_LEAST8: + return( H5T_NATIVE_UINT_LEAST8 ); + case E_NATIVE_INT_FAST8: + return( H5T_NATIVE_INT_FAST8 ); + case E_NATIVE_UINT_FAST8: + return( H5T_NATIVE_UINT_FAST8 ); + + case E_NATIVE_INT16: + return( H5T_NATIVE_INT16 ); + case E_NATIVE_UINT16: + return( H5T_NATIVE_UINT16 ); + case E_NATIVE_INT_LEAST16: + return( H5T_NATIVE_INT_LEAST16 ); + case E_NATIVE_UINT_LEAST16: + return( H5T_NATIVE_UINT_LEAST16 ); + case E_NATIVE_INT_FAST16: + return( H5T_NATIVE_INT_FAST16 ); + case E_NATIVE_UINT_FAST16: + return( H5T_NATIVE_UINT_FAST16 ); + + case E_NATIVE_INT32: + return( H5T_NATIVE_INT32 ); + case E_NATIVE_UINT32: + return( H5T_NATIVE_UINT32 ); + case E_NATIVE_INT_LEAST32: + return( H5T_NATIVE_INT_LEAST32 ); + case E_NATIVE_UINT_LEAST32: + return( H5T_NATIVE_UINT_LEAST32 ); + case E_NATIVE_INT_FAST32: + return( H5T_NATIVE_INT_FAST32 ); + case E_NATIVE_UINT_FAST32: + return( H5T_NATIVE_UINT_FAST32 ); + + case E_NATIVE_INT64: + return( H5T_NATIVE_INT64 ); + case E_NATIVE_UINT64: + return( H5T_NATIVE_UINT64 ); + case E_NATIVE_INT_LEAST64: + return( H5T_NATIVE_INT_LEAST64 ); + case E_NATIVE_UINT_LEAST64: + return( H5T_NATIVE_UINT_LEAST64 ); + case E_NATIVE_INT_FAST64: + return( H5T_NATIVE_INT_FAST64 ); + case E_NATIVE_UINT_FAST64: + return( H5T_NATIVE_UINT_FAST64 ); + + default: + return( INVALID ); + } // end switch +} // end of getId() // These dummy functions do not inherit from DataType - they'll // throw an DataTypeIException if invoked. diff --git a/c++/src/H5PredType.h b/c++/src/H5PredType.h index 552605a..341954a 100644 --- a/c++/src/H5PredType.h +++ b/c++/src/H5PredType.h @@ -19,6 +19,8 @@ class PredType : public AtomType { // Copy constructor - makes copy of the original object PredType( const PredType& original ); +virtual hid_t getId() const; +hid_t getenum() const { return id; } // remove when done // Declaration of predefined types; their definition is in Predtype.C static const PredType STD_I8BE; @@ -167,7 +169,55 @@ class PredType : public AtomType { private: // added this to work around the atexit/global destructor problem // temporarily - it'll prevent the use of atexit to clean up - static const PredType NotAtexit; + static const PredType NotAtexit; // not working yet + + // This enum type is used by this class only to handle the + // global PredType objects. These values will ensure that the + // application receives an appropriate and uptodated id for an + // HDF5 predefined type; particularly usefull when the application + // closes and opens the library again. + enum predefined_types { + + INVALID = 0, E_C_S1 = 1, E_FORTRAN_S1, + + E_STD_I8BE, E_STD_I8LE, E_STD_I16BE, E_STD_I16LE, E_STD_I32BE, + E_STD_I32LE, E_STD_I64BE, E_STD_I64LE, E_STD_U8BE, E_STD_U8LE, + E_STD_U16BE, E_STD_U16LE, E_STD_U32BE, E_STD_U32LE, E_STD_U64BE, + E_STD_U64LE, E_STD_B8BE, E_STD_B8LE, E_STD_B16BE, E_STD_B16LE, + E_STD_B32BE, E_STD_B32LE, E_STD_B64BE, E_STD_B64LE, E_STD_REF_OBJ, + E_STD_REF_DSETREG, + + E_IEEE_F32BE, E_IEEE_F32LE, E_IEEE_F64BE, E_IEEE_F64LE, + + E_UNIX_D32BE, E_UNIX_D32LE, E_UNIX_D64BE, E_UNIX_D64LE, + + E_INTEL_I8, E_INTEL_I16, E_INTEL_I32, E_INTEL_I64, E_INTEL_U8, + E_INTEL_U16, E_INTEL_U32, E_INTEL_U64, E_INTEL_B8, E_INTEL_B16, + E_INTEL_B32, E_INTEL_B64, E_INTEL_F32, E_INTEL_F64, + + E_ALPHA_I8, E_ALPHA_I16, E_ALPHA_I32, E_ALPHA_I64, E_ALPHA_U8, + E_ALPHA_U16, E_ALPHA_U32, E_ALPHA_U64, E_ALPHA_B8, E_ALPHA_B16, + E_ALPHA_B32, E_ALPHA_B64, E_ALPHA_F32, E_ALPHA_F64, + + E_MIPS_I8, E_MIPS_I16, E_MIPS_I32, E_MIPS_I64, E_MIPS_U8, + E_MIPS_U16, E_MIPS_U32, E_MIPS_U64, E_MIPS_B8, E_MIPS_B16, + E_MIPS_B32, E_MIPS_B64, E_MIPS_F32, E_MIPS_F64, + + E_NATIVE_CHAR, E_NATIVE_INT, E_NATIVE_FLOAT, E_NATIVE_SCHAR, + E_NATIVE_UCHAR, E_NATIVE_SHORT, E_NATIVE_USHORT, E_NATIVE_UINT, + E_NATIVE_LONG, E_NATIVE_ULONG, E_NATIVE_LLONG, E_NATIVE_ULLONG, + E_NATIVE_DOUBLE, E_NATIVE_LDOUBLE, E_NATIVE_B8, E_NATIVE_B16, + E_NATIVE_B32, E_NATIVE_B64, E_NATIVE_OPAQUE, E_NATIVE_HSIZE, + E_NATIVE_HSSIZE, E_NATIVE_HERR, E_NATIVE_HBOOL, E_NATIVE_INT8, + E_NATIVE_UINT8, E_NATIVE_INT_LEAST8, E_NATIVE_UINT_LEAST8, + E_NATIVE_INT_FAST8, E_NATIVE_UINT_FAST8, E_NATIVE_INT16, + E_NATIVE_UINT16, E_NATIVE_INT_LEAST16, E_NATIVE_UINT_LEAST16, + E_NATIVE_INT_FAST16, E_NATIVE_UINT_FAST16, E_NATIVE_INT32, + E_NATIVE_UINT32, E_NATIVE_INT_LEAST32, E_NATIVE_UINT_LEAST32, + E_NATIVE_INT_FAST32, E_NATIVE_UINT_FAST32, E_NATIVE_INT64, + E_NATIVE_UINT64, E_NATIVE_INT_LEAST64, E_NATIVE_UINT_LEAST64, + E_NATIVE_INT_FAST64, E_NATIVE_UINT_FAST64 + }; protected: // Default constructor diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index 8609b60..2da84e9 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -64,6 +64,14 @@ void PropList::copy( const PropList& like_plist ) } } +// Makes a copy of the property list on the right hand side and stores +// the new id in the left hand side object. +PropList& PropList::operator=( const PropList& rhs ) +{ + copy(rhs); + return(*this); +} + // Closes the property list if it is not a default one void PropList::p_close() const { diff --git a/c++/src/H5PropList.h b/c++/src/H5PropList.h index 7243076..037b0d8 100644 --- a/c++/src/H5PropList.h +++ b/c++/src/H5PropList.h @@ -25,11 +25,7 @@ class PropList : public IdComponent { void copy( const PropList& like_plist ); // Make a copy of the given property list using assignment statement - //PropList& operator=( const PropList& rhs ); - - // Sets and gets PropList's data member - //hid_t getId () const; - //void setId( hid_t new_plist_id ); + virtual PropList& operator=( const PropList& rhs ); // Gets the class of this property list, i.e. H5P_FILE_CREATE, // H5P_FILE_ACCESS, ... |