diff options
Diffstat (limited to 'c++')
-rw-r--r-- | c++/src/H5AbstractDs.cpp | 42 | ||||
-rw-r--r-- | c++/src/H5AbstractDs.h | 12 | ||||
-rw-r--r-- | c++/src/H5ArrayType.h | 6 | ||||
-rw-r--r-- | c++/src/H5CommonFG.cpp | 82 | ||||
-rw-r--r-- | c++/src/H5CommonFG.h | 16 | ||||
-rw-r--r-- | c++/src/H5CompType.cpp | 40 | ||||
-rw-r--r-- | c++/src/H5CompType.h | 16 | ||||
-rw-r--r-- | c++/src/H5VarLenType.h | 6 |
8 files changed, 179 insertions, 41 deletions
diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp index 33fadc5..9e54d94 100644 --- a/c++/src/H5AbstractDs.cpp +++ b/c++/src/H5AbstractDs.cpp @@ -96,17 +96,17 @@ DataType AbstractDs::getDataType() const } //-------------------------------------------------------------------------- -// Function: AbstractDs::getEnumType -///\brief Returns the enumeration datatype of this abstract dataset which +// Function: AbstractDs::getArrayType +///\brief Returns the compound datatype of this abstract dataset which /// can be a dataset or an attribute. -///\return EnumType instance +///\return ArrayType instance ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- -EnumType AbstractDs::getEnumType() const +ArrayType AbstractDs::getArrayType() const { - EnumType enumtype(p_get_type()); - return(enumtype); + ArrayType arraytype(p_get_type()); + return(arraytype); } //-------------------------------------------------------------------------- @@ -124,6 +124,20 @@ CompType AbstractDs::getCompType() const } //-------------------------------------------------------------------------- +// 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_get_type()); + return(enumtype); +} + +//-------------------------------------------------------------------------- // Function: AbstractDs::getIntType ///\brief Returns the integer datatype of this abstract dataset which /// can be a dataset or an attribute. @@ -166,6 +180,20 @@ StrType AbstractDs::getStrType() const } //-------------------------------------------------------------------------- +// Function: AbstractDs::getVarLenType +///\brief Returns the floating-point datatype of this abstract dataset, +/// which can be a dataset or an attribute. +///\return VarLenType instance +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Jul, 2005 +//-------------------------------------------------------------------------- +VarLenType AbstractDs::getVarLenType() const +{ + VarLenType varlentype(p_get_type()); + return(varlentype); +} + +//-------------------------------------------------------------------------- // Function: AbstractDs destructor ///\brief Noop destructor. // Programmer Binh-Minh Ribler - 2000 diff --git a/c++/src/H5AbstractDs.h b/c++/src/H5AbstractDs.h index 9cf6d57..03b87ec 100644 --- a/c++/src/H5AbstractDs.h +++ b/c++/src/H5AbstractDs.h @@ -24,6 +24,14 @@ #ifndef H5_NO_NAMESPACE namespace H5 { #endif + +class ArrayType; +class CompType; +class EnumType; +class FloatType; +class IntType; +class StrType; +class VarLenType; class H5_DLLCPP AbstractDs : public H5Object { public: // Gets a copy the datatype of that this abstract dataset uses. @@ -34,11 +42,13 @@ class H5_DLLCPP AbstractDs : public H5Object { DataType getDataType() const; // Gets a copy of the specific datatype of this abstract dataset. - EnumType getEnumType() const; + ArrayType getArrayType() const; CompType getCompType() const; + EnumType getEnumType() const; IntType getIntType() const; FloatType getFloatType() const; StrType getStrType() const; + VarLenType getVarLenType() const; // Gets the dataspace of this abstract dataset - pure virtual. virtual DataSpace getSpace() const = 0; diff --git a/c++/src/H5ArrayType.h b/c++/src/H5ArrayType.h index fb5eb2e..3f1ddc5 100644 --- a/c++/src/H5ArrayType.h +++ b/c++/src/H5ArrayType.h @@ -37,6 +37,9 @@ class H5_DLLCPP ArrayType : public DataType { // Copy constructor: makes copy of the original object. ArrayType( const ArrayType& original ); + // Constructor that takes an existing id + ArrayType( const hid_t existing_id ); + // Noop destructor virtual ~ArrayType(); @@ -44,9 +47,6 @@ class H5_DLLCPP ArrayType : public DataType { // Default constructor ArrayType(); - // Constructor that takes an existing id - ArrayType( const hid_t existing_id ); - private: int rank; // Rank of the array hsize_t* dimensions; // Sizes of the array dimensions diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index 7771c40..40558c1 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -639,30 +639,30 @@ DataType CommonFG::openDataType( const string& name ) const } //-------------------------------------------------------------------------- -// 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 +// Function: CommonFG::openArrayType +///\brief Opens the named array datatype at this location. +///\param name - IN: Name of the array datatype to open +///\return ArrayType instance ///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- -EnumType CommonFG::openEnumType( const char* name ) const +ArrayType CommonFG::openArrayType( const char* name ) const { - EnumType enum_type(p_open_data_type(name)); - return(enum_type); -} + ArrayType array_type(p_open_data_type(name)); + return(array_type); +} //-------------------------------------------------------------------------- -// Function: CommonFG::openEnumType +// Function: CommonFG::openArrayType ///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an +/// It differs from the above function in that it takes an /// \c std::string for \a name. -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- -EnumType CommonFG::openEnumType( const string& name ) const +ArrayType CommonFG::openArrayType( const string& name ) const { - return( openEnumType( name.c_str()) ); -} + return( openArrayType( name.c_str()) ); +} //-------------------------------------------------------------------------- // Function: CommonFG::openCompType @@ -691,6 +691,32 @@ CompType CommonFG::openCompType( const string& name ) const } //-------------------------------------------------------------------------- +// 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_open_data_type(name)); + return(enum_type); +} + +//-------------------------------------------------------------------------- +// 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( openEnumType( 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 @@ -769,6 +795,32 @@ StrType CommonFG::openStrType( const string& name ) const } //-------------------------------------------------------------------------- +// Function: CommonFG::openVarLenType +///\brief Opens the named variable length datatype at this location. +///\param name - IN: Name of the variable length datatype to open +///\return VarLenType instance +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - Jul, 2005 +//-------------------------------------------------------------------------- +VarLenType CommonFG::openVarLenType( const char* name ) const +{ + VarLenType varlen_type(p_open_data_type(name)); + return(varlen_type); +} + +//-------------------------------------------------------------------------- +// Function: CommonFG::openVarLenType +///\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 - Jul, 2005 +//-------------------------------------------------------------------------- +VarLenType CommonFG::openVarLenType( const string& name ) const +{ + return( openVarLenType( 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 diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h index 7541627..1ad18f2 100644 --- a/c++/src/H5CommonFG.h +++ b/c++/src/H5CommonFG.h @@ -26,6 +26,8 @@ namespace H5 { class Group; class H5File; +class ArrayType; +class VarLenType; class H5_DLLCPP CommonFG { public: // Creates a new group at this location which can be a file @@ -111,14 +113,18 @@ class H5_DLLCPP CommonFG { DataType openDataType(const char* name) const; DataType openDataType(const string& name) const; - // Opens a named enumeration datatype in this location. - EnumType openEnumType(const char* name) const; - EnumType openEnumType(const string& name) const; + // Opens a named array datatype in this location. + ArrayType openArrayType(const char* name) const; + ArrayType openArrayType(const string& name) const; // Opens a named compound datatype in this location. CompType openCompType(const char* name) const; CompType openCompType(const string& name) const; + // Opens a named enumeration datatype in this location. + EnumType openEnumType(const char* name) const; + EnumType openEnumType(const string& name) const; + // Opens a named integer datatype in this location. IntType openIntType(const char* name) const; IntType openIntType(const string& name) const; @@ -131,6 +137,10 @@ class H5_DLLCPP CommonFG { StrType openStrType(const char* name) const; StrType openStrType(const string& name) const; + // Opens a named variable length datatype in this location. + VarLenType openVarLenType(const char* name) const; + VarLenType openVarLenType(const string& name) const; + /// For subclasses, H5File and Group, to return the correct /// object id, i.e. file or group id. virtual hid_t getLocId() const = 0; diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp index 2991f10..708d273 100644 --- a/c++/src/H5CompType.cpp +++ b/c++/src/H5CompType.cpp @@ -249,7 +249,22 @@ DataType CompType::getMemberDataType( int member_num ) const } //-------------------------------------------------------------------------- -// Function: CompType::getMemberDataType +// Function: CompType::getMemberArrayType +///\brief Returns the array datatype of the specified member in this +/// compound datatype. +///\param member_num - IN: Zero-based index of the member +///\return ArrayType instance +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Jul, 2005 +//-------------------------------------------------------------------------- +ArrayType CompType::getMemberArrayType( int member_num ) const +{ + ArrayType arraytype(p_get_member_type(member_num)); + return(arraytype); +} + +//-------------------------------------------------------------------------- +// Function: CompType::getMemberEnumType ///\brief Returns the enumeration datatype of the specified member in /// this compound datatype. ///\param member_num - IN: Zero-based index of the member @@ -264,7 +279,7 @@ EnumType CompType::getMemberEnumType( int member_num ) const } //-------------------------------------------------------------------------- -// Function: CompType::getMemberDataType +// Function: CompType::getMemberCompType ///\brief Returns the compound datatype of the specified member in this /// compound datatype. ///\param member_num - IN: Zero-based index of the member @@ -279,7 +294,7 @@ CompType CompType::getMemberCompType( int member_num ) const } //-------------------------------------------------------------------------- -// Function: CompType::getMemberDataType +// Function: CompType::getMemberIntType ///\brief Returns the integer datatype of the specified member in this /// compound datatype. ///\param member_num - IN: Zero-based index of the member @@ -294,7 +309,7 @@ IntType CompType::getMemberIntType( int member_num ) const } //-------------------------------------------------------------------------- -// Function: CompType::getMemberDataType +// Function: CompType::getMemberFloatType ///\brief Returns the floating-point datatype of the specified member /// in this compound datatype. ///\param member_num - IN: Zero-based index of the member @@ -309,7 +324,7 @@ FloatType CompType::getMemberFloatType( int member_num ) const } //-------------------------------------------------------------------------- -// Function: CompType::getMemberDataType +// Function: CompType::getMemberStrType ///\brief Returns the string datatype of the specified member in this /// compound datatype. ///\param member_num - IN: Zero-based index of the member @@ -323,6 +338,21 @@ StrType CompType::getMemberStrType( int member_num ) const return(strtype); } +//-------------------------------------------------------------------------- +// Function: CompType::getMemberVarLenType +///\brief Returns the variable length datatype of the specified member +/// in this compound datatype. +///\param member_num - IN: Zero-based index of the member +///\return VarLenType instance +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Jul, 2005 +//-------------------------------------------------------------------------- +VarLenType CompType::getMemberVarLenType( int member_num ) const +{ + VarLenType varlentype(p_get_member_type(member_num)); + return(varlentype); +} + /* 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. diff --git a/c++/src/H5CompType.h b/c++/src/H5CompType.h index bc96969..ae38398 100644 --- a/c++/src/H5CompType.h +++ b/c++/src/H5CompType.h @@ -49,14 +49,18 @@ class H5_DLLCPP CompType : public DataType { // Returns the name of a member of this compound datatype. string getMemberName( unsigned member_num ) const; - // Returns the compound datatype of the specified member in - // this compound datatype. - CompType getMemberCompType( int member_num ) const; - // Returns the generic datatype of the specified member in // this compound datatype. DataType getMemberDataType( int member_num ) const; + // Returns the array datatype of the specified member in + // this compound datatype. + ArrayType getMemberArrayType( int member_num ) const; + + // Returns the compound datatype of the specified member in + // this compound datatype. + CompType getMemberCompType( int member_num ) const; + // Returns the enumeration datatype of the specified member in // this compound datatype. EnumType getMemberEnumType( int member_num ) const; @@ -73,6 +77,10 @@ class H5_DLLCPP CompType : public DataType { // this compound datatype. StrType getMemberStrType( int member_num ) const; + // Returns the variable length datatype of the specified member in + // this compound datatype. + VarLenType getMemberVarLenType( int member_num ) const; + // Returns the number of members in this compound datatype. int getNmembers() const; diff --git a/c++/src/H5VarLenType.h b/c++/src/H5VarLenType.h index c31946a..ded95c6 100644 --- a/c++/src/H5VarLenType.h +++ b/c++/src/H5VarLenType.h @@ -31,15 +31,15 @@ class H5_DLLCPP VarLenType : public DataType { // Copy constructor: makes copy of the original object. VarLenType( const VarLenType& original ); + // Constructor that takes an existing id + VarLenType( const hid_t existing_id ); + // Noop destructor virtual ~VarLenType(); protected: // Default constructor VarLenType(); - - // Constructor that takes an existing id - VarLenType( const hid_t existing_id ); }; #ifndef H5_NO_NAMESPACE } |