My Project 1.10.10
Loading...
Searching...
No Matches
H5Attribute.h
1// C++ informative line for the emacs editor: -*- C++ -*-
2/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3 * Copyright by The HDF Group. *
4 * All rights reserved. *
5 * *
6 * This file is part of HDF5. The full HDF5 copyright notice, including *
7 * terms governing use, modification, and redistribution, is contained in *
8 * the COPYING file, which can be found at the root of the source code *
9 * distribution tree, or in https://www.hdfgroup.org/licenses. *
10 * If you do not have access to either file, you may request a copy from *
11 * help@hdfgroup.org. *
12 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13
14#ifndef H5Attribute_H
15#define H5Attribute_H
16
17namespace H5 {
18
27// Inheritance: multiple H5Location/AbstractDs -> IdComponent
28class H5_DLLCPP Attribute : public AbstractDs, public H5Location {
29 public:
30 // Copy constructor: same as the original Attribute.
31 Attribute(const Attribute &original);
32
33 // Default constructor
34 Attribute();
35
36 // Creates a copy of an existing attribute using the attribute id
37 Attribute(const hid_t attr_id);
38
39 // Closes this attribute.
40 virtual void close();
41
42 // Gets the name of this attribute.
43 ssize_t getName(char *attr_name, size_t buf_size = 0) const;
44 H5std_string getName(size_t len) const;
45 H5std_string getName() const;
46 ssize_t getName(H5std_string &attr_name, size_t len = 0) const;
47 // The overloaded function below is replaced by the one above and it
48 // is kept for backward compatibility purpose.
49 ssize_t getName(size_t buf_size, H5std_string &attr_name) const;
50
51 // Gets a copy of the dataspace for this attribute.
52 virtual DataSpace getSpace() const;
53
54 // Returns the amount of storage size required for this attribute.
55 virtual hsize_t getStorageSize() const;
56
57 // Returns the in memory size of this attribute's data.
58 virtual size_t getInMemDataSize() const;
59
60 // Reads data from this attribute.
61 void read(const DataType &mem_type, void *buf) const;
62 void read(const DataType &mem_type, H5std_string &strg) const;
63
64 // Writes data to this attribute.
65 void write(const DataType &mem_type, const void *buf) const;
66 void write(const DataType &mem_type, const H5std_string &strg) const;
67
69 virtual H5std_string
70 fromClass() const
71 {
72 return ("Attribute");
73 }
74
75 // Gets the attribute id.
76 virtual hid_t getId() const;
77
78 // Destructor: properly terminates access to this attribute.
79 virtual ~Attribute();
80
81#ifndef DOXYGEN_SHOULD_SKIP_THIS
82 protected:
83 // Sets the attribute id.
84 virtual void p_setId(const hid_t new_id);
85#endif // DOXYGEN_SHOULD_SKIP_THIS
86
87 private:
88 hid_t id; // HDF5 attribute id
89
90 // This function contains the common code that is used by
91 // getTypeClass and various API functions getXxxType
92 // defined in AbstractDs for generic datatype and specific
93 // sub-types
94 virtual hid_t p_get_type() const;
95
96 // Reads variable or fixed len strings from this attribute.
97 void p_read_variable_len(const DataType &mem_type, H5std_string &strg) const;
98 void p_read_fixed_len(const DataType &mem_type, H5std_string &strg) const;
99
100 // Friend function to set Attribute id. For library use only.
101 friend void f_Attribute_setId(Attribute *attr, hid_t new_id);
102
103}; // end of Attribute
104} // namespace H5
105
106#endif // H5Attribute_H
AbstractDs is an abstract base class, inherited by Attribute and DataSet.
Definition H5AbstractDs.h:35
Class Attribute operates on HDF5 attributes.
Definition H5Attribute.h:28
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:70
Class DataSpace inherits from IdComponent and provides wrappers for the HDF5's dataspaces.
Definition H5DataSpace.h:24
Class DataType provides generic operations on HDF5 datatypes.
Definition H5DataType.h:27
H5Location is an abstract base class, added in version 1.8.12.
Definition H5Location.h:30
Definition H5AbstractDs.cpp:33


The HDF Group Help Desk:
  Copyright by The HDF Group