casacore
Loading...
Searching...
No Matches
HDF5HidMeta.h
Go to the documentation of this file.
1// # HDF5HidMeta.h: Classes representing an HDF5 hid of meta objects
2// # Copyright (C) 2008
3// # Associated Universities, Inc. Washington DC, USA.
4// #
5// # This library is free software; you can redistribute it and/or modify it
6// # under the terms of the GNU Library General Public License as published by
7// # the Free Software Foundation; either version 2 of the License, or (at your
8// # option) any later version.
9// #
10// # This library is distributed in the hope that it will be useful, but WITHOUT
11// # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12// # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13// # License for more details.
14// #
15// # You should have received a copy of the GNU Library General Public License
16// # along with this library; if not, write to the Free Software Foundation,
17// # Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18// #
19// # Correspondence concerning AIPS++ should be addressed as follows:
20// # Internet email: casa-feedback@nrao.edu.
21// # Postal address: AIPS++ Project Office
22// # National Radio Astronomy Observatory
23// # 520 Edgemont Road
24// # Charlottesville, VA 22903-2475 USA
25
26#ifndef CASA_HDF5HIDMETA_H
27#define CASA_HDF5HIDMETA_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/HDF5/HDF5Object.h>
32
33namespace casacore { // # NAMESPACE CASACORE - BEGIN
34
35// <summary>
36// A class representing an HDF5 property hid.
37// </summary>
38// <use visibility=local>
39// <reviewed reviewer="" date="" tests="tHDF5Dataset.cc">
40// </reviewed>
41// <synopsis>
42// This class wraps an HDF5 property hid (hdf5 id). It offers two benefits:
43// <ul>
44// <li> The most important is resource management. In case of an exception,
45// the hid will automatically be closed by the destructor.
46// <li> A hid is a kind of pointer and should not be copied. These classes
47// forbid making a copy, but make it possible to use them in a
48// shared pointer context.
49// </ul>
50// </synopsis>
52 public:
53 // Default constructor sets hid to invalid.
55 // Construct from given hid.
56 HDF5HidProperty(hid_t hid) : itsHid(hid) {}
57 // The destructor closes the hid.
59 // Copy constructor cannot be used.
61 // Assignment cannot be used.
63 // Close the hid if valid.
64 void close();
65 // Put hid in it. If it already contains a hid, it will be closed.
66 void operator=(hid_t hid) {
67 close();
68 itsHid = hid;
69 }
70 // Get the hid.
71 hid_t getHid() const { return itsHid; }
72 // Convert automatically to hid_t.
73 operator hid_t() const { return itsHid; }
74
75 private:
76 hid_t itsHid;
77};
78
79// <summary>
80// A class representing an HDF5 datatype hid.
81// </summary>
82// <use visibility=local>
83// <reviewed reviewer="" date="" tests="tHDF5Dataset.cc">
84// </reviewed>
85// <synopsis>
86// This class wraps an HDF5 datatype hid (hdf5 id). It offers two benefits:
87// <ul>
88// <li> The most important is resource management. In case of an exception,
89// the hid will automatically be closed by the destructor.
90// <li> A hid is a kind of pointer and should not be copied. These classes
91// forbid making a copy, but make it possible to use them in a
92// shared pointer context.
93// </ul>
94// </synopsis>
96 public:
97 // Default constructor sets hid to invalid.
99 // Construct from given hid.
100 HDF5HidDataType(hid_t hid) : itsHid(hid) {}
101 // Copy constructor makes a deep copy.
103 // The destructor closes the hid.
105 // Assignment makes a deep copy.
107 // Close the hid if valid.
108 void close();
109 // Put hid in it. If it already contains a hid, it will be closed.
110 void operator=(hid_t hid) {
111 close();
112 itsHid = hid;
113 }
114 // Get the hid.
115 hid_t getHid() const { return itsHid; }
116 // Convert automatically to hid_t.
117 operator hid_t() const { return itsHid; }
118
119 private:
120 hid_t itsHid;
121};
122
123// <summary>
124// A class representing an HDF5 dataspace hid.
125// </summary>
126// <use visibility=local>
127// <reviewed reviewer="" date="" tests="tHDF5Dataset.cc">
128// </reviewed>
129// <synopsis>
130// This class wraps an HDF5 dataspace hid (hdf5 id). It offers two benefits:
131// <ul>
132// <li> The most important is resource management. In case of an exception,
133// the hid will automatically be closed by the destructor.
134// <li> A hid is a kind of pointer and should not be copied. These classes
135// forbid making a copy, but make it possible to use them in a
136// shared pointer context.
137// </ul>
138// </synopsis>
140 public:
141 // Default constructor sets hid to invalid.
143 // Construct from given hid.
144 HDF5HidDataSpace(hid_t hid) : itsHid(hid) {}
145 // The destructor closes the hid.
147 // Copy constructor cannot be used.
149 // Assignment cannot be used.
151 // Close the hid if valid.
152 void close();
153 // Put hid in it. If it already contains a hid, it will be closed.
154 void operator=(hid_t hid) {
155 close();
156 itsHid = hid;
157 }
158 // Get the hid.
159 hid_t getHid() const { return itsHid; }
160 // Convert automatically to hid_t.
161 operator hid_t() const { return itsHid; }
162
163 private:
164 hid_t itsHid;
165};
166
167// <summary>
168// A class representing an HDF5 attribute hid.
169// </summary>
170// <use visibility=local>
171// <reviewed reviewer="" date="" tests="tHDF5Dataset.cc">
172// </reviewed>
173// <synopsis>
174// This class wraps an HDF5 attribute hid (hdf5 id). It offers two benefits:
175// <ul>
176// <li> The most important is resource management. In case of an exception,
177// the hid will automatically be closed by the destructor.
178// <li> A hid is a kind of pointer and should not be copied. These classes
179// forbid making a copy, but make it possible to use them in a
180// shared pointer context.
181// </ul>
182// </synopsis>
184 public:
185 // Default constructor sets hid to invalid.
187 // Construct from given hid.
188 HDF5HidAttribute(hid_t hid) : itsHid(hid) {}
189 // The destructor closes the hid.
191 // Copy constructor cannot be used.
193 // Assignment cannot be used.
195 // Close the hid if valid.
196 void close();
197 // Put hid in it. If it already contains a hid, it will be closed.
198 void operator=(hid_t hid) {
199 close();
200 itsHid = hid;
201 }
202 // Get the hid.
203 hid_t getHid() const { return itsHid; }
204 // Convert automatically to hid_t.
205 operator hid_t() const { return itsHid; }
206
207 private:
208 hid_t itsHid;
209};
210
211} // namespace casacore
212
213#endif
void operator=(hid_t hid)
Put hid in it.
void close()
Close the hid if valid.
hid_t getHid() const
Get the hid.
HDF5HidAttribute & operator=(const HDF5HidAttribute &)=delete
Assignment cannot be used.
HDF5HidAttribute()
Default constructor sets hid to invalid.
HDF5HidAttribute(hid_t hid)
Construct from given hid.
~HDF5HidAttribute()
The destructor closes the hid.
HDF5HidAttribute(const HDF5HidAttribute &)=delete
Copy constructor cannot be used.
~HDF5HidDataSpace()
The destructor closes the hid.
HDF5HidDataSpace(hid_t hid)
Construct from given hid.
HDF5HidDataSpace(const HDF5HidDataSpace &)=delete
Copy constructor cannot be used.
hid_t getHid() const
Get the hid.
HDF5HidDataSpace()
Default constructor sets hid to invalid.
HDF5HidDataSpace & operator=(const HDF5HidDataSpace &)=delete
Assignment cannot be used.
void close()
Close the hid if valid.
void operator=(hid_t hid)
Put hid in it.
HDF5HidDataType & operator=(const HDF5HidDataType &that)
Assignment makes a deep copy.
~HDF5HidDataType()
The destructor closes the hid.
hid_t getHid() const
Get the hid.
void operator=(hid_t hid)
Put hid in it.
void close()
Close the hid if valid.
HDF5HidDataType()
Default constructor sets hid to invalid.
Definition HDF5HidMeta.h:98
HDF5HidDataType(hid_t hid)
Construct from given hid.
HDF5HidDataType(const HDF5HidDataType &that)
Copy constructor makes a deep copy.
HDF5HidProperty()
Default constructor sets hid to invalid.
Definition HDF5HidMeta.h:54
void operator=(hid_t hid)
Put hid in it.
Definition HDF5HidMeta.h:66
HDF5HidProperty & operator=(const HDF5HidProperty &)=delete
Assignment cannot be used.
HDF5HidProperty(const HDF5HidProperty &)=delete
Copy constructor cannot be used.
void close()
Close the hid if valid.
~HDF5HidProperty()
The destructor closes the hid.
Definition HDF5HidMeta.h:58
hid_t getHid() const
Get the hid.
Definition HDF5HidMeta.h:71
HDF5HidProperty(hid_t hid)
Construct from given hid.
Definition HDF5HidMeta.h:56
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28