HDF5 C++ API Reference Manual

- Main Page
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

# H5Object.h

Go to the documentation of this file.

    00001 // C++ informative line for the emacs editor: -*- C++ -*-
    00002 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    00003  * Copyright by The HDF Group.                                               *
    00004  * Copyright by the Board of Trustees of the University of Illinois.         *
    00005  * All rights reserved.                                                      *
    00006  *                                                                           *
    00007  * This file is part of HDF5.  The full HDF5 copyright notice, including     *
    00008  * terms governing use, modification, and redistribution, is contained in    *
    00009  * the files COPYING and Copyright.html.  COPYING can be found at the root   *
    00010  * of the source code distribution tree; Copyright.html can be found at the  *
    00011  * root level of an installed copy of the electronic HDF5 document set and   *
    00012  * is linked from the top-level documents page.  It can also be found at     *
    00013  * http://hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have          *
    00014  * access to either file, you may request a copy from help@hdfgroup.org.     *
    00015  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    00016
    00017 #ifndef _H5Object_H
    00018 #define _H5Object_H
    00019
    00020 #include "H5Classes.h"          // constains forward class declarations
    00021
    00022 // H5Object is a baseclass.  It has these subclasses:
    00023 // Group, DataSet, and DataType.
    00024 // DataType, in turn, has several specific datatypes as subclasses.
    00025
    00026 #ifndef H5_NO_NAMESPACE
    00027 namespace H5 {
    00028 #endif
    00029
    00030 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00031 class H5_DLLCPP H5Object;  // forward declaration for UserData4Aiterate
    00032
    00033 // Define the operator function pointer for H5Aiterate().
    00034 typedef void (*attr_operator_t)( H5Object& loc/*in*/,
    00035                                  const H5std_string attr_name/*in*/,
    00036                                  void *operator_data/*in,out*/);
    00037
    00038 class UserData4Aiterate { // user data for attribute iteration
    00039    public:
    00040         attr_operator_t op;
    00041         void* opData;
    00042         H5Object* object;
    00043 };
    00044 #endif // DOXYGEN_SHOULD_SKIP_THIS
    00045
    00046 // The above part is being moved into Iterator, but not completed
    00047
    00048 class H5_DLLCPP H5Object : public IdComponent {
    00049    public:
    00050         // Creates an attribute for a group, dataset, or named datatype.
    00051         // PropList is currently not used, so always be default.
    00052         Attribute createAttribute( const char* name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT ) const;
    00053         Attribute createAttribute( const H5std_string& name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT ) const;
    00054
    00055         // Opens an attribute given its name.
    00056         Attribute openAttribute( const char* name ) const;
    00057         Attribute openAttribute( const H5std_string& name ) const;
    00058
    00059         // Opens an attribute given its index.
    00060         Attribute openAttribute( const unsigned int idx ) const;
    00061
    00062         // Flushes all buffers associated with this object to disk
    00063         void flush( H5F_scope_t scope ) const;
    00064
    00065         // Gets the name of the file, in which this HDF5 object belongs.
    00066         H5std_string getFileName() const;
    00067
    00068         // Determines the number of attributes attached to this object.
    00069         int getNumAttrs() const;
    00070
    00071         // Retrieves the type of object that an object reference points to.
    00072         H5G_obj_t getRefObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
    00073
    00074         // Iterate user's function over the attributes of this object
    00075         int iterateAttrs( attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL );
    00076
    00077         // Removes the named attribute from this object.
    00078         void removeAttr( const char* name ) const;
    00079         void removeAttr( const H5std_string& name ) const;
    00080
    00081         // Renames the attribute to a new name.
    00082         void renameAttr(const char* oldname, const char* newname) const;
    00083         void renameAttr(const H5std_string& oldname, const H5std_string& newname) const;
    00084
    00085         // Creates a reference to a dataset region in this object.
    00086         void reference(void* ref, const char* name, const DataSpace& dataspace,
    00087                 H5R_type_t ref_type = H5R_DATASET_REGION) const;
    00088         void reference(void* ref, const H5std_string& name, const DataSpace&
    00089                 dataspace, H5R_type_t ref_type = H5R_DATASET_REGION) const;
    00090
    00091         // Creates a reference to a named HDF5 object.
    00092         void reference(void* ref, const char* name) const;
    00093         void reference(void* ref, const H5std_string& name) const;
    00094
    00095         // Open a referenced HDF5 object.
    00096         void dereference(H5File& h5file, void* ref, H5R_type_t ref_type = H5R_OBJECT);
    00097         void dereference(H5Object& obj, void* ref, H5R_type_t ref_type = H5R_OBJECT);
    00098         void dereference(Attribute& attr, void* ref, H5R_type_t ref_type = H5R_OBJECT);
    00099
    00100         // Copy constructor: makes copy of an H5Object object.
    00101         H5Object(const H5Object& original);
    00102
    00103         // Noop destructor.
    00104         virtual ~H5Object();
    00105
    00106    protected:
    00107 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00108         // Default constructor
    00109         H5Object();
    00110
    00111         // Gets the id of the H5 file in which the given object is located.
    00112         hid_t p_get_file_id();
    00113
    00114         // Creates a reference to an HDF5 object or a dataset region.
    00115         void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const;
    00116
    00117         // Dereferences a ref into an hdf5 object.
    00118         hid_t p_dereference(hid_t loc_id, void* ref, H5R_type_t ref_type);
    00119
    00120         // Retrieves the type of object that an object reference points to.
    00121 //      H5G_obj_t p_get_refobj_type(void *ref, H5R_type_t ref_type) const;
    00122
    00123         // Retrieves a dataspace with the region pointed to selected.
    00124         hid_t p_get_region(void *ref, H5R_type_t ref_type) const;
    00125
    00126 #endif // DOXYGEN_SHOULD_SKIP_THIS
    00127
    00128 }; /* end class H5Object */
    00129
    00130 #ifndef H5_NO_NAMESPACE
    00131 }
    00132 #endif
    00133 #endif