HDF5 C++ API Reference Manual

- Main Page
- Namespaces
- Classes
- Files
- Examples

- Class List
- Class Hierarchy
- Class Members

# H5::H5Object Class Reference

`#include <H5Object.h>`

Inheritance diagram for H5::H5Object:

List of all members.

## 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.
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.
Attribute | openAttribute (const char *name) const
| Opens an attribute given its name.
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.
Attribute | openAttribute (const unsigned int idx) const
| Opens an attribute given its index.
void | flush (H5F_scope_t scope) const
| Flushes all buffers associated with a file to disk.
H5std_string | getFileName () const
| Gets the name of the file, in which this HDF5 object belongs.
int | getNumAttrs () const
| Returns the number of attributes attached to this HDF5 object.
H5G_obj_t | getRefObjType (void *ref, H5R_type_t ref_type=H5R_OBJECT) const
| Retrieves the type of object that an object reference points to.
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.
void | removeAttr (const char *name) const
| Removes the named attribute from this object.
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.
void | renameAttr (const char *oldname, const char *newname) const
| Renames the named attribute from this object.
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.
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.
void | reference (void *ref, const H5std_string &name, const DataSpace &dataspace, H5R_type_t ref_type=H5R_DATASET_REGION) 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.
void | reference (void *ref, const char *name) const
| This is an overloaded function, provided for your convenience. It differs from the above function in that it only creates a reference to an HDF5 object, not to a dataset region.
void | reference (void *ref, const H5std_string &name) 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.
void | dereference (H5File &h5file, void *ref, H5R_type_t ref_type=H5R_OBJECT)
| Dereferences a reference into an HDF5 object, given an HDF5 file.
void | dereference (H5Object &obj, void *ref, H5R_type_t ref_type=H5R_OBJECT)
| Dereferences a reference into an HDF5 object, given an HDF5 object.
void | dereference (Attribute &attr, void *ref, H5R_type_t ref_type=H5R_OBJECT)
| Dereferences a reference into an HDF5 object, given an attribute.
| H5Object (const H5Object &original)
| Copy constructor: makes a copy of the original H5Object instance.
virtual | ~H5Object ()
| Noop destructor.

## Constructor & Destructor Documentation

H5::H5Object::H5Object | ( | const H5Object & | original | ) |

Copy constructor: makes a copy of the original H5Object instance.

Parameters:

  | original | - IN: H5Object instance to copy

H5::H5Object::~H5Object | ( |  | ) | `[virtual]`

Noop destructor.

## Member Function Documentation

Attribute H5::H5Object::createAttribute | ( | const char * | name,
|  | const DataType & | data_type,
|  | const DataSpace & | data_space,
|  | const PropList & | create_plist = `PropList::DEFAULT` |
| ) |  |  | const

Creates an attribute for a group, dataset, or named datatype.

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.

Attribute H5::H5Object::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.

Attribute H5::H5Object::openAttribute | ( | const char * | name | ) | const

Opens an attribute given its name.

Parameters:

  | name | - IN: Name of the attribute

Returns:
  Attribute instance

Exceptions:

  | H5::AttributeIException |

Attribute H5::H5Object::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.

Attribute H5::H5Object::openAttribute | ( | const unsigned int | idx | ) | const

Opens an attribute given its index.

Parameters:

  | idx | - IN: Index of the attribute, a 0-based, non-negative integer

Returns:
  Attribute instance

Exceptions:

  | H5::AttributeIException |

void H5::H5Object::flush | ( | H5F_scope_t | scope | ) | const

Flushes all buffers associated with a file to disk.

Parameters:

  | scope | - IN: Specifies the scope of the flushing action, which can be either of these values: `H5F_SCOPE_GLOBAL` - Flushes the entire virtual file `H5F_SCOPE_LOCAL` - Flushes only the specified file

Exceptions:

  | H5::AttributeIException |

Description
  This object is used to identify the file to be flushed.

H5std_string H5::H5Object::getFileName | ( |  | ) | const

Gets the name of the file, in which this HDF5 object belongs.

Returns:
  File name

Exceptions:

  | H5::IdComponentException |

int H5::H5Object::getNumAttrs | ( |  | ) | const

Returns the number of attributes attached to this HDF5 object.

Returns:
  Number of attributes

Exceptions:

  | H5::AttributeIException |

H5G_obj_t H5::H5Object::getRefObjType | ( | void * | ref,
|  | H5R_type_t | ref_type = `H5R_OBJECT` |
| ) |  |  | const

