HDF5 C++ API Reference Manual

 

 

 

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         unsigned int* idx;
00041         attr_operator_t op;
00042         void* opData;
00043         H5Object* object;
00044 };
00045 #endif // DOXYGEN_SHOULD_SKIP_THIS
00046 
00047 // The above part is being moved into Iterator, but not completed
00048 
00049 class H5_DLLCPP H5Object : public IdComponent {
00050    public:
00051         // Creates an attribute for a group, dataset, or named datatype.
00052         // PropList is currently not used, so always be default.
00053         Attribute createAttribute( const char* name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT ) const;
00054         Attribute createAttribute( const H5std_string& name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT ) const;
00055 
00056         // Opens an attribute given its name.
00057         Attribute openAttribute( const char* name ) const;
00058         Attribute openAttribute( const H5std_string& name ) const;
00059 
00060         // Opens an attribute given its index.
00061         Attribute openAttribute( const unsigned int idx ) const;
00062 
00063         // Flushes all buffers associated with this object to disk
00064         void flush( H5F_scope_t scope ) const;
00065 
00066         // Gets the name of the file, in which this HDF5 object belongs.
00067         H5std_string getFileName() const;
00068 
00069         // Determines the number of attributes attached to this object.
00070         int getNumAttrs() const;
00071 
00072         // Retrieves the type of object that an object reference points to.
00073         H5G_obj_t getRefObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
00074 
00075         // Iterate user's function over the attributes of this object
00076         int iterateAttrs( attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL );
00077 
00078         // Removes the named attribute from this object.
00079         void removeAttr( const char* name ) const;
00080         void removeAttr( const H5std_string& name ) const;
00081 
00082         // Renames the attribute to a new name.
00083         void renameAttr(const char* oldname, const char* newname) const;
00084         void renameAttr(const H5std_string& oldname, const H5std_string& newname) const;
00085 
00086         // Creates a reference to a dataset region in this object.
00087         void reference(void* ref, const char* name, const DataSpace& dataspace,
00088                 H5R_type_t ref_type = H5R_DATASET_REGION) const;
00089         void reference(void* ref, const H5std_string& name, const DataSpace& 
00090                 dataspace, H5R_type_t ref_type = H5R_DATASET_REGION) const;
00091 
00092         // Creates a reference to a named HDF5 object.
00093         void reference(void* ref, const char* name) const;
00094         void reference(void* ref, const H5std_string& name) const;
00095 
00096         // Open a referenced HDF5 object.
00097         void dereference(H5File& h5file, void* ref, H5R_type_t ref_type = H5R_OBJECT);
00098         void dereference(H5Object& obj, void* ref, H5R_type_t ref_type = H5R_OBJECT);
00099         void dereference(Attribute& attr, void* ref, H5R_type_t ref_type = H5R_OBJECT);
00100 
00101         // Copy constructor: makes copy of an H5Object object.
00102         H5Object(const H5Object& original);
00103 
00104         // Noop destructor.
00105         virtual ~H5Object();
00106 
00107    protected:
00108 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00109         // Default constructor
00110         H5Object();
00111 
00112         // Gets the id of the H5 file in which the given object is located.
00113         hid_t p_get_file_id();
00114 
00115         // Creates a reference to an HDF5 object or a dataset region.
00116         void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const;
00117 
00118         // Dereferences a ref into an hdf5 object.
00119         hid_t p_dereference(hid_t loc_id, void* ref, H5R_type_t ref_type);
00120 
00121         // Retrieves the type of object that an object reference points to.
00122 //      H5G_obj_t p_get_refobj_type(void *ref, H5R_type_t ref_type) const;
00123 
00124         // Retrieves a dataspace with the region pointed to selected.
00125         hid_t p_get_region(void *ref, H5R_type_t ref_type) const;
00126 
00127 #endif // DOXYGEN_SHOULD_SKIP_THIS
00128 
00129 }; /* end class H5Object */
00130 
00131 #ifndef H5_NO_NAMESPACE
00132 }
00133 #endif
00134 #endif

Generated on Mon Jun 1 07:53:28 2009 by  doxygen 1.4.7