HDF5 C++ API  1.8.12
 All Classes Namespaces Files Functions Variables Typedefs Macros Pages
H5Attribute.h
Go to the documentation of this file.
1 // C++ informative line for the emacs editor: -*- C++ -*-
2 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3  * Copyright by The HDF Group. *
4  * Copyright by the Board of Trustees of the University of Illinois. *
5  * All rights reserved. *
6  * *
7  * This file is part of HDF5. The full HDF5 copyright notice, including *
8  * terms governing use, modification, and redistribution, is contained in *
9  * the files COPYING and Copyright.html. COPYING can be found at the root *
10  * of the source code distribution tree; Copyright.html can be found at the *
11  * root level of an installed copy of the electronic HDF5 document set and *
12  * is linked from the top-level documents page. It can also be found at *
13  * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
14  * access to either file, you may request a copy from help@hdfgroup.org. *
15  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
16 
17 #ifndef __H5Attribute_H
18 #define __H5Attribute_H
19 
20 #ifndef H5_NO_NAMESPACE
21 namespace H5 {
22 #endif
23 
32 class H5_DLLCPP Attribute : public AbstractDs, public IdComponent {
33  public:
34  // Closes this attribute.
35  virtual void close();
36 
37  // Gets the name of the file, in which this attribute belongs.
38  H5std_string getFileName() const;
39 
40  // Gets the name of this attribute.
41  ssize_t getName( size_t buf_size, H5std_string& attr_name ) const;
42  H5std_string getName( size_t buf_size ) const; // returns name, not its length
43  H5std_string getName() const; // returns name, no argument
44 
45  // Gets a copy of the dataspace for this attribute.
46  virtual DataSpace getSpace() const;
47 
48  // Returns the amount of storage size required for this attribute.
49  virtual hsize_t getStorageSize() const;
50 
51  // Returns the in memory size of this attribute's data.
52  virtual size_t getInMemDataSize() const;
53 
54  // Reads data from this attribute.
55  void read( const DataType& mem_type, void *buf ) const;
56  void read( const DataType& mem_type, H5std_string& strg ) const;
57 
58  // Writes data to this attribute.
59  void write(const DataType& mem_type, const void *buf ) const;
60  void write(const DataType& mem_type, const H5std_string& strg ) const;
61 
62  // Flushes all buffers associated with the file specified by this
63  // attribute to disk.
64  void flush( H5F_scope_t scope ) const;
65 
67  virtual H5std_string fromClass () const { return("Attribute"); }
68 
69  // Creates a copy of an existing attribute using the attribute id
70  Attribute( const hid_t attr_id );
71 
72  // Copy constructor: makes a copy of an existing Attribute object.
73  Attribute( const Attribute& original );
74 
75  // Default constructor
76  Attribute();
77 
78  // Gets the attribute id.
79  virtual hid_t getId() const;
80 
81  // Destructor: properly terminates access to this attribute.
82  virtual ~Attribute();
83 
84  protected:
85  // Sets the attribute id.
86  virtual void p_setId(const hid_t new_id);
87 
88  private:
89  hid_t id; // HDF5 attribute id
90 
91  // This function contains the common code that is used by
92  // getTypeClass and various API functions getXxxType
93  // defined in AbstractDs for generic datatype and specific
94  // sub-types
95  virtual hid_t p_get_type() const;
96 
97  // Reads variable or fixed len strings from this attribute.
98  void p_read_variable_len(const DataType& mem_type, H5std_string& strg) const;
99  void p_read_fixed_len(const DataType& mem_type, H5std_string& strg) const;
100 
101  // do not inherit H5Object::iterateAttrs
102  int iterateAttrs() { return 0; }
103 
104  // do not inherit H5Object::renameAttr
105  void renameAttr() {}
106 };
107 #ifndef H5_NO_NAMESPACE
108 }
109 #endif
110 #endif // __H5Attribute_H
Class Attribute operates on HDF5 attributes.
Definition: H5Attribute.h:32
Class DataSpace operates on HDF5 dataspaces.
Definition: H5DataSpace.h:25
Class IdComponent provides wrappers of the C functions that operate on an HDF5 identifier.
Definition: H5IdComponent.h:34
#define H5std_string
Definition: H5Exception.h:29
Class DataType provides generic operations on HDF5 datatypes.
Definition: H5DataType.h:34
virtual H5std_string fromClass() const
Returns this class name.
Definition: H5Attribute.h:67
Class AbstractDs is an abstract base class, inherited by Attribute and DataSet.
Definition: H5AbstractDs.h:39