1 : /******************************************************************************
2 : *
3 : * Purpose: Declaration of the PCIDSKFile Interface
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_PCIDSK_FILE_H
28 : #define __INCLUDE_PCIDSK_FILE_H
29 :
30 : #include "pcidsk_segment.h"
31 : #include <string>
32 : #include <vector>
33 :
34 : namespace PCIDSK
35 : {
36 : /************************************************************************/
37 : /* PCIDSKFile */
38 : /************************************************************************/
39 :
40 : class PCIDSKChannel;
41 : class PCIDSKSegment;
42 : class PCIDSKInterfaces;
43 : class Mutex;
44 :
45 : //! Top interface to PCIDSK (.pix) files.
46 : class PCIDSK_DLL PCIDSKFile
47 78 : {
48 : public:
49 78 : virtual ~PCIDSKFile() {};
50 :
51 : virtual PCIDSKInterfaces *GetInterfaces() = 0;
52 :
53 : virtual PCIDSKChannel *GetChannel( int band ) = 0;
54 : virtual PCIDSKSegment *GetSegment( int segment ) = 0;
55 : virtual std::vector<PCIDSKSegment *> GetSegments() = 0;
56 :
57 : virtual PCIDSK::PCIDSKSegment *GetSegment( int type,
58 : std::string name,
59 : int previous = 0 ) = 0;
60 :
61 : virtual int GetWidth() const = 0;
62 : virtual int GetHeight() const = 0;
63 : virtual int GetChannels() const = 0;
64 : virtual std::string GetInterleaving() const = 0;
65 : virtual bool GetUpdatable() const = 0;
66 : virtual uint64 GetFileSize() const = 0;
67 :
68 : virtual int CreateSegment( std::string name, std::string description,
69 : eSegType seg_type, int data_blocks ) = 0;
70 : virtual void DeleteSegment( int segment ) = 0;
71 : virtual void CreateOverviews( int chan_count, int *chan_list,
72 : int factor, std::string resampling ) = 0;
73 :
74 : // the following are only for pixel interleaved IO
75 : virtual int GetPixelGroupSize() const = 0;
76 : virtual void *ReadAndLockBlock( int block_index, int xoff=-1, int xsize=-1) = 0;
77 : virtual void UnlockBlock( bool mark_dirty = false ) = 0;
78 :
79 : // low level io, primarily internal.
80 : virtual void WriteToFile( const void *buffer, uint64 offset, uint64 size)=0;
81 : virtual void ReadFromFile( void *buffer, uint64 offset, uint64 size ) = 0;
82 :
83 : virtual void GetIODetails( void ***io_handle_pp, Mutex ***io_mutex_pp,
84 : std::string filename = "" ) = 0;
85 :
86 : virtual std::string GetMetadataValue( const std::string& key ) = 0;
87 : virtual void SetMetadataValue( const std::string& key, const std::string& value ) = 0;
88 : virtual std::vector<std::string> GetMetadataKeys() = 0;
89 : };
90 : } // end namespace PCIDSK
91 :
92 : #endif // __INCLUDE_PCIDSK_FILE_H
|