RasterPager.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 RASTERPAGER_H
00011 #define RASTERPAGER_H
00012 
00013 #include "DimensionDescriptor.h"
00014 
00015 class DataRequest;
00016 class RasterPage;
00017 
00018 /**
00019  *  Interface specific to RasterPager plug-ins.
00020  *
00021  *  This plug-in interface is used by the RasterElement to
00022  *  map sensor data from the source into memory so that it can be
00023  *  accessed from the rest of the application.  Each importer
00024  *  that supports on disk processing should provide an implementation
00025  *  of this interface to the RasterElement object representing
00026  *  the data being loaded by the importer.  This interface has no
00027  *  set methods because each importer should create it's own
00028  *  implementation of this interface, meaning that each importer
00029  *  should pass in any information needed by their implementation
00030  *  by using any set methods they provide on their implementation
00031  *  of this interface.  Each importer should actually subclass
00032  *  RasterPagerShell which provides some default implementation.
00033  *
00034  *  An instance of the RasterPager interface must be created by
00035  *  utilizing PlugInManagerServices::createPlugIn().  This is to ensure
00036  *  that PlugInManagerServices can reference count the resources currently
00037  *  be accessed by the Core from within the plugin dll, so that the plugin
00038  *  dll is not unloaded prematurely.
00039  *
00040  *  Each RasterElement instance will have its own unique instance of
00041  *  the RasterPager interface.  The RasterPager instance will have a lifetime
00042  *  equal to that of the RasterElement it is associated with.
00043  *  The RasterPager is required to
00044  *  return all resources back to the operating system on destruction.
00045  *  It is not explicitly required to return resources back to the operating
00046  *  system during the call of its releaseBlock() method.
00047  *
00048  *  @see RasterElement
00049  *  @see RasterPagerShell
00050  *  @see RasterPage
00051  */
00052 class RasterPager
00053 {
00054 public:
00055    /**
00056     *  This method should return an implementation of the RasterPage
00057     *  interface that will allow access to an in memory pointer of the
00058     *  requested data that has been loaded from the original file on disk.
00059     *
00060     *  The in memory pointer should point to a section of memory
00061     *  that adheres to the following constraints:
00062     *       <ul>
00063     *         <li>
00064     *         The memory pointer should point to raw cube data that is
00065     *         either formatted as specified in the pOriginalRequest parameter.
00066     *         </li>
00067     *         <li>
00068     *         The memory pointer should point to raw cube data where
00069     *         each pixel value is RasterDataDescriptor::getBytesPerElement() large.
00070     *         The DataDescriptor object should be retrieved from the
00071     *         RasterElement that this RasterPager is associated with.
00072     *         </li>
00073     *         <li>
00074     *         The memory pointer should point to raw cube data where
00075     *         there are only post-line bytes.  If there are post-line
00076     *         bytes, they should be equal to DatasetParameters::getPostlineBytes()
00077     *         The DatasetParameters object should be retrieved from the
00078     *         RasterElement that this RasterPager is associated with.
00079     *         </li>
00080     *         <li>
00081     *         The memory pointer should point to raw cube data that contains
00082     *         at minimum concurrentRows, concurrentBands, concurrentColumns worth of data
00083     *         that is directly acccessible in memory.
00084     *         </li>
00085     *       </ul>
00086     *  This method may be called simultaneously by multiple threads and is up to
00087     *  the implementer of this method to guarantee thread-safety in that case.
00088     *
00089     *  @param pOriginalRequest
00090     *         The request as originally made.  The fields on this object
00091     *         should be examined to determine if this pager can handle
00092     *         the request, and how to format it.  Use the other parameters
00093     *         to this method to determine where to start the RasterPage.
00094     *  @param startRow
00095     *         the start row of data that should be loaded from the original
00096     *         data file on disk into memory.
00097     *  @param startColumn
00098     *         the start column of data that should be loaded from the original
00099     *         data file on disk into memory.
00100     *  @param startBand
00101     *         the start band of data that should be loaded from the original
00102     *         data file on disk into memory.
00103     *
00104     *  @return a RasterPage object, that when the getRawData() pointer is called
00105     *          will return a pointer to the requested cube data.  This RasterPage
00106     *          object should not be directly deleted, but should be passed to
00107     *          the releasePage() method below when the RasterPage is no longer needed.
00108     *          
00109     *          If the request cannot be fulfilled, return NULL.
00110     */
00111    virtual RasterPage* getPage(DataRequest *pOriginalRequest,
00112       DimensionDescriptor startRow, 
00113       DimensionDescriptor startColumn, 
00114       DimensionDescriptor startBand) = 0;
00115 
00116    /**
00117     *  This method will release the RasterPage* that was requested earlier
00118     *  via the getPage() method.
00119     *
00120     *  This method should only release those
00121     *  RasterPage* that were returned by the getPage() method of the same
00122     *  instance of the RasterPager.
00123     *  This method may be called simultaneously by multiple threads and is up to
00124     *  the implementer of this method to guarantee thread-safety in that case.
00125     *
00126     *  @param pPage
00127     *         the RasterPage that should be released.
00128     */
00129    virtual void releasePage(RasterPage* pPage) = 0;
00130 
00131    /**
00132     * Get the highest version of DataRequest that this pager supports.
00133     *
00134     * RasterPagers can support a variety of conversions from the native data
00135     * to that request in a DataRequest.  getPage() should be implemented to check for
00136     * these conversions and return NULL if unsupported.
00137     *
00138     * As features are added, additional fields may be added to DataRequest.
00139     * The defaults for these fields will always be the same as on the RasterElement
00140     * being accessed.  Since these fields may be added without breaking compatibility with
00141     * existing RasterPager plug-ins, there will be existing plug-ins which do not know
00142     * to check these new fields and return NULL if unsupported.
00143     *
00144     * Return a value here to state what version of DataRequest is supported.
00145     * If any higher-version fields are changed from the defaults, the core will
00146     * assume that the RasterPager is unable to handle them, and the request will not be fulfilled.
00147     *
00148     * @return The highest request version supported.
00149     *
00150     * @see DataRequest::getRequestVersion()
00151     */
00152    virtual int getSupportedRequestVersion() const = 0;
00153 
00154 protected:
00155    /**
00156     *  Since the RasterPager interface is usually used in conjunction with the
00157     *  PlugIn and Executable interfaces, this should be destroyed by casting to
00158     *  the PlugIn interface and calling PlugInManagerServices::destroyPlugIn().
00159     */
00160    virtual ~RasterPager() {}
00161 
00162 private:
00163    friend class RasterElementImp;
00164 };
00165 
00166 #endif

Software Development Kit - Opticks 4.9.0 Build 16218