All Classes Namespaces Functions Variables Typedefs Friends Pages
Public Member Functions | List of all members
H5::H5Object Class Referenceabstract

Class H5Object is a bridge between H5Location and DataSet, DataType, and Group. More...

#include <H5Object.h>

Inheritance diagram for H5::H5Object:
H5::H5Location H5::IdComponent H5::DataSet H5::DataType H5::Group H5::ArrayType H5::AtomType H5::CompType H5::EnumType H5::VarLenType H5::H5File H5::FloatType H5::IntType H5::PredType H5::StrType

Public Member Functions

Attribute createAttribute (const char *name, const DataType &type, const DataSpace &space, const PropList &create_plist=PropList::DEFAULT) const
 Creates an attribute for a group, dataset, or named datatype. More...
 
Attribute createAttribute (const H5std_string &name, const DataType &type, const DataSpace &space, const PropList &create_plist=PropList::DEFAULT) const
 This is an overloaded member function, provided for convenience. It differs from the above function in that it takes a reference to an H5std_string for name. More...
 
Attribute openAttribute (const char *name) const
 Opens an attribute given its name. More...
 
Attribute openAttribute (const H5std_string &name) const
 This is an overloaded member function, provided for convenience. It differs from the above function in that it takes a reference to an H5std_string for name. More...
 
Attribute openAttribute (const unsigned int idx) const
 Opens an attribute given its index. More...
 
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...
 
void visit (H5_index_t idx_type, H5_iter_order_t order, visit_operator_t user_op, void *op_data, unsigned int fields)
 Recursively visits all HDF5 objects accessible from this object. More...
 
unsigned objVersion () const
 Returns the header version of this HDF5 object. More...
 
int getNumAttrs () const
 Returns the number of attributes attached to this HDF5 object. More...
 
bool attrExists (const char *name) const
 Checks whether the named attribute exists at this location. More...
 
bool attrExists (const H5std_string &name) const
 This is an overloaded member function, provided for convenience. It differs from the above function in that it takes a reference to an H5std_string for name. More...
 
void renameAttr (const char *oldname, const char *newname) const
 Renames the named attribute from this object. More...
 
void renameAttr (const H5std_string &oldname, const H5std_string &newname) const
 This is an overloaded member function, provided for convenience. It differs from the above function in that it takes a reference to an H5std_string for the names. More...
 
void removeAttr (const char *name) const
 Removes the named attribute from this object. More...
 
void removeAttr (const H5std_string &name) const
 This is an overloaded member function, provided for convenience. It differs from the above function in that it takes a reference to an H5std_string for name. More...
 
virtual hid_t getId () const =0
 
ssize_t getObjName (char *obj_name, size_t buf_size=0) const
 Given an id, returns the type of the object. More...
 
ssize_t getObjName (H5std_string &obj_name, size_t len=0) const
 Gets the name of this object, returning its length. More...
 
H5std_string getObjName () const
 Returns the name of this object as an H5std_string. More...
 
- 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...
 
