HDF5 C++ API  1.8.20
 All Classes Namespaces Functions Variables Typedefs Friends Pages
Public Member Functions | List of all members
H5::CompType Class Reference

CompType is a derivative of a DataType and operates on HDF5 compound datatypes. More...

#include <H5CompType.h>

Inheritance diagram for H5::CompType:
H5::DataType H5::H5Object H5::H5Location H5::IdComponent

Public Member Functions

 CompType ()
 Default constructor: Creates a stub compound datatype. More...
 
 CompType (const hid_t existing_id)
 Creates a CompType object using the id of an existing datatype. More...
 
 CompType (size_t size)
 Creates an empty compound datatype given a size, in bytes. More...
 
 CompType (const DataSet &dataset)
 Gets the compound datatype of the specified dataset. More...
 
 CompType (const CompType &original)
 Copy constructor: makes copy of the original CompType object. More...
 
 CompType (const H5Location &loc, const char *name)
 Creates an CompType instance by opening an HDF5 compound given its name, provided as a C character string. More...
 
 CompType (const H5Location &loc, const H5std_string &name)
 Creates an CompType instance by opening an HDF5 compound datatype given its name, provided as an H5std_string. More...
 
virtual DataTypedecode () const
 Returns a CompType object via DataType* by decoding the binary object description of this datatype.

Exceptions
H5::DataTypeIException.
More...
 
H5T_class_t getMemberClass (unsigned member_num) const
 Gets the type class of the specified member. More...
 
int getMemberIndex (const char *name) const
 Returns the index of a member in this compound datatype. More...
 
int getMemberIndex (const H5std_string &name) const
 
size_t getMemberOffset (unsigned memb_no) const
 Returns the byte offset of the beginning of a member with respect to the beginning of the compound data type datum. More...
 
H5std_string getMemberName (unsigned member_num) const
 Returns the name of a member in this compound datatype. More...
 
DataType getMemberDataType (unsigned member_num) const
 Returns the generic datatype of the specified member in this compound datatype. More...
 
ArrayType getMemberArrayType (unsigned member_num) const
 Returns the array datatype of the specified member in this compound datatype. More...
 
CompType getMemberCompType (unsigned member_num) const
 Returns the compound datatype of the specified member in this compound datatype. More...
 
EnumType getMemberEnumType (unsigned member_num) const
 Returns the enumeration datatype of the specified member in this compound datatype. More...
 
IntType getMemberIntType (unsigned member_num) const
 Returns the integer datatype of the specified member in this compound datatype. More...
 
FloatType getMemberFloatType (unsigned member_num) const
 Returns the floating-point datatype of the specified member in this compound datatype. More...
 
StrType getMemberStrType (unsigned member_num) const
 Returns the string datatype of the specified member in this compound datatype. More...
 
VarLenType getMemberVarLenType (unsigned member_num) const
 Returns the variable length datatype of the specified member in this compound datatype. More...
 
int getNmembers () const
 Returns the number of members in this compound datatype. More...
 
void insertMember (const H5std_string &name, size_t offset, const DataType &new_member) const
 Inserts a new member to this compound datatype. More...
 
void pack () const
 Recursively removes padding from within a compound datatype. More...
 
void setSize (size_t size) const
 Sets the total size for this compound datatype. More...
 
virtual H5std_string fromClass () const
 Returns this class name. More...
 
virtual ~CompType ()
 Properly terminates access to this compound datatype. More...
 
- Public Member Functions inherited from H5::DataType
 DataType (const H5T_class_t type_class, size_t size)
 Creates a object given its class and size. More...
 
 DataType (const DataType &original)
 Copy constructor: makes a copy of the original DataType object. More...
 
 DataType (const PredType &pred_type)
 Creates a DataType instance using a predefined type. More...
 
 DataType (const H5Location &loc, const char *name)
 Creates a DataType instance by opening an HDF5 datatype given its name as a char*. More...
 
 DataType (const H5Location &loc, const H5std_string &name)
 Creates a DataType instance by opening an HDF5 datatype given its name as an H5std_string. More...
 
 DataType (const H5Location &loc, const void *ref, H5R_type_t ref_type=H5R_OBJECT)
 Given a reference, ref, to an hdf5 group, creates a DataType object. More...
 
 DataType (const Attribute &attr, const void *ref, H5R_type_t ref_type=H5R_OBJECT)
 Given a reference, ref, to an hdf5 group, creates a DataType object. More...
 
