LCOV - code coverage report
Current view: directory - frmts/pcidsk/sdk/channel - cpcidskchannel.h (source / functions) Found Hit Coverage
Test: gdal_filtered.info Lines: 12 12 100.0 %
Date: 2011-12-18 Functions: 9 9 100.0 %

       1                 : /******************************************************************************
       2                 :  *
       3                 :  * Purpose:  Declaration of the CPCIDSKChannel Abstract class.
       4                 :  * 
       5                 :  ******************************************************************************
       6                 :  * Copyright (c) 2009
       7                 :  * PCI Geomatics, 50 West Wilmot Street, Richmond Hill, Ont, Canada
       8                 :  *
       9                 :  * Permission is hereby granted, free of charge, to any person obtaining a
      10                 :  * copy of this software and associated documentation files (the "Software"),
      11                 :  * to deal in the Software without restriction, including without limitation
      12                 :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      13                 :  * and/or sell copies of the Software, and to permit persons to whom the
      14                 :  * Software is furnished to do so, subject to the following conditions:
      15                 :  *
      16                 :  * The above copyright notice and this permission notice shall be included
      17                 :  * in all copies or substantial portions of the Software.
      18                 :  *
      19                 :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
      20                 :  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      21                 :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      22                 :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      23                 :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      24                 :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      25                 :  * DEALINGS IN THE SOFTWARE.
      26                 :  ****************************************************************************/
      27                 : #ifndef __INCLUDE_CHANNEL_CPCIDSKCHANNEL_H
      28                 : #define __INCLUDE_CHANNEL_CPCIDSKCHANNEL_H
      29                 : 
      30                 : #include "pcidsk_config.h"
      31                 : #include "pcidsk_buffer.h"
      32                 : #include "pcidsk_channel.h"
      33                 : #include "core/metadataset.h"
      34                 : #include "core/mutexholder.h"
      35                 : #include <vector>
      36                 : #include <string>
      37                 : 
      38                 : namespace PCIDSK
      39                 : {
      40                 :     class CPCIDSKFile;
      41                 :     class CTiledChannel;
      42                 : /************************************************************************/
      43                 : /*                            CPCIDSKChannel                            */
      44                 : /*                                                                      */
      45                 : /* Abstract class that helps implement some of the more mundane details */
      46                 : /* required for when implementing an imagery channel I/O strategy.  If  */
      47                 : /* you are using this to implement those details, use virtual           */
      48                 : /* inheritance to attempt to avoid the fragile base class problem and   */
      49                 : /* then implement the Imagery I/O functions.                            */
      50                 : /************************************************************************/
      51                 :     class CPCIDSKChannel : public PCIDSKChannel
      52                 :     {
      53                 :         friend class PCIDSKFile;
      54                 : 
      55                 :     public:
      56                 :         CPCIDSKChannel( PCIDSKBuffer &image_header, uint64 ih_offset,
      57                 :             CPCIDSKFile *file, eChanType pixel_type,
      58                 :             int channel_number );
      59                 :         virtual   ~CPCIDSKChannel();
      60                 : 
      61             340 :         virtual int GetBlockWidth() const { return block_width; }
      62             340 :         virtual int GetBlockHeight() const { return block_height; }
      63                 :         virtual int GetBlockCount() const;
      64                 : 
      65               6 :         virtual int GetWidth() const { return width; }
      66               6 :         virtual int GetHeight() const { return height; }
      67             447 :         virtual eChanType GetType() const { return pixel_type; }
      68                 : 
      69                 :         int       GetOverviewCount();
      70                 :         PCIDSKChannel  *GetOverview( int i );
      71                 :         bool IsOverviewValid( int i );
      72                 :         void SetOverviewValidity( int i, bool validity );
      73                 :         std::string GetOverviewResampling( int i );
      74                 :         std::vector<int> GetOverviewLevelMapping() const;
      75                 : 
      76                 :         int         GetChannelNumber() { return channel_number; }
      77                 : 
      78              70 :         std::string GetMetadataValue( const std::string &key ) const 
      79              70 :             { return metadata.GetMetadataValue(key); }
      80               8 :         void        SetMetadataValue( const std::string &key, const std::string &value ) 
      81               8 :             { metadata.SetMetadataValue(key,value); }
      82             209 :         std::vector<std::string> GetMetadataKeys() const
      83             209 :             { return metadata.GetMetadataKeys(); }
      84                 : 
      85             179 :         virtual void Synchronize() {}
      86                 : 
      87                 :         std::string GetDescription();
      88                 :         void SetDescription( const std::string &description );
      89                 : 
      90                 :         virtual std::vector<std::string> GetHistoryEntries() const;
      91                 :         virtual void SetHistoryEntries( const std::vector<std::string> &entries );
      92                 :         virtual void PushHistory(const std::string &app,
      93                 :                                  const std::string &message);
      94                 : 
      95                 :         virtual void GetChanInfo( std::string &filename, uint64 &image_offset, 
      96                 :                                   uint64 &pixel_offset, uint64 &line_offset, 
      97                 :                                   bool &little_endian ) const;
      98                 :         virtual void SetChanInfo( std::string filename, uint64 image_offset, 
      99                 :                                   uint64 pixel_offset, uint64 line_offset, 
     100                 :                                   bool little_endian );
     101                 :         virtual void GetEChanInfo( std::string &filename, int &echannel,
     102                 :                                    int &exoff, int &eyoff, 
     103                 :                                    int &exsize, int &eysize ) const;
     104                 :         virtual void SetEChanInfo( std::string filename, int echannel,
     105                 :                                    int exoff, int eyoff, 
     106                 :                                    int exsize, int eysize );
     107                 : 
     108                 :     // Just for CPCIDSKFile.
     109                 :         void      InvalidateOverviewInfo();
     110                 : 
     111                 :     protected:
     112                 :         CPCIDSKFile *file;
     113                 :         mutable MetadataSet  metadata;
     114                 : 
     115                 :         void LoadHistory( const PCIDSKBuffer &image_header );
     116                 :         std::vector<std::string> history_;
     117                 : 
     118                 :         int       channel_number;
     119                 :         uint64    ih_offset;
     120                 :         mutable eChanType pixel_type;
     121                 :         char      byte_order; // 'S': littleendian, 'N': bigendian
     122                 :         mutable int       needs_swap;
     123                 : 
     124                 :     // width/height, and block size.
     125                 :         mutable int       width;
     126                 :         mutable int       height;
     127                 :         mutable int       block_width;
     128                 :         mutable int       block_height;
     129                 : 
     130                 :     // info about overviews;
     131                 :         void      EstablishOverviewInfo() const;
     132                 : 
     133                 :         mutable bool                         overviews_initialized;
     134                 :         mutable std::vector<std::string>     overview_infos;
     135                 :         mutable std::vector<CTiledChannel *> overview_bands;
     136                 :         mutable std::vector<int>             overview_decimations;
     137                 : 
     138                 :         void      InvalidateOverviews();
     139                 :     };
     140                 : } // end namespace PCIDSK
     141                 : 
     142                 : #endif // __INCLUDE_CHANNEL_CPCIDSKCHANNEL_H

Generated by: LCOV version 1.7