casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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: aips2-request@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 //# $Id$
27 
28 #ifndef CASA_HDF5HIDMETA_H
29 #define CASA_HDF5HIDMETA_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
34 
35 namespace casacore { //# NAMESPACE CASACORE - BEGIN
36 
37  // <summary>
38  // A class representing an HDF5 property hid.
39  // </summary>
40  // <use visibility=local>
41  // <reviewed reviewer="" date="" tests="tHDF5Dataset.cc">
42  // </reviewed>
43  // <synopsis>
44  // This class wraps an HDF5 property hid (hdf5 id). It offers two benefits:
45  // <ul>
46  // <li> The most important is resource management. In case of an exception,
47  // the hid will automatically be closed by the destructor.
48  // <li> A hid is a kind of pointer and should not be copied. These classes
49  // forbid making a copy, but make it possible to use them in a
50  // shared pointer context.
51  // </ul>
52  // </synopsis>
54  {
55  public:
56  // Default constructor sets hid to invalid.
58  : itsHid(-1) {}
59  // Construct from given hid.
60  HDF5HidProperty (hid_t hid)
61  : itsHid(hid) {}
62  // The destructor closes the hid.
64  { close(); }
65  // Close the hid if valid.
66  void close();
67  // Put hid in it. If it already contains a hid, it will be closed.
68  void operator= (hid_t hid)
69  { close(); itsHid = hid; }
70  // Get the hid.
71  hid_t getHid() const
72  { return itsHid; }
73  // Convert automatically to hid_t.
74  operator hid_t() const
75  { return itsHid; }
76  private:
77  // Copy constructor cannot be used.
78  HDF5HidProperty (const HDF5HidProperty& that);
79  // Assignment cannot be used.
81 
82  hid_t itsHid;
83  };
84 
85 
86  // <summary>
87  // A class representing an HDF5 datatype hid.
88  // </summary>
89  // <use visibility=local>
90  // <reviewed reviewer="" date="" tests="tHDF5Dataset.cc">
91  // </reviewed>
92  // <synopsis>
93  // This class wraps an HDF5 datatype hid (hdf5 id). It offers two benefits:
94  // <ul>
95  // <li> The most important is resource management. In case of an exception,
96  // the hid will automatically be closed by the destructor.
97  // <li> A hid is a kind of pointer and should not be copied. These classes
98  // forbid making a copy, but make it possible to use them in a
99  // shared pointer context.
100  // </ul>
101  // </synopsis>
103  {
104  public:
105  // Default constructor sets hid to invalid.
107  : itsHid(-1) {}
108  // Construct from given hid.
109  HDF5HidDataType (hid_t hid)
110  : itsHid(hid) {}
111  // Copy constructor makes a deep copy.
112  HDF5HidDataType (const HDF5HidDataType& that);
113  // The destructor closes the hid.
115  { close(); }
116  // Assignment makes a deep copy.
118  // Close the hid if valid.
119  void close();
120  // Put hid in it. If it already contains a hid, it will be closed.
121  void operator= (hid_t hid)
122  { close(); itsHid = hid; }
123  // Get the hid.
124  hid_t getHid() const
125  { return itsHid; }
126  // Convert automatically to hid_t.
127  operator hid_t() const
128  { return itsHid; }
129  private:
130  hid_t itsHid;
131  };
132 
133 
134  // <summary>
135  // A class representing an HDF5 dataspace hid.
136  // </summary>
137  // <use visibility=local>
138  // <reviewed reviewer="" date="" tests="tHDF5Dataset.cc">
139  // </reviewed>
140  // <synopsis>
141  // This class wraps an HDF5 dataspace hid (hdf5 id). It offers two benefits:
142  // <ul>
143  // <li> The most important is resource management. In case of an exception,
144  // the hid will automatically be closed by the destructor.
145  // <li> A hid is a kind of pointer and should not be copied. These classes
146  // forbid making a copy, but make it possible to use them in a
147  // shared pointer context.
148  // </ul>
149  // </synopsis>
151  {
152  public:
153  // Default constructor sets hid to invalid.
155  : itsHid(-1) {}
156  // Construct from given hid.
157  HDF5HidDataSpace (hid_t hid)
158  : itsHid(hid) {}
159  // The destructor closes the hid.
161  { close(); }
162  // Close the hid if valid.
163  void close();
164  // Put hid in it. If it already contains a hid, it will be closed.
165  void operator= (hid_t hid)
166  { close(); itsHid = hid; }
167  // Get the hid.
168  hid_t getHid() const
169  { return itsHid; }
170  // Convert automatically to hid_t.
171  operator hid_t() const
172  { return itsHid; }
173  private:
174  // Copy constructor cannot be used.
175  HDF5HidDataSpace (const HDF5HidDataSpace& that);
176  // Assignment cannot be used.
178 
179  hid_t itsHid;
180  };
181 
182 
183  // <summary>
184  // A class representing an HDF5 attribute hid.
185  // </summary>
186  // <use visibility=local>
187  // <reviewed reviewer="" date="" tests="tHDF5Dataset.cc">
188  // </reviewed>
189  // <synopsis>
190  // This class wraps an HDF5 attribute hid (hdf5 id). It offers two benefits:
191  // <ul>
192  // <li> The most important is resource management. In case of an exception,
193  // the hid will automatically be closed by the destructor.
194  // <li> A hid is a kind of pointer and should not be copied. These classes
195  // forbid making a copy, but make it possible to use them in a
196  // shared pointer context.
197  // </ul>
198  // </synopsis>
200  {
201  public:
202  // Default constructor sets hid to invalid.
204  : itsHid(-1) {}
205  // Construct from given hid.
206  HDF5HidAttribute (hid_t hid)
207  : itsHid(hid) {}
208  // The destructor closes the hid.
210  { close(); }
211  // Close the hid if valid.
212  void close();
213  // Put hid in it. If it already contains a hid, it will be closed.
214  void operator= (hid_t hid)
215  { close(); itsHid = hid; }
216  // Get the hid.
217  hid_t getHid() const
218  { return itsHid; }
219  // Convert automatically to hid_t.
220  operator hid_t() const
221  { return itsHid; }
222  private:
223  // Copy constructor cannot be used.
224  HDF5HidAttribute (const HDF5HidAttribute& that);
225  // Assignment cannot be used.
227 
228  hid_t itsHid;
229  };
230 
231 
232 }
233 
234 #endif
void close()
Close the hid if valid.
hid_t getHid() const
Get the hid.
Definition: HDF5HidMeta.h:71
~HDF5HidProperty()
The destructor closes the hid.
Definition: HDF5HidMeta.h:63
hid_t getHid() const
Get the hid.
Definition: HDF5HidMeta.h:168
A class representing an HDF5 dataspace hid.
Definition: HDF5HidMeta.h:150
void close()
Close the hid if valid.
HDF5HidDataSpace()
Default constructor sets hid to invalid.
Definition: HDF5HidMeta.h:154
HDF5HidDataSpace(hid_t hid)
Construct from given hid.
Definition: HDF5HidMeta.h:157
HDF5HidProperty()
Default constructor sets hid to invalid.
Definition: HDF5HidMeta.h:57
void operator=(hid_t hid)
Put hid in it.
Definition: HDF5HidMeta.h:165
hid_t getHid() const
Get the hid.
Definition: HDF5HidMeta.h:124
~HDF5HidDataSpace()
The destructor closes the hid.
Definition: HDF5HidMeta.h:160
HDF5HidDataType(hid_t hid)
Construct from given hid.
Definition: HDF5HidMeta.h:109
void close()
Close the hid if valid.
HDF5HidDataType & operator=(const HDF5HidDataType &that)
Assignment makes a deep copy.
hid_t getHid() const
Get the hid.
Definition: HDF5HidMeta.h:217
HDF5HidDataType()
Default constructor sets hid to invalid.
Definition: HDF5HidMeta.h:106
void operator=(hid_t hid)
Put hid in it.
Definition: HDF5HidMeta.h:214
HDF5HidAttribute()
Default constructor sets hid to invalid.
Definition: HDF5HidMeta.h:203
HDF5HidAttribute(hid_t hid)
Construct from given hid.
Definition: HDF5HidMeta.h:206
A class representing an HDF5 datatype hid.
Definition: HDF5HidMeta.h:102
HDF5HidProperty(hid_t hid)
Construct from given hid.
Definition: HDF5HidMeta.h:60
~HDF5HidDataType()
The destructor closes the hid.
Definition: HDF5HidMeta.h:114
A class representing an HDF5 attribute hid.
Definition: HDF5HidMeta.h:199
void operator=(hid_t hid)
Put hid in it.
Definition: HDF5HidMeta.h:68
void close()
Close the hid if valid.
~HDF5HidAttribute()
The destructor closes the hid.
Definition: HDF5HidMeta.h:209
A class representing an HDF5 property hid.
Definition: HDF5HidMeta.h:53