00001 //# HDF5.h: Classes binding casa to the HDF5 C API 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_HDF5_H 00029 #define CASA_HDF5_H 00030 00031 //# Includes 00032 #include <casacore/casa/aips.h> 00033 00034 #include <casacore/casa/HDF5/HDF5File.h> 00035 #include <casacore/casa/HDF5/HDF5Group.h> 00036 #include <casacore/casa/HDF5/HDF5DataSet.h> 00037 #include <casacore/casa/HDF5/HDF5Record.h> 00038 #include <casacore/casa/HDF5/HDF5Error.h> 00039 00040 00041 namespace casacore { //# NAMESPACE CASACORE - BEGIN 00042 00043 // <module> 00044 // 00045 // <summary> 00046 // Classes binding casa to the HDF5 C API 00047 // </summary> 00048 00049 // <prerequisite> 00050 // <li> HDF5 (see http://www.hdfgroup.uiuc.edu/HDF5/doc_dev_snapshot) 00051 // </prerequisite> 00052 00053 // <reviewed reviewer="" date="" demos=""> 00054 // </reviewed> 00055 00056 // <etymology> 00057 // 'HDF5' is version 5 of the Hierarchical Data Format. 00058 // </etymology> 00059 // 00060 // <synopsis> 00061 // This module's main purpose is to provide limited, but convenient 00062 // access to the HDF5 C API. 00063 // The classes offer the following services: 00064 // <ul> 00065 // <li> The burden of allocating and releasing the HDF5 resources 00066 // (the so-called hid-s) is handled in an automatic and 00067 // exception-safe way. 00068 // <li> The overwhelming and rather hard to use HDF5 C API is hidden. 00069 // <li> The standard casa data types (scalars and arrays) are fully supported. 00070 // Because HDF5 does not support empty strings, they are transparantly 00071 // replaced by the value '__empty__'. 00072 // Unfortunately HDF5 does not support empty arrays, thus they cannot 00073 // be stored. 00074 // <li> A Record is stored as a group. Its values (scalars and arrays) 00075 // are stored as attributes, while nested records are stored as 00076 // nested groups. 00077 // <li> Bool values are stored as chars. 00078 // <li> Complex values are stored as compounds of two real values. 00079 // <li> Large arrays can be stored in HDF5 DataSets with an optional tile size 00080 // (chunk size in HDF5 terminology). The array axes are reversed (fully 00081 // transparantly) because HDF5 uses C-order, while casa Arrays use 00082 // Fortran-order. 00083 // <li> Automatic printing of HDF5 messages is disabled. All errors are 00084 // thrown as exceptions (AipsError or derived from it). 00085 // </ul> 00086 // 00087 // The following classes are available: 00088 // <ul> 00089 // <li> HDF5File opens or creates an HDF5 file and closes it automatically. 00090 // Furthermore it has a function to test if a file is in HDF5 format. 00091 // <li> HDF5Record reads or writes a Record as a group in an HDF5 object. 00092 // <li> HDF5DataSet opens or creates a possible tiled data set in an HDF5 00093 // object. The array can be read or written in parts. 00094 // Currently the only data types supported are Bool, Int, Float, Double, 00095 // Complex, and DComplex. 00096 // <li> HDF5Group opens, creates, or removes a group in an HDF5 object. 00097 // </ul> 00098 // Note that HDF5Object forms the base class of HDF5File, HDF5Group, and 00099 // HDF5DataSet. Most interfaces use HDF5Object, thus are applicable to 00100 // all these object types. 00101 // <br>An HDF5Object has a conversion operator to <src>hid_t</src>, thus 00102 // can be used directly in any HDF5 function. 00103 // 00104 // Because of HDF5 resource management the objects (e.g. HDF5File) cannot 00105 // be copied. However, they can be used in shared pointers (like casa's 00106 // CountedPtr or boost's shared_ptr). 00107 // <br> 00108 // Internally the classes use HDF5HidMeta.h which does the resource management 00109 // for HDF5 meta data like attributes, property lists, etc.. 00110 // 00111 // <note> 00112 // All HDF5 classes and all their functions are compiled, but it depends on 00113 // the setting of HAVE_HDF5 how. If not set, all these functions are merely stubs 00114 // and the class constructors throw an exception when used. 00115 // The function <src>HDF5Object::hasHDF5Support()</src> tells if HDF5 is used. 00116 // See the casacore build instructions at casacore.googlecode.com 00117 // for more information. 00118 // </note> 00119 // </synopsis> 00120 00121 // <example> 00122 // See the various test programs. 00123 // </example> 00124 // 00125 // <motivation> 00126 // HDF5 offers a C++ interface. However, this interface is still quite complex 00127 // and is too much C-oriented. 00128 // Furthermore there was the need to support the casa data types, in particular 00129 // reversal of array axes was needed. 00130 // </motivation> 00131 00132 // <todo asof="2008/03/13"> 00133 // <li> Make it possible to store empty arrays (e.g. as a compound of a 00134 // scalar (defining its type) and a vector (defining its shape). 00135 // <li> Set the optimal data set chunk cache size from a given access pattern. 00136 // The current problem is that you can only set the cache size at the 00137 // HDF5 file level, not at the data set level. Furthermore, setting 00138 // the cache size requires that the file is closed first. 00139 // For the time being a fixed cache size of 16 MB is used instead of 00140 // the default 1 MB. 00141 // </todo> 00142 00143 // </module> 00144 00145 00146 } //# NAMESPACE CASACORE - END 00147 00148 #endif