My Project  1.10.8
H5Attribute.h
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 COPYING file, which can be found at the root of the source code *
10  * distribution tree, or in https://www.hdfgroup.org/licenses. *
11  * If you do not have access to either file, you may request a copy from *
12  * help@hdfgroup.org. *
13  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
14 
15 #ifndef H5Attribute_H
16 #define H5Attribute_H
17 
18 namespace H5 {
19 
28 // Inheritance: multiple H5Location/AbstractDs -> IdComponent
29 class H5_DLLCPP Attribute : public AbstractDs, public H5Location {
30  public:
31  // Copy constructor: same as the original Attribute.
32  Attribute(const Attribute &original);
33 
34  // Default constructor
35  Attribute();
36 
37  // Creates a copy of an existing attribute using the attribute id
38  Attribute(const hid_t attr_id);
39 
40  // Closes this attribute.
41  virtual void close();
42 
43  // Gets the name of this attribute.
44  ssize_t getName(char *attr_name, size_t buf_size = 0) const;
45  H5std_string getName(size_t len) const;
46  H5std_string getName() const;
47  ssize_t getName(H5std_string &attr_name, size_t len = 0) const;
48  // The overloaded function below is replaced by the one above and it
49  // is kept for backward compatibility purpose.
50  ssize_t getName(size_t buf_size, H5std_string &attr_name) const;
51 
52  // Gets a copy of the dataspace for this attribute.
53  virtual DataSpace getSpace() const;
54 
55  // Returns the amount of storage size required for this attribute.
56  virtual hsize_t getStorageSize() const;
57 
58  // Returns the in memory size of this attribute's data.
59  virtual size_t getInMemDataSize() const;
60 
61  // Reads data from this attribute.
62  void read(const DataType &mem_type, void *buf) const;
63  void read(const DataType &mem_type, H5std_string &strg) const;
64 
65  // Writes data to this attribute.
66  void write(const DataType &mem_type, const void *buf) const;
67  void write(const DataType &mem_type, const H5std_string &strg) const;
68 
70  virtual H5std_string
71  fromClass() const
72  {
73  return ("Attribute");
74  }
75 
76  // Gets the attribute id.
77  virtual hid_t getId() const;
78 
79  // Destructor: properly terminates access to this attribute.
80  virtual ~Attribute();
81 
82 #ifndef DOXYGEN_SHOULD_SKIP_THIS
83  protected:
84  // Sets the attribute id.
85  virtual void p_setId(const hid_t new_id);
86 #endif // DOXYGEN_SHOULD_SKIP_THIS
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  // Friend function to set Attribute id. For library use only.
102  friend void f_Attribute_setId(Attribute *attr, hid_t new_id);
103 
104 }; // end of Attribute
105 } // namespace H5
106 
107 #endif // H5Attribute_H
AbstractDs is an abstract base class, inherited by Attribute and DataSet.
Definition: H5AbstractDs.h:36
Class Attribute operates on HDF5 attributes.
Definition: H5Attribute.h:29
ssize_t getName(size_t buf_size, H5std_string &attr_name) const
friend void f_Attribute_setId(Attribute *attr, hid_t new_id)
virtual H5std_string fromClass() const
Returns this class name.
Definition: H5Attribute.h:71
Class DataSpace inherits from IdComponent and provides wrappers for the HDF5's dataspaces.
Definition: H5DataSpace.h:25
Class DataType provides generic operations on HDF5 datatypes.
Definition: H5DataType.h:28
H5Location is an abstract base class, added in version 1.8.12.
Definition: H5Location.h:31
Definition: H5AbstractDs.cpp:34


The HDF Group Help Desk:
  Copyright by The HDF Group
and the Board of Trustees of the University of Illinois