MISR Toolkit  1.5.1
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 COPYING file, which can be found at the root of the source code *
10  * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
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
29 class H5_DLLCPP Attribute : public AbstractDs, public H5Location {
30  public:
31 
32  // Copy constructor: makes a copy of an existing Attribute object.
33  Attribute(const Attribute& original);
34 
35  // Default constructor
36  Attribute();
37 
38  // Creates a copy of an existing attribute using the attribute id
39  Attribute(const hid_t attr_id);
40 
41  // Closes this attribute.
42  virtual void close();
43 
44  // Gets the name of this attribute.
45  ssize_t getName(char* attr_name, size_t buf_size = 0) const;
46  H5std_string getName(size_t len) const;
47  H5std_string getName() const;
48  ssize_t getName(H5std_string& attr_name, size_t len = 0) const;
49  // The overloaded function below is replaced by the one above and it
50  // is kept for backward compatibility purpose. Removed in 1.8.21.
51  // ssize_t getName(size_t buf_size, H5std_string& attr_name) const;
52 
53  // Gets a copy of the dataspace for this attribute.
54  virtual DataSpace getSpace() const;
55 
56  // Returns the amount of storage size required for this attribute.
57  virtual hsize_t getStorageSize() const;
58 
59  // Returns the in memory size of this attribute's data.
60  virtual size_t getInMemDataSize() const;
61 
62  // Reads data from this attribute.
63  void read(const DataType& mem_type, void *buf) const;
64  void read(const DataType& mem_type, H5std_string& strg) const;
65 
66  // Writes data to this attribute.
67  void write(const DataType& mem_type, const void *buf) const;
68  void write(const DataType& mem_type, const H5std_string& strg) const;
69 
70  // Flushes all buffers associated with the file specified by this
71  // attribute to disk.
72  void flush(H5F_scope_t scope) const;
73 
75  virtual H5std_string fromClass () const { return("Attribute"); }
76 
77  // Gets the attribute id.
78  virtual hid_t getId() const;
79 
80  // Throw group exception.
81  virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const;
82 
83  // Destructor: properly terminates access to this attribute.
84  virtual ~Attribute();
85 
86 #ifndef DOXYGEN_SHOULD_SKIP_THIS
87  protected:
88  // Sets the attribute id.
89  virtual void p_setId(const hid_t new_id);
90 #endif // DOXYGEN_SHOULD_SKIP_THIS
91 
92  private:
93  hid_t id; // HDF5 attribute id
94 
95  // This function contains the common code that is used by
96  // getTypeClass and various API functions getXxxType
97  // defined in AbstractDs for generic datatype and specific
98  // sub-types
99  virtual hid_t p_get_type() const;
100 
101  // Reads variable or fixed len strings from this attribute.
102  void p_read_variable_len(const DataType& mem_type, H5std_string& strg) const;
103  void p_read_fixed_len(const DataType& mem_type, H5std_string& strg) const;
104 
105  // do not inherit H5Object::iterateAttrs
106  int iterateAttrs() { return 0; }
107 
108  // do not inherit H5Object::renameAttr
109  void renameAttr() {}
110 
111  // Friend function to set Attribute id. For library use only.
112  friend void f_Attribute_setId(Attribute* attr, hid_t new_id);
113 
114 }; // end of Attribute
115 } // namespace H5
116 
117 #endif // __H5Attribute_H
#define H5_DLLCPP
Definition: H5api_adpt.h:262
virtual H5std_string fromClass() const
Returns this class name.
Definition: H5Attribute.h:75
HDFFCLIBAPI intf * len
long long ssize_t
Definition: H5public.h:156
Class DataSpace inherits from IdComponent and provides wrappers for the HDF5's dataspaces.
Definition: H5DataSpace.h:25
Class Attribute operates on HDF5 attributes.
Definition: H5Attribute.h:29
Class DataType provides generic operations on HDF5 datatypes.
Definition: H5DataType.h:28
int iterateAttrs()
Definition: H5Attribute.h:106
unsigned long long hsize_t
Definition: H5public.h:169
H5F_scope_t
Definition: H5Fpublic.h:79
H5Location is an abstract base class, providing a collection of wrappers of the C functions that take...
Definition: H5Location.h:42
AbstractDs is an abstract base class, inherited by Attribute and DataSet.
Definition: H5AbstractDs.h:38
#define H5std_string
Definition: H5Exception.h:25
int hid_t
Definition: H5Ipublic.h:54
void renameAttr()
Definition: H5Attribute.h:109
HDFFCLIBAPI intf * buf

MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:52