//-------------------------------------------------------------------------- // Function: AbstractDs::getTypeClass ///\brief Returns the class of the datatype that is used by this /// object, which can be a dataset or an attribute. ///\return Datatype class identifier ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5T_class_t AbstractDs::getTypeClass() const { // Gets the datatype used by this dataset or attribute. // p_get_type calls either H5Dget_type or H5Aget_type depending on // which object invokes getTypeClass hid_t datatype_id; try { datatype_id = p_get_type(); // returned value is already validated } catch (DataSetIException E) { throw DataTypeIException("DataSet::getTypeClass", E.getDetailMsg()); } catch (AttributeIException E) { throw DataTypeIException("Attribute::getTypeClass", E.getDetailMsg()); } // Gets the class of the datatype and validate it before returning H5T_class_t type_class = H5Tget_class(datatype_id); if( type_class != H5T_NO_CLASS ) return( type_class ); else { if (fromClass() == "DataSet") throw DataTypeIException("DataSet::getTypeClass", "H5Tget_class returns H5T_NO_CLASS"); else if (fromClass() == "Attribute") throw DataTypeIException("Attribute::getTypeClass", "H5Tget_class returns H5T_NO_CLASS"); } }
//-------------------------------------------------------------------------- // 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 { // Gets the id of the datatype used by this dataset or attribute using // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type // depending on which object invokes getVarLenType. Then, create and // return the VarLenType object try { VarLenType varlentype(p_get_type()); return(varlentype); } catch (DataSetIException E) { throw DataTypeIException("DataSet::getVarLenType", E.getDetailMsg()); } catch (AttributeIException E) { throw DataTypeIException("Attribute::getVarLenType", E.getDetailMsg()); } }
//-------------------------------------------------------------------------- // 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 { // Gets the id of the datatype used by this dataset or attribute using // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type // depending on which object invokes getEnumType. Then, create and // return the EnumType object try { EnumType enumtype; f_DataType_setId(&enumtype, p_get_type()); return(enumtype); } catch (DataSetIException& E) { throw DataTypeIException("DataSet::getEnumType", E.getDetailMsg()); } catch (AttributeIException& E) { throw DataTypeIException("Attribute::getEnumType", E.getDetailMsg()); } }
//-------------------------------------------------------------------------- // Function: AbstractDs::getArrayType ///\brief Returns the array datatype of this abstract dataset which /// can be a dataset or an attribute. ///\return ArrayType instance ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- ArrayType AbstractDs::getArrayType() const { // Gets the id of the datatype used by this dataset or attribute using // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type // depending on which object invokes getArrayType. Then, create and // return the ArrayType object try { // Create ArrayType and set values this way to work around the // problem described in the JIRA issue HDFFV-7947 ArrayType arraytype; f_DataType_setId(&arraytype, p_get_type()); return(arraytype); } catch (DataSetIException& E) { throw DataTypeIException("DataSet::getArrayType", E.getDetailMsg()); } catch (AttributeIException& E) { throw DataTypeIException("Attribute::getArrayType", E.getDetailMsg()); } }