virtual void close ()
 Closes the datatype if it is not a predefined type. More...
 
void copy (const DataType &like_type)
 Copies an existing datatype to this datatype object. More...
 
void copy (const DataSet &dset)
 Copies the datatype of the given dataset to this datatype object. More...
 
void encode ()
 Creates a binary object description of this datatype.

Exceptions
H5::DataTypeIException.
More...
 
H5T_class_t getClass () const
 Returns the datatype class identifier. More...
 
void commit (const H5Location &loc, const char *name)
 Commits a transient datatype to a file, creating a new named datatype. More...
 
void commit (const H5Location &loc, const H5std_string &name)
 This is an overloaded member function, provided for convenience. It differs from the above function only in the type of the argument name. More...
 
bool committed () const
 Determines whether a datatype is a named type or a transient type. More...
 
H5T_conv_t find (const DataType &dest, H5T_cdata_t **pcdata) const
 Finds a conversion function that can handle a conversion from this datatype to the specified datatype, dest. More...
 
void convert (const DataType &dest, size_t nelmts, void *buf, void *background, const PropList &plist=PropList::DEFAULT) const
 Converts data from this datatype to the specified datatypes. More...
 
DataTypeoperator= (const DataType &rhs)
 Assignment operator. More...
 
bool operator== (const DataType &compared_type) const
 Compares this DataType against the given one to determines whether the two objects refer to the same actual datatype. More...
 
void lock () const
 Locks a datatype, making it read-only and non-destructible. More...
 
size_t getSize () const
 Returns the size of a datatype. More...
 
DataType getSuper () const
 Returns the base datatype from which a datatype is derived. More...
 
void registerFunc (H5T_pers_t pers, const char *name, const DataType &dest, H5T_conv_t func) const
 Registers the specified conversion function. More...
 
void registerFunc (H5T_pers_t pers, const H5std_string &name, const DataType &dest, H5T_conv_t func) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in the type of the argument name. More...
 
void unregister (H5T_pers_t pers, const char *name, const DataType &dest, H5T_conv_t func) const
 Removes a conversion function from all conversion paths. More...
 
void unregister (H5T_pers_t pers, const H5std_string &name, const DataType &dest, H5T_conv_t func) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in the type of the argument name. More...
 
void setTag (const char *tag) const
 Tags an opaque datatype. More...
 
void setTag (const H5std_string &tag) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in the type of the argument name. More...
 
H5std_string getTag () const
 Gets the tag associated with an opaque datatype. More...
 
bool detectClass (H5T_class_t cls) const
 Checks whether a datatype contains (or is) a certain type of datatype. More...
 
bool isVariableStr () const
 Check whether this datatype is a variable-length string. More...
 
PropList getCreatePlist () const
 Returns a copy of the property list, which is for datatype creation. More...
 
 DataType (const hid_t type_id)
 Creates a datatype using an existing datatype's id. More...
 
 DataType ()
 Default constructor: Creates a stub datatype. More...
 
bool hasBinaryDesc () const
 Determines whether this datatype has a binary object description.

Exceptions
H5::DataTypeIException.
More...
 
virtual hid_t getId () const
 Get the id of this datatype. More...
 
virtual ~DataType ()
 Properly terminates access to this datatype. More...
 
- Public Member Functions inherited from H5::H5Object
Attribute createAttribute (const char *name, const DataType &type, const DataSpace &space, const PropList &create_plist=PropList::DEFAULT) const
 Deprecated - replaced by H5Object::createAttribute. More...
 
Attribute createAttribute (const H5std_string &name, const DataType &type, const DataSpace &space, const PropList &create_plist=PropList::DEFAULT) const
 Deprecated - replaced by H5Object::createAttribute. More...
 
Attribute openAttribute (const char *name) const
 Deprecated - replaced by H5Object::openAttribute. More...
 
Attribute openAttribute (const H5std_string &name) const
 Deprecated - replaced by H5Object::openAttribute. More...
 
