Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Purpose: Support for reading and manipulating general PCIDSK Binary Segments 4 : * 5 : ****************************************************************************** 6 : * Copyright (c) 2010 7 : * PCI Geomatics, 90 Allstate Parkway, Markham, Ontario, 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_SEGMENT_PCIDSKBINARY_SEG_H 28 : #define INCLUDE_PCIDSK_SEGMENT_PCIDSKBINARY_SEG_H 29 : 30 : #include "pcidsk_binary.h" 31 : #include "segment/cpcidsksegment.h" 32 : 33 : namespace PCIDSK { 34 : class PCIDSKFile; 35 : 36 : class CPCIDSKBinarySegment : public PCIDSKBinarySegment, 37 : public CPCIDSKSegment 38 : { 39 : public: 40 : CPCIDSKBinarySegment(PCIDSKFile *file, int segment, 41 : const char *segment_pointer, bool bLoad=true); 42 : ~CPCIDSKBinarySegment(); 43 : 44 0 : const char* GetBuffer(void) const override 45 : { 46 0 : return seg_data.buffer; 47 : } 48 : 49 0 : unsigned int GetBufferSize(void) const override 50 : { 51 0 : return seg_data.buffer_size; 52 : } 53 : void SetBuffer(const char* pabyBuf, 54 : unsigned int nBufSize) override; 55 : 56 : //synchronize the segment on disk. 57 : void Synchronize() override; 58 : private: 59 : 60 : // Helper housekeeping functions 61 : void Load(); 62 : void Write(); 63 : 64 : //functions to read/write binary information 65 : protected: 66 : // The raw segment data 67 : PCIDSKBuffer seg_data; 68 : bool loaded_; 69 : bool mbModified; 70 : }; 71 : } 72 : 73 : #endif // INCLUDE_PCIDSK_SEGMENT_PCIDSKBINARY_SEG_H