Retrieves the type of object that an object reference points to.

Parameters:

  | ref | - IN: Reference to query
  | ref_type | - IN: Type of reference to query, valid values are: `H5R_OBJECT` is an object reference. `H5R_DATASET_REGION` is a dataset region reference.

Returns:
  An object type, which can be one of the following:
  - `H5G_LINK` (0) is a symbolic link.
  - `H5G_GROUP` (1) is a group.
  - `H5G_DATASET` (2) is a dataset.
  - `H5G_TYPE` Object (3) a named datatype

Exceptions:

  | H5::IdComponentException |

int H5::H5Object::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.

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
  For information, please refer to the C layer Reference Manual at: ../RM_H5A.html::Annot-Iterate

void H5::H5Object::removeAttr | ( | const char * | name | ) | const

Removes the named attribute from this object.

Parameters:

  | name | - IN: Name of the attribute to be removed

Exceptions:

  | H5::AttributeIException |

void H5::H5Object::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.

void H5::H5Object::renameAttr | ( | const char * | oldname,
|  | const char * | newname |
| ) |  |  | const

Renames the named attribute from this object.

Parameters:

  | oldname | - IN: Name of the attribute to be renamed
  | newname | - IN: New name ame of the attribute

Exceptions:

  | H5::AttributeIException |

void H5::H5Object::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.

void H5::H5Object::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.

Parameters:

  | ref | - IN: Reference pointer
  | name | - IN: Name of the object to be referenced
  | dataspace | - IN: Dataspace with selection
  | ref_type | - IN: Type of reference to query, valid values are: `H5R_OBJECT` is an object reference. `H5R_DATASET_REGION` is a dataset region reference. - this is the default

Exceptions:

  | H5::IdComponentException |

void H5::H5Object::reference | ( | void * | ref,
|  | const H5std_string & | name,
|  | const DataSpace & | dataspace,
|  | H5R_type_t | ref_type = `H5R_DATASET_REGION` |
| ) |  |  | 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.

Parameters:

  | ref | - IN: Reference pointer
  | name | - IN: Name of the object to be referenced
  | dataspace | - IN: Dataspace with selection
  | ref_type | - IN: Type of reference to query, valid values are: `H5R_OBJECT` is an object reference. `H5R_DATASET_REGION` is a dataset region reference. - this is the default

Exceptions:

  | H5::IdComponentException |

void H5::H5Object::reference | ( | void * | ref,
|  | const char * | name |
| ) |  |  | const

This is an overloaded function, provided for your convenience. It differs from the above function in that it only creates a reference to an HDF5 object, not to a dataset region.

Parameters:

  | ref | - IN: Reference pointer
  | name | - IN: Name of the object to be referenced - `char` pointer

Exceptions:

  | H5::IdComponentException |

Description

void H5::H5Object::reference | ( | void * | ref,
|  | const H5std_string & | name |
| ) |  |  | 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.

Parameters:

  | ref | - IN: Reference pointer
  | name | - IN: Name of the object to be referenced - `H5std_string`

void H5::H5Object::dereference | ( | H5File & | h5file,
|  | void * | ref,
|  | H5R_type_t | ref_type = `H5R_OBJECT` |
| ) |  |  |

Dereferences a reference into an HDF5 object, given an HDF5 file.

Parameters:

  | h5file | - IN: HDF5 file specifying the location of the referenced object
  | ref | - IN: Reference pointer
  | ref_type | - IN: Reference type

Exceptions:

  | H5::ReferenceException |

void H5::H5Object::dereference | ( | H5Object & | obj,
|  | void * | ref,
|  | H5R_type_t | ref_type = `H5R_OBJECT` |
| ) |  |  |

Dereferences a reference into an HDF5 object, given an HDF5 object.

Parameters:

  | obj | - IN: Object specifying the location of the referenced object
  | ref | - IN: Reference pointer
  | ref_type | - IN: Reference type

Exceptions:

  | H5::ReferenceException |

void H5::H5Object::dereference | ( | Attribute & | attr,
|  | void * | ref,
|  | H5R_type_t | ref_type = `H5R_OBJECT` |
| ) |  |  |

Dereferences a reference into an HDF5 object, given an attribute.

Parameters:

  | attr | - IN: Attribute specifying the location of the referenced object
  | ref | - IN: Reference pointer
  | ref_type | - IN: Reference type

Exceptions:

  | H5::ReferenceException |