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 [email protected].     *
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         // Iterate user's function over the attributes of this object
00072         int iterateAttrs( attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL );
00073 
00074         // Removes the named attribute from this object.
00075         void removeAttr( const char* name ) const;
00076         void removeAttr( const H5std_string& name ) const;
00077 
00078         // Renames the attribute to a new name.
00079         void renameAttr(const char* oldname, const char* newname) const;
00080         void renameAttr(const H5std_string& oldname, const H5std_string& newname) const;
00081 
00082         // Creates a reference to a named Hdf5 object or to a dataset region
00083         // in this object.
00084         void reference(void* ref, const char* name, const DataSpace& dataspace,
00085                         H5R_type_t ref_type = H5R_DATASET_REGION) const;
00086         void reference(void* ref, const char* name) const;
00087         void reference(void* ref, const H5std_string& name) const;
00088 
00089         // Open a referenced HDF5 object whose location is specified by either
00090         // a file, an HDF5 object, or an attribute.
00091         void dereference(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
00092         void dereference(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
00093         void dereference(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
00094 
00095         // Copy constructor: makes copy of an H5Object object.
00096         H5Object(const H5Object& original);
00097 
00098         // Noop destructor.
00099         virtual ~H5Object();
00100 
00101    protected:
00102 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00103         // Default constructor
00104         H5Object();
00105 
00106         // Creates a copy of an existing object giving the object id
00107         H5Object( const hid_t object_id );
00108 
00109         // Gets the id of the H5 file in which the given object is located.
00110         hid_t p_get_file_id();
00111 
00112         // Creates a reference to an HDF5 object or a dataset region.
00113         void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const;
00114 
00115         // Dereferences a ref into an hdf5 id.
00116         hid_t p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type);
00117 
00118 #ifndef H5_NO_DEPRECATED_SYMBOLS
00119         // Retrieves the type of object that an object reference points to.
00120         H5G_obj_t p_get_obj_type(void *ref, H5R_type_t ref_type) const;
00121 #endif /* H5_NO_DEPRECATED_SYMBOLS */
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

Generated on Tue May 10 09:27:56 2011 by  doxygen 1.4.7