HDF5HidMeta.h

Go to the documentation of this file.
00001 //# HDF5HidMeta.h: Classes representing an HDF5 hid of meta objects
00002 //# Copyright (C) 2008
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 
00028 #ifndef CASA_HDF5HIDMETA_H
00029 #define CASA_HDF5HIDMETA_H
00030 
00031 //# Includes
00032 #include <casacore/casa/aips.h>
00033 #include <casacore/casa/HDF5/HDF5Object.h>
00034 
00035 namespace casacore { //# NAMESPACE CASACORE - BEGIN
00036 
00037   // <summary>
00038   // A class representing an HDF5 property hid.
00039   // </summary>
00040   // <use visibility=local>
00041   // <reviewed reviewer="" date="" tests="tHDF5Dataset.cc">
00042   // </reviewed>
00043   // <synopsis>
00044   // This class wraps an HDF5 property hid (hdf5 id). It offers two benefits:
00045   // <ul>
00046   //  <li> The most important is resource management. In case of an exception,
00047   //       the hid will automatically be closed by the destructor.
00048   //  <li> A hid is a kind of pointer and should not be copied. These classes
00049   //       forbid making a copy, but make it possible to use them in a
00050   //       shared pointer context.
00051   // </ul>
00052   // </synopsis>
00053   class HDF5HidProperty
00054   {
00055   public: 
00056     // Default constructor sets hid to invalid.
00057     HDF5HidProperty()
00058       : itsHid(-1) {}
00059     // Construct from given hid.
00060     HDF5HidProperty (hid_t hid)
00061       : itsHid(hid) {}
00062     // The destructor closes the hid.
00063     ~HDF5HidProperty()
00064       { close(); }
00065     // Close the hid if valid.
00066     void close();
00067     // Put hid in it. If it already contains a hid, it will be closed.
00068     void operator= (hid_t hid)
00069       { close(); itsHid = hid; }
00070     // Get the hid.
00071     hid_t getHid() const
00072       { return itsHid; }
00073     // Convert automatically to hid_t.
00074     operator hid_t() const
00075       { return itsHid; }
00076   private:
00077     // Copy constructor cannot be used.
00078     HDF5HidProperty (const HDF5HidProperty& that);
00079     // Assignment cannot be used.
00080     HDF5HidProperty& operator= (const HDF5HidProperty& that);
00081 
00082     hid_t itsHid;
00083   };
00084 
00085 
00086   // <summary>
00087   // A class representing an HDF5 datatype hid.
00088   // </summary>
00089   // <use visibility=local>
00090   // <reviewed reviewer="" date="" tests="tHDF5Dataset.cc">
00091   // </reviewed>
00092   // <synopsis>
00093   // This class wraps an HDF5 datatype hid (hdf5 id). It offers two benefits:
00094   // <ul>
00095   //  <li> The most important is resource management. In case of an exception,
00096   //       the hid will automatically be closed by the destructor.
00097   //  <li> A hid is a kind of pointer and should not be copied. These classes
00098   //       forbid making a copy, but make it possible to use them in a
00099   //       shared pointer context.
00100   // </ul>
00101   // </synopsis>
00102   class HDF5HidDataType
00103   {
00104   public: 
00105     // Default constructor sets hid to invalid.
00106     HDF5HidDataType()
00107       : itsHid(-1) {}
00108     // Construct from given hid.
00109     HDF5HidDataType (hid_t hid)
00110       : itsHid(hid) {}
00111     // The destructor closes the hid.
00112     ~HDF5HidDataType()
00113       { close(); }
00114     // Close the hid if valid.
00115     void close();
00116     // Put hid in it. If it already contains a hid, it will be closed.
00117     void operator= (hid_t hid)
00118       { close(); itsHid = hid; }
00119     // Get the hid.
00120     hid_t getHid() const
00121       { return itsHid; }
00122     // Convert automatically to hid_t.
00123     operator hid_t() const
00124       { return itsHid; }
00125   private:
00126     // Copy constructor cannot be used.
00127     HDF5HidDataType (const HDF5HidDataType& that);
00128     // Assignment cannot be used.
00129     HDF5HidDataType& operator= (const HDF5HidDataType& that);
00130 
00131     hid_t itsHid;
00132   };
00133 
00134 
00135   // <summary>
00136   // A class representing an HDF5 dataspace hid.
00137   // </summary>
00138   // <use visibility=local>
00139   // <reviewed reviewer="" date="" tests="tHDF5Dataset.cc">
00140   // </reviewed>
00141   // <synopsis>
00142   // This class wraps an HDF5 dataspace hid (hdf5 id). It offers two benefits:
00143   // <ul>
00144   //  <li> The most important is resource management. In case of an exception,
00145   //       the hid will automatically be closed by the destructor.
00146   //  <li> A hid is a kind of pointer and should not be copied. These classes
00147   //       forbid making a copy, but make it possible to use them in a
00148   //       shared pointer context.
00149   // </ul>
00150   // </synopsis>
00151   class HDF5HidDataSpace
00152   {
00153   public: 
00154     // Default constructor sets hid to invalid.
00155     HDF5HidDataSpace()
00156       : itsHid(-1) {}
00157     // Construct from given hid.
00158     HDF5HidDataSpace (hid_t hid)
00159       : itsHid(hid) {}
00160     // The destructor closes the hid.
00161     ~HDF5HidDataSpace()
00162       { close(); }
00163     // Close the hid if valid.
00164     void close();
00165     // Put hid in it. If it already contains a hid, it will be closed.
00166     void operator= (hid_t hid)
00167       { close(); itsHid = hid; }
00168     // Get the hid.
00169     hid_t getHid() const
00170       { return itsHid; }
00171     // Convert automatically to hid_t.
00172     operator hid_t() const
00173       { return itsHid; }
00174   private:
00175     // Copy constructor cannot be used.
00176     HDF5HidDataSpace (const HDF5HidDataSpace& that);
00177     // Assignment cannot be used.
00178     HDF5HidDataSpace& operator= (const HDF5HidDataSpace& that);
00179 
00180     hid_t itsHid;
00181   };
00182 
00183 
00184   // <summary>
00185   // A class representing an HDF5 attribute hid.
00186   // </summary>
00187   // <use visibility=local>
00188   // <reviewed reviewer="" date="" tests="tHDF5Dataset.cc">
00189   // </reviewed>
00190   // <synopsis>
00191   // This class wraps an HDF5 attribute hid (hdf5 id). It offers two benefits:
00192   // <ul>
00193   //  <li> The most important is resource management. In case of an exception,
00194   //       the hid will automatically be closed by the destructor.
00195   //  <li> A hid is a kind of pointer and should not be copied. These classes
00196   //       forbid making a copy, but make it possible to use them in a
00197   //       shared pointer context.
00198   // </ul>
00199   // </synopsis>
00200   class HDF5HidAttribute
00201   {
00202   public: 
00203     // Default constructor sets hid to invalid.
00204     HDF5HidAttribute()
00205       : itsHid(-1) {}
00206     // Construct from given hid.
00207     HDF5HidAttribute (hid_t hid)
00208       : itsHid(hid) {}
00209     // The destructor closes the hid.
00210     ~HDF5HidAttribute()
00211       { close(); }
00212     // Close the hid if valid.
00213     void close();
00214     // Put hid in it. If it already contains a hid, it will be closed.
00215     void operator= (hid_t hid)
00216       { close(); itsHid = hid; }
00217     // Get the hid.
00218     hid_t getHid() const
00219       { return itsHid; }
00220     // Convert automatically to hid_t.
00221     operator hid_t() const
00222       { return itsHid; }
00223   private:
00224     // Copy constructor cannot be used.
00225     HDF5HidAttribute (const HDF5HidAttribute& that);
00226     // Assignment cannot be used.
00227     HDF5HidAttribute& operator= (const HDF5HidAttribute& that);
00228 
00229     hid_t itsHid;
00230   };
00231 
00232 
00233 }
00234 
00235 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1