Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Purpose: Declaration of the CExternalChannel class. 4 : * 5 : * This class is used to implement band interleaved channels that are 6 : * references to an external image database that is not just a raw file. 7 : * It uses the application supplied EDB interface to access non-PCIDSK files. 8 : * 9 : ****************************************************************************** 10 : * Copyright (c) 2010 11 : * PCI Geomatics, 90 Allstate Parkway, Markham, Ontario, Canada. 12 : * 13 : * SPDX-License-Identifier: MIT 14 : ****************************************************************************/ 15 : 16 : #ifndef INCLUDE_CHANNEL_CEXTERNALCHANNEL_H 17 : #define INCLUDE_CHANNEL_CEXTERNALCHANNEL_H 18 : 19 : #include "pcidsk_config.h" 20 : #include "pcidsk_types.h" 21 : #include "pcidsk_buffer.h" 22 : #include "channel/cpcidskchannel.h" 23 : #include <string> 24 : 25 : namespace PCIDSK 26 : { 27 : class CPCIDSKFile; 28 : 29 : /************************************************************************/ 30 : /* CExternalChannel */ 31 : /************************************************************************/ 32 : 33 : class CExternalChannel : public CPCIDSKChannel 34 : { 35 : public: 36 : CExternalChannel( PCIDSKBuffer &image_header, 37 : uint64 ih_offset, 38 : PCIDSKBuffer &file_header, 39 : const std::string& filename, 40 : int channelnum, 41 : CPCIDSKFile *file, 42 : eChanType pixel_type ); 43 : virtual ~CExternalChannel(); 44 : 45 : virtual eChanType GetType() const override; 46 : virtual int GetBlockWidth() const override; 47 : virtual int GetBlockHeight() const override; 48 : virtual int ReadBlock( int block_index, void *buffer, 49 : int xoff=-1, int yoff=-1, 50 : int xsize=-1, int ysize=-1 ) override; 51 : virtual int WriteBlock( int block_index, void *buffer ) override; 52 : 53 : virtual void GetEChanInfo( std::string &filename, int &echannel, 54 : int &exoff, int &eyoff, 55 : int &exsize, int &eysize ) const override; 56 : virtual void SetEChanInfo( std::string filename, int echannel, 57 : int exoff, int eyoff, 58 : int exsize, int eysize ) override; 59 : 60 0 : std::string GetExternalFilename(){return filename;} 61 0 : int GetExternalChanNum(){return echannel;} 62 : 63 : private: 64 : int exoff; 65 : int eyoff; 66 : int exsize; 67 : int eysize; 68 : 69 : int echannel; 70 : 71 : mutable int blocks_per_row; 72 : 73 : mutable EDBFile *db; 74 : mutable Mutex *mutex; 75 : mutable bool writable; 76 : 77 : void AccessDB() const; 78 : 79 : mutable std::string filename; 80 : }; 81 : } // end namespace PCIDSK 82 : 83 : #endif // INCLUDE_CHANNEL_CEXTERNALCHANNEL_H