Hdf5ImporterShell.h

Go to the documentation of this file.
00001 /*
00002  * The information in this file is
00003  * Copyright(c) 2007 Ball Aerospace & Technologies Corporation
00004  * and is subject to the terms and conditions of the
00005  * GNU Lesser General Public License Version 2.1
00006  * The license text is available from   
00007  * http://www.gnu.org/licenses/lgpl.html
00008  */
00009 
00010 #ifndef HDF5IMPORTERSHELL_H
00011 #define HDF5IMPORTERSHELL_H
00012 
00013 #include "HdfImporterShell.h"
00014 
00015 #include <hdf5.h>
00016 
00017 class Hdf5FileResource;
00018 class RasterElement;
00019 
00020 /**
00021  * \ingroup ShellModule
00022  * The base class of an importer that loads data in HDF Version 5 format.
00023  *
00024  * The HDF5 Importer Shell is a class designed to wrap the HDF5 libraries and
00025  * provide a convenient means of importing simple (header, metadata, 1 cube)
00026  * HDF5 data. The shell class is highly customizable, but to use
00027  * these features requires downloading the HDF5 v1.6.2 precompiled libraries
00028  * from <A HREF=ftp://ftp.ncsa.uiuc.edu/HDF/HDF5/prev-releases/hdf5-1.6.5/bin/>*</A>
00029  * or <A HREF=ftp://ftp.ncsa.uiuc.edu/HDF/HDF5/hdf5-1.6.5/bin/>*</A>.
00030  *
00031  * To link a derived plug-in under Windows, define _HDF5USEDLL_ and link to hdf5dll.lib.
00032  * To link a derived plug-in under Solaris, define _HDF5USEDLL_ and link to libhdf5.so.0.0.0.
00033  * 
00034  */
00035 class Hdf5ImporterShell : public HdfImporterShell
00036 {
00037 protected:
00038    /**
00039     *  Constructs the Hdf5ImporterShell object to load file data in HDF Version 5 format.
00040     *
00041     *  Any class that derives from %Hdf5ImporterShell MUST link against:
00042     *  szlib.lib, zdll.lib, and hdf5.lib on Windows systems, and
00043     *  libsz.a, libz.a, and libhdf5.a on Solaris systems.
00044     */
00045    Hdf5ImporterShell();
00046 
00047    /**
00048     *  Destroys the Hdf5ImporterShell object.
00049     */
00050    ~Hdf5ImporterShell() {}
00051 
00052    /**
00053     * Retrieve open HDF5 library handle to the file. This may either involve directly opening the file
00054     * or retrieving the already open file handle from the Hdf5Pager if the file was loaded on-disk read-only.
00055     * Never attempt to just open the file using the HDF5 api because they specifically warn against a single process
00056     * opening the same file twice with the HDF5 api.
00057     *
00058     *  @param  fileHandle
00059     *          On successful return, the fileHandle to use for HDF5 library access.
00060     *  @param fileResource
00061     *         An Hdf5FileResource which must remain in scope while fileHandle is being used.
00062     *         On successful return, the resource may or may not be valid, depending on how pElement was loaded.
00063     *
00064     *  @return True if fileHandle is valid, false otherwise.
00065     */
00066    bool getFileHandle(hid_t& fileHandle, Hdf5FileResource& fileResource) const;
00067 
00068 private:
00069   /**
00070     * Creates an RasterPager Plug-In and sets it in the RasterElement.
00071     *
00072     * This method can be overridden for importers that do not have a one-to-one correspondence between
00073     * an HDF dataset and an RasterElement (ie. MODIS). Those that load one HDF dataset as a RasterElement
00074     * can use the default implementation provided.
00075     *
00076     * Called from HdfImporterShell::createRasterPagerPlugIn(const string&, const string&, RasterElement&).
00077     *
00078     * @param  pRaster
00079     *         A pointer to the RasterElement for placing the raster pager plug-in.
00080     *
00081     * @return TRUE if the operation succeeds, FALSE otherwise.
00082     */
00083    bool createRasterPager(RasterElement *pRaster) const;
00084 };
00085 
00086 #endif

Software Development Kit - Opticks 4.9.0 Build 16218