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 HDF5PAGER_H 00011 #define HDF5PAGER_H 00012 00013 #include "HdfPager.h" 00014 #include "Hdf5PagerFileHandle.h" 00015 00016 #include <hdf5.h> 00017 00018 /** 00019 * This class is an on-disk accessor for HDF5 files. 00020 * 00021 * Under current conditions, no one will need to derive from Hdf5Pager unless 00022 * multiple HDF datasets correspond to a single data cube. 00023 * 00024 * This pager should only be used with datasets that have two 00025 * or three dimensions. If used with datasets having two 00026 * dimensions, the band count must be 1 and the interleave format 00027 * must be BIP. 00028 */ 00029 class Hdf5Pager : public HdfPager, public Hdf5PagerFileHandle 00030 { 00031 public: 00032 SETTING(CacheSize, Hdf5Pager, unsigned int, 1024 * 1024) 00033 SETTING(ChunkBufferSize, Hdf5Pager, unsigned int, 64 * 1024) 00034 00035 /** 00036 * Creates an RasterPager for HDF5 data. 00037 * 00038 * If you create a subclass, make sure to call setName() to something unique. Two plug-ins with 00039 * the same name will cause problems. 00040 */ 00041 Hdf5Pager(); 00042 00043 /** 00044 * Destroys the RasterPager for HDF5 data. 00045 * 00046 * Closes the file and dataset that was opened by openFile(). 00047 */ 00048 ~Hdf5Pager(); 00049 00050 /** 00051 * @copydoc Hdf5PagerFileHandle::getFileHandle() 00052 */ 00053 hid_t getFileHandle(); 00054 00055 private: 00056 Hdf5Pager& operator=(const Hdf5Pager& rhs); 00057 00058 // file and data handles. 00059 hid_t mFileHandle; 00060 hid_t mDataHandle; 00061 hid_t mFileAccessProperties; 00062 00063 /** 00064 * Opens the HDF5 file and dataset. 00065 * 00066 * Opens the HDF5 file by calling H5Fopen(filename.c_str()) 00067 * Opens the HDF5 data handle by calling getHdfDatasetName() and H5Dopen1 on the resulting dataset name. 00068 */ 00069 bool openFile(const std::string& filename); 00070 00071 /** 00072 * Closes the HDF5 dataset and file handles. 00073 */ 00074 void closeFile(); 00075 00076 /** 00077 * Fetches a cache unit from an HDF5 file. 00078 */ 00079 CachedPage::UnitPtr fetchUnit(DataRequest *pOriginalRequest); 00080 }; 00081 00082 #endif