bool exists (const char *name, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 Deprecated in favor of nameExists. More...
 
bool exists (const H5std_string &name, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 Deprecated in favor of nameExists. 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 an HDF5 object at this location belongs. 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...
 
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, const PropList &plist=PropList::DEFAULT)
 Dereferences a reference into an HDF5 object, given an HDF5 object. More...
 
DataSpace getRegion (void *ref, H5R_type_t ref_type=H5R_DATASET_REGION) const
 
Group createGroup (const char *name, const LinkCreatPropList &lcpl) const
 
Group createGroup (const H5std_string &name, const LinkCreatPropList &lcpl) const
 
Group createGroup (const char *name, size_t size_hint=0) const
 
Group createGroup (const H5std_string &name, size_t size_hint=0) const
 
Group openGroup (const char *name) const
 
Group openGroup (const H5std_string &name) const
 
DataSet createDataSet (const char *name, const DataType &data_type, const DataSpace &data_space, const DSetCreatPropList &create_plist=DSetCreatPropList::DEFAULT, const DSetAccPropList &dapl=DSetAccPropList::DEFAULT, const LinkCreatPropList &lcpl=LinkCreatPropList::DEFAULT) const
 
DataSet createDataSet (const H5std_string &name, const DataType &data_type, const DataSpace &data_space, const DSetCreatPropList &create_plist=DSetCreatPropList::DEFAULT, const DSetAccPropList &dapl=DSetAccPropList::DEFAULT, const LinkCreatPropList &lcpl=LinkCreatPropList::DEFAULT) const
 
DataSet openDataSet (const char *name, const DSetAccPropList &dapl=DSetAccPropList::DEFAULT) const
 
DataSet openDataSet (const H5std_string &name, const DSetAccPropList &dapl=DSetAccPropList::DEFAULT) const
 
H5L_info2_t getLinkInfo (const char *link_name, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 
H5L_info2_t getLinkInfo (const H5std_string &link_name, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 
H5std_string getLinkval (const char *link_name, size_t size=0) const
 
H5std_string getLinkval (const H5std_string &link_name, size_t size=0) const
 
hsize_t getNumObjs () const
 
H5std_string getObjnameByIdx (hsize_t idx) const
 
ssize_t getObjnameByIdx (hsize_t idx, char *name, size_t size) const
 
ssize_t getObjnameByIdx (hsize_t idx, H5std_string &name, size_t size) const
 
H5O_type_t childObjType (const H5std_string &objname) const
 
H5O_type_t childObjType (const char *objname) const
 
H5O_type_t childObjType (hsize_t index, H5_index_t index_type=H5_INDEX_NAME, H5_iter_order_t order=H5_ITER_INC, const char *objname=".") const
 
unsigned childObjVersion (const char *objname) const
 
unsigned childObjVersion (const H5std_string &objname) const
 
void getObjinfo (H5O_info2_t &objinfo, unsigned fields=H5O_INFO_BASIC) const
 
void getObjinfo (const char *name, H5O_info2_t &objinfo, unsigned fields=H5O_INFO_BASIC, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 
void getObjinfo (const H5std_string &name, H5O_info2_t &objinfo, unsigned fields=H5O_INFO_BASIC, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 
void getObjinfo (const char *grp_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx, H5O_info2_t &objinfo, unsigned fields=H5O_INFO_BASIC, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 
void getObjinfo (const H5std_string &grp_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx, H5O_info2_t &objinfo, unsigned fields=H5O_INFO_BASIC, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 
void getNativeObjinfo (H5O_native_info_t &objinfo, unsigned fields=H5O_NATIVE_INFO_HDR) const
 
void getNativeObjinfo (const char *name, H5O_native_info_t &objinfo, unsigned fields=H5O_NATIVE_INFO_HDR, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 
void getNativeObjinfo (const H5std_string &name, H5O_native_info_t &objinfo, unsigned fields=H5O_NATIVE_INFO_HDR, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 
void getNativeObjinfo (const char *grp_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx, H5O_native_info_t &objinfo, unsigned fields=H5O_NATIVE_INFO_HDR, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 
void getNativeObjinfo (const H5std_string &grp_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx, H5O_native_info_t &objinfo, unsigned fields=H5O_NATIVE_INFO_HDR, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 
H5G_obj_t getObjTypeByIdx (hsize_t idx) const
 
H5G_obj_t getObjTypeByIdx (hsize_t idx, char *type_name) const
 
H5G_obj_t getObjTypeByIdx (hsize_t idx, H5std_string &type_name) const
 
void getObjinfo (const char *name, hbool_t follow_link, H5G_stat_t &statbuf) const
 
void getObjinfo (const H5std_string &name, hbool_t follow_link, H5G_stat_t &statbuf) const
 
void getObjinfo (const char *name, H5G_stat_t &statbuf) const
 
void getObjinfo (const H5std_string &name, H5G_stat_t &statbuf) const
 
int iterateElems (const char *name, int *idx, H5G_iterate_t op, void *op_data)
 
int iterateElems (const H5std_string &name, int *idx, H5G_iterate_t op, void *op_data)
 
void link (const char *target_name, const char *link_name, const LinkCreatPropList &lcpl=LinkCreatPropList::DEFAULT, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 
void link (const H5std_string &target_name, const H5std_string &link_name, const LinkCreatPropList &lcpl=LinkCreatPropList::DEFAULT, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 
void link (const char *curr_name, const Group &new_loc, const char *new_name, const LinkCreatPropList &lcpl=LinkCreatPropList::DEFAULT, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 
void link (const H5std_string &curr_name, const Group &new_loc, const H5std_string &new_name, const LinkCreatPropList &lcpl=LinkCreatPropList::DEFAULT, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 
void link (const char *curr_name, const hid_t same_loc, const char *new_name, const LinkCreatPropList &lcpl=LinkCreatPropList::DEFAULT, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 
void link (const H5std_string &curr_name, const hid_t same_loc, const H5std_string &new_name, const LinkCreatPropList &lcpl=LinkCreatPropList::DEFAULT, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 
void link (H5L_type_t link_type, const char *curr_name, const char *new_name) const
 
void link (H5L_type_t link_type, const H5std_string &curr_name, const H5std_string &new_name) const
 
void unlink (const char *link_name, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 
void unlink (const H5std_string &link_name, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 
void mount (const char *name, const H5File &child, const PropList &plist) const
 
void mount (const H5std_string &name, const H5File &child, const PropList &plist) const
 
void unmount (const char *name) const
 
void unmount (const H5std_string &name) const
 
void copyLink (const char *src_name, const Group &dst, const char *dst_name, const LinkCreatPropList &lcpl=LinkCreatPropList::DEFAULT, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 
void copyLink (const H5std_string &src_name, const Group &dst, const H5std_string &dst_name, const LinkCreatPropList &lcpl=LinkCreatPropList::DEFAULT, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 
void copyLink (const char *src_name, const char *dst_name, const LinkCreatPropList &lcpl=LinkCreatPropList::DEFAULT, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 
void copyLink (const H5std_string &src_name, const H5std_string &dst_name, const LinkCreatPropList &lcpl=LinkCreatPropList::DEFAULT, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 
void moveLink (const char *src_name, const Group &dst, const char *dst_name, const LinkCreatPropList &lcpl=LinkCreatPropList::DEFAULT, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 
void moveLink (const H5std_string &src_name, const Group &dst, const H5std_string &dst_name, const LinkCreatPropList &lcpl=LinkCreatPropList::DEFAULT, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 
void moveLink (const char *src_name, const char *dst_name, const LinkCreatPropList &lcpl=LinkCreatPropList::DEFAULT, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 
void moveLink (const H5std_string &src_name, const H5std_string &dst_name, const LinkCreatPropList &lcpl=LinkCreatPropList::DEFAULT, const LinkAccPropList &lapl=LinkAccPropList::DEFAULT) const
 
void move (const char *src, const char *dst) const
 
void move (const H5std_string &src, const H5std_string &dst) const
 
virtual void throwException (const H5std_string &func_name, const H5std_string &msg) const
 For subclasses, H5File and Group, to throw appropriate exception. More...
 
 H5Location ()
 
- 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 hsize_t getNumMembers (H5I_type_t type)
 Returns the number of members of the given type. More...
 
static bool isValid (hid_t an_id)
 Checks if the given ID is valid. More...
 
static bool typeExists (H5I_type_t type)
 Queries if a given type is currently registered with the library. More...
 
- Protected Member Functions inherited from H5::H5Location
virtual ~H5Location ()
 

Detailed Description

Modification: Sept 18, 2012: Added class H5Location in between IdComponent and H5Object. An H5File now inherits from H5Location. All HDF5 wrappers in H5Object are moved up to H5Location. H5Object is left mostly empty for future wrappers that are only for group, dataset, and named datatype. Note that the reason for adding H5Location instead of simply moving H5File to be under H5Object is H5File is not an HDF5 object, and renaming H5Object to H5Location will risk breaking user applications. -BMR Apr 2, 2014: Added wrapper getObjName for H5Iget_name Sep 21, 2016: Rearranging classes (HDFFV-9920) moved H5A wrappers back into H5Object. This way, C functions that takes attribute id can be in H5Location and those that cannot take attribute id can be in H5Object.

Member Function Documentation

bool H5::H5Object::attrExists ( const char *  name) const
Parameters
name- IN: Name of the attribute to be queried
Exceptions
H5::AttributeIException

References getId().

Referenced by attrExists().

bool H5::H5Object::attrExists ( const H5std_string &  name) const

References attrExists().

Attribute H5::H5Object::createAttribute ( const char *  name,
const DataType data_type,
const DataSpace data_space,
const PropList create_plist = PropList::DEFAULT 
) const
Parameters
name- IN: Name of the attribute
data_type- IN: Datatype for the attribute
data_space- IN: Dataspace for the attribute - only simple dataspaces are allowed at this time
create_plist- IN: Creation property list - default to PropList::DEFAULT
Returns
Attribute instance
Exceptions
H5::AttributeIException
Description
The attribute name specified in name must be unique. Attempting to create an attribute with the same name as an existing attribute will raise an exception, leaving the pre-existing attribute intact. To overwrite an existing attribute with a new attribute of the same name, first delete the existing one with H5Object::removeAttr, then recreate it with this function.

References getId(), H5::PropList::getId(), H5::DataSpace::getId(), and H5::DataType::getId().

Referenced by createAttribute().

Attribute H5::H5Object::createAttribute ( const H5std_string &  name,
const DataType type,
const DataSpace space,
const PropList create_plist = PropList::DEFAULT 
) const

References createAttribute().

virtual hid_t H5::H5Object::getId ( ) const
pure virtual
int H5::H5Object::getNumAttrs ( ) const
Returns
Number of attributes
Exceptions
H5::AttributeIException

References getId().

ssize_t H5::H5Object::getObjName ( char *  obj_name,
size_t  buf_size = 0 
) const
Returns
The name of the object

References getId().

ssize_t H5::H5Object::getObjName ( H5std_string &  obj_name,
size_t  len = 0 
) const
Parameters
obj_name- OUT: Buffer for the name string as H5std_string
len- IN: Desired length of the name, default to 0
Returns
Actual length of the object name
Exceptions
H5::Exception
Description
This function retrieves the object's name as an std string. buf_size can specify a specific length or default to 0, in which case the entire name will be retrieved.

References getObjName().

H5std_string H5::H5Object::getObjName ( ) const
Returns
Name of the object
Exceptions
H5::Exception

References getId().

Referenced by getObjName().

int H5::H5Object::iterateAttrs ( attr_operator_t  user_op,
unsigned *  _idx = NULL,
void *  op_data = NULL 
)
Parameters
user_op- IN: User's function to operate on each attribute
_idx- IN/OUT: Starting (IN) and ending (OUT) attribute indices
op_data- IN: User's data to pass to user's operator function
Returns
Returned value of the last operator if it was non-zero, or zero if all attributes were processed
Exceptions
H5::AttributeIException
Description
The signature of user_op is void (*)(H5::H5Location&, H5std_string, void*).

References getId(), H5::UserData4Aiterate::location, H5::UserData4Aiterate::op, and H5::UserData4Aiterate::opData.

unsigned H5::H5Object::objVersion ( ) const
Returns
Object version, which can have the following values:
  • H5O_VERSION_1
  • H5O_VERSION_2
Exceptions
H5::ObjHeaderIExceptionException will be thrown when:
  • an error returned by the C API
  • version number is not one of the valid values above

References getId().

Attribute H5::H5Object::openAttribute ( const char *  name) const
Parameters
name- IN: Name of the attribute
Returns
Attribute instance
Exceptions
H5::AttributeIException

References getId().

Referenced by openAttribute().

Attribute H5::H5Object::openAttribute ( const H5std_string &  name) const

References openAttribute().

Attribute H5::H5Object::openAttribute ( const unsigned int  idx) const
Parameters
idx- IN: Index of the attribute, a 0-based, non-negative integer
Returns
Attribute instance
Exceptions
H5::AttributeIException

References getId().

void H5::H5Object::removeAttr ( const char *  name) const
Parameters
name- IN: Name of the attribute to be removed
Exceptions
H5::AttributeIException

References getId().

Referenced by removeAttr().

void H5::H5Object::removeAttr ( const H5std_string &  name) const

References removeAttr().

void H5::H5Object::renameAttr ( const char *  oldname,
const char *  newname 
) const
Parameters
oldname- IN: Name of the attribute to be renamed
newname- IN: New name ame of the attribute
Exceptions
H5::AttributeIException

References getId().

Referenced by renameAttr().

void H5::H5Object::renameAttr ( const H5std_string &  oldname,
const H5std_string &  newname 
) const

References renameAttr().

void H5::H5Object::visit ( H5_index_t  idx_type,
H5_iter_order_t  order,
visit_operator_t  user_op,
void *  op_data,
unsigned int  fields 
)
Parameters
idx_type- IN: Type of index; valid values include:
  • H5_INDEX_NAME
  • H5_INDEX_CRT_ORDER
order- IN: Order in which index is traversed; valid values include:
  • H5_ITER_DEC
  • H5_ITER_INC
  • H5_ITER_NATIVE
user_op- IN: Callback function passing data regarding the object to the calling application
*op_data- IN: User-defined pointer to data required by the application for its processing of the object
fields- IN: Flags specifying the fields to be retrieved to the callback op via the H5O_info2_t argument.
  • H5O_INFO_BASIC fileno, addr, type, and rc fields
  • H5O_INFO_TIME atime, mtime, ctime, and btime fields
  • H5O_INFO_NUM_ATTRS num_attrs field
  • H5O_INFO_ALL H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS
Returns
  • On success:
  • the return value of the first operator that returns a positive value
  • zero if all members were processed with no operator returning non-zero
  • On failure:
  • an exception Exception will be thrown if something went wrong within the library or the operator failed
Exceptions
H5::Exception
Description
For information, please refer to the H5Ovisit3 API in the HDF5 C Reference Manual.

References getId(), H5::UserData4Visit::obj, H5::UserData4Visit::op, and H5::UserData4Visit::opData.


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