Attribute openAttribute (const unsigned int idx) const
 Deprecated - replaced by H5Object::openAttribute. More...
 
bool attrExists (const char *name) const
 Deprecated - replaced by H5Object::attrExists() More...
 
bool attrExists (const H5std_string &name) const
 Deprecated - replaced by H5Object::attrExists() More...
 
void renameAttr (const char *oldname, const char *newname) const
 Deprecated - replaced by H5Object::renameAttr() More...
 
void renameAttr (const H5std_string &oldname, const H5std_string &newname) const
 Deprecated - replaced by H5Object::renameAttr() More...
 
void removeAttr (const char *name) const
 Deprecated - replaced by H5Object::removeAttr() More...
 
void removeAttr (const H5std_string &name) const
 Deprecated - replaced by H5Object::removeAttr() More...
 
int getNumAttrs () const
 
ssize_t getObjName (char *obj_name, size_t buf_size=0) const
 
ssize_t getObjName (H5std_string &obj_name, size_t len=0) const
 
H5std_string getObjName () const
 
- Public Member Functions inherited from H5::H5Location
bool nameExists (const char *name, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 Checks if a link of a given name exists in a location. More...
 
bool nameExists (const H5std_string &name, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 Checks if a link of a given name exists in a location. More...
 
void flush (H5F_scope_t scope) const
 Flushes all buffers associated with a location to disk. More...
 
H5std_string getFileName () const
 Gets the name of the file, in which this HDF5 object belongs. More...
 
void getObjectInfo (H5O_info_t *oinfo) const
 Retrieve information about an object, specified by location.

Exceptions
H5::LocationException.
More...
 
void getObjectInfo (const char *name, H5O_info_t *oinfo, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 Retrieve information about an object, specified by name.

Exceptions
H5::LocationException.
More...
 
void getObjectInfo (const H5std_string &name, H5O_info_t *oinfo, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 Retrieve information about an object, specified by name.

Exceptions
H5::LocationException.
More...
 
int getNumAttrs () const
 Deprecated - replaced by H5Object::getNumAttrs() More...
 
H5G_obj_t getObjType (void *ref, H5R_type_t ref_type=H5R_OBJECT) const
 Retrieves the type of object that an object reference points to. More...
 
H5O_type_t getRefObjType (void *ref, H5R_type_t ref_type=H5R_OBJECT) const
 Retrieves the type of object that an object reference points to. More...
 
unsigned objVersion () const
 Returns the header version of this HDF5 object. More...
 
void setComment (const char *name, const char *comment) const
 Sets or resets the comment for an object specified by its name. More...
 
void setComment (const H5std_string &name, const H5std_string &comment) const
 This is an overloaded member function, provided for convenience. It differs from the above function in that it takes an H5std_string for name and comment. More...
 
void setComment (const char *comment) const
 This is an overloaded member function, provided for convenience. It differs from the above function in that it doesn't take an object name. More...
 
void setComment (const H5std_string &comment) const
 This is an overloaded member function, provided for convenience. It differs from the above function in that it takes an H5std_string for comment. More...
 
ssize_t getComment (const char *name, size_t buf_size, char *comment) const
 Retrieves the comment for this location, returning its length. More...
 
H5std_string getComment (const char *name, size_t buf_size=0) const
 Returns the comment as string for this location, returning its length. More...
 
H5std_string getComment (const H5std_string &name, size_t buf_size=0) const
 This is an overloaded member function, provided for convenience. It differs from the above function in that it takes an H5std_string for name. More...
 
void removeComment (const char *name) const
 Removes the comment from an object specified by its name. More...
 
void removeComment (const H5std_string &name) const
 This is an overloaded member function, provided for convenience. It differs from the above function in that it takes an H5std_string for name. More...
 
void reference (void *ref, const char *name, H5R_type_t ref_type=H5R_OBJECT) const
 This is an overloaded function, provided for your convenience. It differs from the above function in that it does not take a DataSpace object and the reference type must be specified. More...
 
void reference (void *ref, const H5std_string &name, H5R_type_t ref_type=H5R_OBJECT) const
 This is an overloaded function, provided for your convenience. It differs from the above function in that it takes an H5std_string for the object's name. More...
 
void reference (void *ref, const char *name, const DataSpace &dataspace, H5R_type_t ref_type=H5R_DATASET_REGION) const
 Creates a reference to an HDF5 object or a dataset region. More...
 
void reference (void *ref, const H5std_string &name, const DataSpace &dataspace, H5R_type_t ref_type=H5R_DATASET_REGION) const
 This is an overloaded member function, provided for convenience. It differs from the above function in that it takes an H5std_string for name. More...
 
void dereference (const H5Location &loc, const void *ref, H5R_type_t ref_type=H5R_OBJECT)
 Dereferences a reference into an HDF5 object, given an HDF5 object. More...
 
void dereference (const Attribute &attr, const void *ref, H5R_type_t ref_type=H5R_OBJECT)
 Dereferences a reference into an HDF5 object, given an attribute. More...
 
DataSpace getRegion (void *ref, H5R_type_t ref_type=H5R_DATASET_REGION) const
 Retrieves a dataspace with the region pointed to selected. More...
 
hid_t openObjId (const char *name, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 Opens an object without knowing the object type. More...
 
hid_t openObjId (const H5std_string &name, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 This is an overloaded member function, provided for convenience. It takes a reference to a H5std_string for the object's path. More...
 
void closeObjId (hid_t obj_id) const
 Closes an object, which was opened with H5Location::openObjId. More...
 
virtual int iterateAttrs (attr_operator_t user_op, unsigned *idx=NULL, void *op_data=NULL)
 Iterates a user's function over all the attributes of an H5 object, which may be a group, dataset or named datatype. More...
 
- Public Member Functions inherited from H5::IdComponent
void incRefCount (const hid_t obj_id) const
 Increment reference counter for a given id. More...
 
void incRefCount () const
 Increment reference counter for the id of this object. More...
 
void decRefCount (const hid_t obj_id) const
 Decrement reference counter for a given id. More...
 
void decRefCount () const
 Decrement reference counter for the id of this object. More...
 
int getCounter (const hid_t obj_id) const
 Returns the reference counter for a given id. More...
 
int getCounter () const
 Returns the reference counter for the id of this object. More...
 
H5I_type_t getHDFObjType () const
 Returns the type of the object. It is an overloaded function of the above function. More...
 
IdComponentoperator= (const IdComponent &rhs)
 Assignment operator. More...
 
void setId (const hid_t new_id)
 Sets the identifier of this object to a new value. More...
 
virtual ~IdComponent ()
 Noop destructor. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from H5::IdComponent
static H5I_type_t getHDFObjType (const hid_t obj_id)
 Given an id, returns the type of the object. More...
 
static bool isValid (hid_t an_id)
 Checks if the given ID is valid. More...
 
- Protected Member Functions inherited from H5::H5Location
virtual ~H5Location ()
 Noop destructor. More...
 

Detailed Description

Examples:
compound.cpp.

Constructor & Destructor Documentation

H5::CompType::CompType ( )

Referenced by decode().

H5::CompType::CompType ( const hid_t  existing_id)
Parameters
existing_id- IN: Id of an existing compound datatype
H5::CompType::CompType ( size_t  size)
Parameters
size- IN: Number of bytes in the datatype to create
Exceptions
H5::DataTypeIException
H5::CompType::CompType ( const DataSet dataset)
Parameters
dataset- IN: Dataset that this enum datatype associates with
Returns
CompType instance
Exceptions
H5::DataTypeIException

References H5::DataSet::getId().

H5::CompType::CompType ( const CompType original)
Parameters
original- IN: Original CompType instance
H5::CompType::CompType ( const H5Location loc,
const char *  type_name 
)
Parameters
loc- IN: Location of the type
type_name- IN: Compound type name
Exceptions
H5::DataTypeIException
H5::CompType::CompType ( const H5Location loc,
const H5std_string &  type_name 
)
Parameters
loc- IN: Location of the type
type_name- IN: Compound type name
Exceptions
H5::DataTypeIException
H5::CompType::~CompType ( )
virtual

Member Function Documentation

DataType * H5::CompType::decode ( ) const
virtual

Reimplemented from H5::DataType.

References CompType().

virtual H5std_string H5::CompType::fromClass ( ) const
inlinevirtual

Reimplemented from H5::DataType.

ArrayType H5::CompType::getMemberArrayType ( unsigned  member_num) const
Parameters
member_num- IN: Zero-based index of the member
Returns
ArrayType instance
Exceptions
H5::DataTypeIException

References H5::DataType::f_DataType_setId, and H5::Exception::getDetailMsg().

H5T_class_t H5::CompType::getMemberClass ( unsigned  member_num) const
Parameters
member_num- IN: Zero-based index of the member
Returns
Type class of the member
Exceptions
H5::DataTypeIException
CompType H5::CompType::getMemberCompType ( unsigned  member_num) const
Parameters
member_num- IN: Zero-based index of the member
Returns
CompType instance
Exceptions
H5::DataTypeIException

References H5::DataType::f_DataType_setId, and H5::Exception::getDetailMsg().

DataType H5::CompType::getMemberDataType ( unsigned  member_num) const
Parameters
member_num- IN: Zero-based index of the member
Returns
DataType instance
Exceptions
H5::DataTypeIException

References H5::DataType::f_DataType_setId, and H5::Exception::getDetailMsg().

EnumType H5::CompType::getMemberEnumType ( unsigned  member_num) const
Parameters
member_num- IN: Zero-based index of the member
Returns
EnumType instance
Exceptions
H5::DataTypeIException

References H5::DataType::f_DataType_setId, and H5::Exception::getDetailMsg().

FloatType H5::CompType::getMemberFloatType ( unsigned  member_num) const
Parameters
member_num- IN: Zero-based index of the member
Returns
FloatType instance
Exceptions
H5::DataTypeIException

References H5::DataType::f_DataType_setId, and H5::Exception::getDetailMsg().

int H5::CompType::getMemberIndex ( const char *  name) const
Parameters
name- IN: Name of the member
Returns
Index of member
Exceptions
H5::DataTypeIException
Description
Members are stored in no particular order with numbers 0 through N-1, where N is the value returned by the member function CompType::getNmembers.

Referenced by getMemberIndex().

int H5::CompType::getMemberIndex ( const H5std_string &  name) const

References getMemberIndex().

IntType H5::CompType::getMemberIntType ( unsigned  member_num) const
Parameters
member_num- IN: Zero-based index of the member
Returns
IntType instance
Exceptions
H5::DataTypeIException

References H5::DataType::f_DataType_setId, and H5::Exception::getDetailMsg().

H5std_string H5::CompType::getMemberName ( unsigned  member_num) const
Parameters
member_num- IN: Zero-based index of the member
Returns
Name of member
Exceptions
H5::DataTypeIException
size_t H5::CompType::getMemberOffset ( unsigned  member_num) const
Parameters
member_num- IN: Zero-based index of the member
Returns
Byte offset Members are stored in no particular order with numbers 0 through N-1, where N is the value returned by the member function CompType::getNmembers.
StrType H5::CompType::getMemberStrType ( unsigned  member_num) const
Parameters
member_num- IN: Zero-based index of the member
Returns
StrType instance
Exceptions
H5::DataTypeIException

References H5::DataType::f_DataType_setId, and H5::Exception::getDetailMsg().

VarLenType H5::CompType::getMemberVarLenType ( unsigned  member_num) const
Parameters
member_num- IN: Zero-based index of the member
Returns
VarLenType instance
Exceptions
H5::DataTypeIException

References H5::DataType::f_DataType_setId, and H5::Exception::getDetailMsg().

int H5::CompType::getNmembers ( ) const
Returns
Number of members
Exceptions
H5::DataTypeIException
void H5::CompType::insertMember ( const H5std_string &  name,
size_t  offset,
const DataType new_member 
) const
Parameters
name- IN: Name of the new member
offset- IN: Offset in memory structure of the field to insert
new_member- IN: New member to be inserted
Exceptions
H5::DataTypeIException

References H5::DataType::getId().

void H5::CompType::pack ( ) const
void H5::CompType::setSize ( size_t  size) const
Parameters
size- IN: Size to set
Exceptions
H5::DataTypeIException

The documentation for this class was generated from the following files:


The HDF Group Help Desk:
  Copyright by The HDF Group
and the Board of Trustees of the University of Illinois