[svn-r11149] Purpose: Fix bugzilla #406

Description:
    Added these missing member functions:
        AbstractDs::getArrayType
        AbstractDs::getVarLenType
        CommonFG::openArrayType
        CommonFG::openVarLenType
        CompType::getMemberArrayType
        CompType::getMemberVarLenType

Platforms tested:
    Linux 2.4 (heping)
    IRIX64 with -n32 (modi4)
    Linux 2.4 w/PGI (colonelk)
This commit is contained in:
Binh-Minh Ribler 2005-07-24 12:52:43 -05:00
parent 3cba75f060
commit f208550696
8 changed files with 179 additions and 41 deletions

View File

@ -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);
}
//--------------------------------------------------------------------------
@ -123,6 +123,20 @@ CompType AbstractDs::getCompType() const
return(comptype);
}
//--------------------------------------------------------------------------
// 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
@ -165,6 +179,20 @@ StrType AbstractDs::getStrType() const
return(strtype);
}
//--------------------------------------------------------------------------
// 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.

View File

@ -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;

View File

@ -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

View File

@ -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
@ -690,6 +690,32 @@ CompType CommonFG::openCompType( const string& name ) const
return( openCompType( 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_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.
@ -768,6 +794,32 @@ StrType CommonFG::openStrType( const string& name ) const
return( openStrType( name.c_str()) );
}
//--------------------------------------------------------------------------
// 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.

View File

@ -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;

View File

@ -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.

View File

@ -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;

View File

@ -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
}