HDF5 C++ API Reference Manual

- Main Page
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

# H5Attribute.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 _H5Attribute_H
    00018 #define _H5Attribute_H
    00019
    00020 #ifndef H5_NO_NAMESPACE
    00021 namespace H5 {
    00022 #endif
    00023
    00024 class H5_DLLCPP Attribute : public AbstractDs, public IdComponent {
    00025    public:
    00026         // Closes this attribute.
    00027         virtual void close();
    00028
    00029         // Gets the name of the file, in which this attribute belongs.
    00030         H5std_string getFileName() const;
    00031
    00032         // Gets the name of this attribute.
    00033         ssize_t getName( size_t buf_size, H5std_string& attr_name ) const;
    00034         H5std_string getName( size_t buf_size ) const; // returns name, not its length
    00035         H5std_string getName() const; // returns name, no argument
    00036
    00037         // Gets a copy of the dataspace for this attribute.
    00038         virtual DataSpace getSpace() const;
    00039
    00040         // Returns the amount of storage size required for this attribute.
    00041         virtual hsize_t getStorageSize() const;
    00042
    00043         // Returns the in memory size of this attribute's data.
    00044         virtual size_t getInMemDataSize() const;
    00045
    00046         // Reads data from this attribute.
    00047         void read( const DataType& mem_type, void *buf ) const;
    00048         void read( const DataType& mem_type, H5std_string& strg ) const;
    00049
    00050         // Writes data to this attribute.
    00051         void write(const DataType& mem_type, const void *buf ) const;
    00052         void write(const DataType& mem_type, const H5std_string& strg ) const;
    00053
    00054         // Retrieves the type of object that an object reference points to.
    00055         H5G_obj_t getRefObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
    00056
    00057         // Deprecated in favor of getRefObjType.
    00058         H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
    00059
    00060         // Returns this class name
    00061         virtual H5std_string fromClass () const { return("Attribute"); }
    00062
    00063         // Creates a copy of an existing attribute using the attribute id
    00064         Attribute( const hid_t attr_id );
    00065
    00066         // Copy constructor: makes a copy of an existing Attribute object.
    00067         Attribute( const Attribute& original );
    00068
    00069         // Default constructor
    00070         Attribute();
    00071
    00072         // Gets the attribute id.
    00073         virtual hid_t getId() const;
    00074
    00075         // Destructor: properly terminates access to this attribute.
    00076         virtual ~Attribute();
    00077
    00078    protected:
    00079         // Sets the attribute id.
    00080         virtual void p_setId(const hid_t new_id);
    00081
    00082    private:
    00083         hid_t id;       // HDF5 attribute id
    00084
    00085         // This function contains the common code that is used by
    00086         // getTypeClass and various API functions getXxxType
    00087         // defined in AbstractDs for generic datatype and specific
    00088         // sub-types
    00089         virtual hid_t p_get_type() const;
    00090
    00091         // Reads variable or fixed len strings from this attribute.
    00092         void p_read_variable_len(const hid_t mem_type_id, H5std_string& strg) const;
    00093         void p_read_fixed_len(const hid_t mem_type_id, H5std_string& strg) const;
    00094
    00095         // do not inherit H5Object::iterateAttrs
    00096         int iterateAttrs() { return 0; }
    00097
    00098         // do not inherit H5Object::renameAttr
    00099         void renameAttr() {}
    00100 };
    00101 #ifndef H5_NO_NAMESPACE
    00102 }
    00103 #endif
    00104 #endif