casacore
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>
33 #include <casacore/casa/HDF5/HDF5Object.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  // The destructor closes the hid.
113  { close(); }
114  // Close the hid if valid.
115  void close();
116  // Put hid in it. If it already contains a hid, it will be closed.
117  void operator= (hid_t hid)
118  { close(); itsHid = hid; }
119  // Get the hid.
120  hid_t getHid() const
121  { return itsHid; }
122  // Convert automatically to hid_t.
123  operator hid_t() const
124  { return itsHid; }
125  private:
126  // Copy constructor cannot be used.
127  HDF5HidDataType (const HDF5HidDataType& that);
128  // Assignment cannot be used.
130 
131  hid_t itsHid;
132  };
133 
134 
135  // <summary>
136  // A class representing an HDF5 dataspace hid.
137  // </summary>
138  // <use visibility=local>
139  // <reviewed reviewer="" date="" tests="tHDF5Dataset.cc">
140  // </reviewed>
141  // <synopsis>
142  // This class wraps an HDF5 dataspace hid (hdf5 id). It offers two benefits:
143  // <ul>
144  // <li> The most important is resource management. In case of an exception,
145  // the hid will automatically be closed by the destructor.
146  // <li> A hid is a kind of pointer and should not be copied. These classes
147  // forbid making a copy, but make it possible to use them in a
148  // shared pointer context.
149  // </ul>
150  // </synopsis>
152  {
153  public:
154  // Default constructor sets hid to invalid.
156  : itsHid(-1) {}
157  // Construct from given hid.
158  HDF5HidDataSpace (hid_t hid)
159  : itsHid(hid) {}
160  // The destructor closes the hid.
162  { close(); }
163  // Close the hid if valid.
164  void close();
165  // Put hid in it. If it already contains a hid, it will be closed.
166  void operator= (hid_t hid)
167  { close(); itsHid = hid; }
168  // Get the hid.
169  hid_t getHid() const
170  { return itsHid; }
171  // Convert automatically to hid_t.
172  operator hid_t() const
173  { return itsHid; }
174  private:
175  // Copy constructor cannot be used.
176  HDF5HidDataSpace (const HDF5HidDataSpace& that);
177  // Assignment cannot be used.
179 
180  hid_t itsHid;
181  };
182 
183 
184  // <summary>
185  // A class representing an HDF5 attribute hid.
186  // </summary>
187  // <use visibility=local>
188  // <reviewed reviewer="" date="" tests="tHDF5Dataset.cc">
189  // </reviewed>
190  // <synopsis>
191  // This class wraps an HDF5 attribute hid (hdf5 id). It offers two benefits:
192  // <ul>
193  // <li> The most important is resource management. In case of an exception,
194  // the hid will automatically be closed by the destructor.
195  // <li> A hid is a kind of pointer and should not be copied. These classes
196  // forbid making a copy, but make it possible to use them in a
197  // shared pointer context.
198  // </ul>
199  // </synopsis>
201  {
202  public:
203  // Default constructor sets hid to invalid.
205  : itsHid(-1) {}
206  // Construct from given hid.
207  HDF5HidAttribute (hid_t hid)
208  : itsHid(hid) {}
209  // The destructor closes the hid.
211  { close(); }
212  // Close the hid if valid.
213  void close();
214  // Put hid in it. If it already contains a hid, it will be closed.
215  void operator= (hid_t hid)
216  { close(); itsHid = hid; }
217  // Get the hid.
218  hid_t getHid() const
219  { return itsHid; }
220  // Convert automatically to hid_t.
221  operator hid_t() const
222  { return itsHid; }
223  private:
224  // Copy constructor cannot be used.
225  HDF5HidAttribute (const HDF5HidAttribute& that);
226  // Assignment cannot be used.
228 
229  hid_t itsHid;
230  };
231 
232 
233 }
234 
235 #endif
~HDF5HidProperty()
The destructor closes the hid.
Definition: HDF5HidMeta.h:63
A class representing an HDF5 dataspace hid.
Definition: HDF5HidMeta.h:151
void close()
Close the hid if valid.
HDF5HidDataSpace()
Default constructor sets hid to invalid.
Definition: HDF5HidMeta.h:155
HDF5HidDataSpace(hid_t hid)
Construct from given hid.
Definition: HDF5HidMeta.h:158
HDF5HidProperty()
Default constructor sets hid to invalid.
Definition: HDF5HidMeta.h:57
~HDF5HidDataSpace()
The destructor closes the hid.
Definition: HDF5HidMeta.h:161
HDF5HidDataType(hid_t hid)
Construct from given hid.
Definition: HDF5HidMeta.h:109
hid_t getHid() const
Get the hid.
Definition: HDF5HidMeta.h:169
hid_t getHid() const
Get the hid.
Definition: HDF5HidMeta.h:120
HDF5HidDataType()
Default constructor sets hid to invalid.
Definition: HDF5HidMeta.h:106
HDF5HidAttribute()
Default constructor sets hid to invalid.
Definition: HDF5HidMeta.h:204
hid_t getHid() const
Get the hid.
Definition: HDF5HidMeta.h:71
HDF5HidAttribute(hid_t hid)
Construct from given hid.
Definition: HDF5HidMeta.h:207
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:112
A class representing an HDF5 attribute hid.
Definition: HDF5HidMeta.h:200
void operator=(hid_t hid)
Put hid in it.
Definition: HDF5HidMeta.h:68
hid_t getHid() const
Get the hid.
Definition: HDF5HidMeta.h:218
~HDF5HidAttribute()
The destructor closes the hid.
Definition: HDF5HidMeta.h:210
A class representing an HDF5 property hid.
Definition: HDF5HidMeta.h:53
this file contains all the compiler specific defines
Definition: mainpage.dox:28