本文整理匯總了C++中DataTypeIException函數的典型用法代碼示例。如果您正苦於以下問題:C++ DataTypeIException函數的具體用法?C++ DataTypeIException怎麽用?C++ DataTypeIException使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DataTypeIException函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: p_get_type
//--------------------------------------------------------------------------
// 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");
}
}
示例2: H5Tget_fields
//--------------------------------------------------------------------------
// Function: FloatType::getFields
///\brief Retrieves floating point datatype bit field information.
///\param spos - OUT: Retrieved floating-point sign bit
///\param epos - OUT: Retrieved exponent bit-position
///\param esize - OUT: Retrieved size of exponent, in bits
///\param mpos - OUT: Retrieved mantissa bit-position
///\param msize - OUT: Retrieved size of mantissa, in bits
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void FloatType::getFields(size_t& spos, size_t& epos, size_t& esize, size_t& mpos, size_t& msize) const
{
herr_t ret_value = H5Tget_fields(id, &spos, &epos, &esize, &mpos, &msize);
if (ret_value < 0)
{
throw DataTypeIException("FloatType::getFields", "H5Tget_fields failed");
}
}
示例3: H5Tset_fields
//--------------------------------------------------------------------------
// Function: FloatType::setFields
///\brief Sets locations and sizes of floating point bit fields.
///\param spos - OUT: Sign position, i.e., the bit offset of the
/// floating-point sign bit.
///\param epos - OUT: Exponent bit position
///\param esize - OUT: Size of exponent, in bits
///\param mpos - OUT: Mantissa bit-position
///\param msize - OUT: Size of mantissa, in bits
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void FloatType::setFields(size_t spos, size_t epos, size_t esize, size_t mpos, size_t msize) const
{
herr_t ret_value = H5Tset_fields(id, spos, epos, esize, mpos, msize);
if (ret_value < 0)
{
throw DataTypeIException("FloatType::setFields", "H5Tset_fields failed");
}
}
示例4: H5Tset_norm
//--------------------------------------------------------------------------
// Function: FloatType::setNorm
///\brief Sets the mantissa normalization of a floating-point datatype.
///\param norm - IN: Mantissa normalization type
///\exception H5::DataTypeIException
///\par Description
/// Valid values for normalization type include:
/// \li \c H5T_NORM_IMPLIED (0) - MSB of mantissa is not stored
/// \li \c H5T_NORM_MSBSET (1) - MSB of mantissa is always 1
/// \li \c H5T_NORM_NONE (2) - Mantissa is not normalized
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void FloatType::setNorm(H5T_norm_t norm) const
{
herr_t ret_value = H5Tset_norm(id, norm);
if (ret_value < 0)
{
throw DataTypeIException("FloatType::setNorm", "H5Tset_norm failed");
}
}
示例5: H5Tset_ebias
//--------------------------------------------------------------------------
// Function: FloatType::setEbias
///\brief Sets the exponent bias of a floating-point type.
///\param ebias - Exponent bias value
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void FloatType::setEbias(size_t ebias) const
{
herr_t ret_value = H5Tset_ebias(id, ebias);
if (ret_value < 0)
{
throw DataTypeIException("FloatType::setEbias", "H5Tset_ebias failed");
}
}
示例6: varlentype
//--------------------------------------------------------------------------
// 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());
}
}
示例7: DataType
//--------------------------------------------------------------------------
// Function: ArrayType overloaded constructor
///\brief Creates an ArrayType object using an existing id.
///\param existing_id - IN: Id of an existing datatype
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May 2004
//--------------------------------------------------------------------------
ArrayType::ArrayType( const hid_t existing_id ) : DataType( existing_id )
{
// Get the rank of the existing array and store it in this array
rank = H5Tget_array_ndims(existing_id);
if (rank < 0)
{
throw DataTypeIException("ArrayType constructor (existing id)", "H5Tget_array_ndims failed");
}
// Allocate space for the dimensions
dimensions = new hsize_t[rank];
// Get the dimensions of the existing array and store it in this array
int ret_value = H5Tget_array_dims2(id, dimensions);
if (ret_value < 0)
throw DataTypeIException("ArrayType constructor (existing id)", "H5Tget_array_dims2 failed");
}
示例8: H5Tset_inpad
//--------------------------------------------------------------------------
// Function: FloatType::setInpad
///\brief Fills unused internal floating point bits.
///\param inpad - IN: Internal padding type
///\exception H5::DataTypeIException
///\par Description
/// If any internal bits of a floating point type are unused
/// (that is, those significant bits which are not part of the
/// sign, exponent, or mantissa), then they will be filled
/// according to the padding value provided by \a inpad.
///\par
/// Valid values for normalization type include:
/// \li \c H5T_PAD_ZERO (0) - Set background to zeros
/// \li \c H5T_PAD_ONE (1) - Set background to ones
/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void FloatType::setInpad(H5T_pad_t inpad) const
{
herr_t ret_value = H5Tset_inpad(id, inpad);
if (ret_value < 0)
{
throw DataTypeIException("FloatType::setInpad", "H5Tset_inpad failed");
}
}
示例9: H5Tget_member_value
//--------------------------------------------------------------------------
// Function: EnumType::getMemberValue
///\brief Retrieves the value of a member in this enumeration datatype,
/// given the member's index.
///\param memb_no - IN: Index of the queried member
///\param value - OUT: Pointer to the retrieved value
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void EnumType::getMemberValue( unsigned memb_no, void *value ) const
{
// Call C routine H5Tget_member_value to get the datatype member's value
hid_t ret_value = H5Tget_member_value( id, memb_no, value );
if( ret_value < 0 )
{
throw DataTypeIException("EnumType::getMemberValue", "H5Tget_member_value failed");
}
}
示例10: H5Tenum_valueof
//--------------------------------------------------------------------------
// Function: EnumType::valueOf
///\brief Retrieves the value corresponding to a member of this
/// enumeration datatype, given the member's name.
///\param name - IN: Name of the queried member
///\param value - OUT: Pointer to the retrieved value
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void EnumType::valueOf( const char* name, void *value ) const
{
// Calls C routine H5Tenum_valueof to get the enum datatype value
herr_t ret_value = H5Tenum_valueof( id, name, value );
if( ret_value < 0 )
{
throw DataTypeIException("EnumType::valueOf", "H5Tenum_valueof failed");
}
}
示例11: H5Tenum_insert
//--------------------------------------------------------------------------
// Function: EnumType::insert
///\brief Inserts a new member to this enumeration datatype.
///\param name - IN: Name of the new member
///\param value - IN: Pointer to the value of the new member
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void EnumType::insert( const char* name, void *value ) const
{
// Calls C routine H5Tenum_insert to insert the new enum datatype member.
herr_t ret_value = H5Tenum_insert( id, name, value );
if( ret_value < 0 )
{
throw DataTypeIException("EnumType::insert", "H5Tenum_insert failed");
}
}
示例12: f_DataType_setId
//--------------------------------------------------------------------------
// 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());
}
}
示例13: H5Tset_strpad
//--------------------------------------------------------------------------
// Function: StrType::setStrpad
///\brief Defines the storage mechanism for this string datatype.
///\param strpad - IN: String padding type
///\exception H5::DataTypeIException
///\par Description
/// For detail, please refer to the C layer Reference Manual at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetStrpad
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void StrType::setStrpad( H5T_str_t strpad ) const
{
herr_t ret_value = H5Tset_strpad( id, strpad );
if( ret_value < 0 )
{
throw DataTypeIException("StrType::setStrpad", "H5Tset_strpad failed");
}
}
示例14: DataType
//--------------------------------------------------------------------------
// Function: VarLenType overloaded constructor
///\brief Creates a new variable-length datatype based on the specified
/// \a base_type.
///\param base_type - IN: Pointer to existing datatype
///\exception H5::DataTypeIException
// Description
// DataType passed by pointer to avoid clashing with copy
// constructor.
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
VarLenType::VarLenType(const DataType* base_type) : DataType()
{
id = H5Tvlen_create(base_type->getId());
if (id < 0)
{
throw DataTypeIException("VarLenType constructor",
"H5Tvlen_create returns negative value");
}
}
示例15: H5Tset_cset
//--------------------------------------------------------------------------
// Function: StrType::setCset
///\brief Sets character set to be used.
///\param cset - IN: character set type, which can be:
/// \li \c H5T_CSET_ASCII (0) - Character set is US ASCII.
///\note
/// ASCII and UTF-8 Unicode are the only currently supported character
/// encodings. Extended ASCII encodings (for example, ISO 8859) are not
/// supported. This encoding policy is not enforced by the HDF5 Library.
/// Using encodings other than ASCII and UTF-8 can lead to compatibility
/// and usability problems. See the C API entry H5Pset_char_encoding for
/// more information.
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void StrType::setCset( H5T_cset_t cset ) const
{
herr_t ret_value = H5Tset_cset( id, cset );
if( ret_value < 0 )
{
throw DataTypeIException("StrType::setCset", "H5Tset_cset failed");
}
}