LCOV - code coverage report
Current view: top level - frmts/pcidsk/sdk/segment - cpcidsksegment.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 6 9 66.7 %
Date: 2024-11-21 22:18:42 Functions: 6 9 66.7 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Purpose:  Declaration of the CPCIDSKSegment class.
       4             :  *
       5             :  ******************************************************************************
       6             :  * Copyright (c) 2009
       7             :  * PCI Geomatics, 90 Allstate Parkway, Markham, Ontario, Canada.
       8             :  *
       9             :  * SPDX-License-Identifier: MIT
      10             :  ****************************************************************************/
      11             : 
      12             : #ifndef INCLUDE_SEGMENT_PCIDSKSEGMENT_H
      13             : #define INCLUDE_SEGMENT_PCIDSKSEGMENT_H
      14             : 
      15             : #include "pcidsk_config.h"
      16             : #include "pcidsk_types.h"
      17             : #include "pcidsk_buffer.h"
      18             : #include "pcidsk_segment.h"
      19             : 
      20             : #include <string>
      21             : #include <vector>
      22             : 
      23             : namespace PCIDSK
      24             : {
      25             :     class PCIDSKFile;
      26             :     class MetadataSet;
      27             : 
      28             : /************************************************************************/
      29             : /*                            CPCIDSKSegment                            */
      30             : /*                                                                      */
      31             : /*      Base class for accessing all segments.  Provides core           */
      32             : /*      PCIDSKObject implementation for segments with raw segment io    */
      33             : /*      options.                                                        */
      34             : /************************************************************************/
      35             : 
      36             :     class CPCIDSKSegment : virtual public PCIDSKSegment
      37             :     {
      38             :     public:
      39             :         CPCIDSKSegment( PCIDSKFile *file, int segment,
      40             :             const char *segment_pointer );
      41             :         virtual ~CPCIDSKSegment();
      42             : 
      43             :         void        LoadSegmentPointer( const char *segment_pointer ) override final;
      44             :         void        LoadSegmentHeader();
      45             : 
      46        5699 :         PCIDSKBuffer &GetHeader() { return header; }
      47             :         void        FlushHeader();
      48             : 
      49             :         void      WriteToFile( const void *buffer, uint64 offset, uint64 size ) override;
      50             :         void      ReadFromFile( void *buffer, uint64 offset, uint64 size ) override;
      51             : 
      52           0 :         eSegType    GetSegmentType() override { return segment_type; }
      53        1183 :         std::string GetName() override { return segment_name; }
      54             :         std::string GetDescription() override;
      55          96 :         int         GetSegmentNumber() override { return segment; }
      56           0 :         bool        IsContentSizeValid() const override { return data_size >= 1024; }
      57         142 :         uint64      GetContentSize() override { return data_size - 1024; }
      58          46 :         uint64      GetContentOffset() override { return data_offset; }
      59             :         bool        IsAtEOF() override;
      60             :         bool        CanExtend(uint64 size) const override;
      61             : 
      62             :         void        SetDescription( const std::string &description) override;
      63             : 
      64             :         std::string GetMetadataValue( const std::string &key ) const override;
      65             :         void        SetMetadataValue( const std::string &key, const std::string &value ) override;
      66             :         std::vector<std::string> GetMetadataKeys() const override;
      67             : 
      68         241 :         virtual void Synchronize() override {}
      69             : 
      70             :         std::vector<std::string> GetHistoryEntries() const override;
      71             :         void SetHistoryEntries( const std::vector<std::string> &entries ) override;
      72             :         void PushHistory(const std::string &app,
      73             :                          const std::string &message) override;
      74             : 
      75           0 :         virtual std::string ConsistencyCheck() override { return ""; }
      76             : 
      77             :     protected:
      78             :         PCIDSKFile *file;
      79             : 
      80             :         int         segment;
      81             : 
      82             :         eSegType    segment_type;
      83             :         char        segment_flag;
      84             :         std::string segment_name;
      85             : 
      86             :         uint64      data_offset;     // includes 1024 byte segment header.
      87             :         uint64      data_size;
      88             :         uint64      data_size_limit;
      89             : 
      90             :         PCIDSKBuffer header;
      91             : 
      92             :         mutable MetadataSet  *metadata;
      93             : 
      94             :         std::vector<std::string> history_;
      95             : 
      96             :         void        MoveData( uint64 src_offset, uint64 dst_offset,
      97             :                               uint64 size_in_bytes );
      98             :     };
      99             : 
     100             : } // end namespace PCIDSK
     101             : #endif // INCLUDE_SEGMENT_PCIDSKSEGMENT_H

Generated by: LCOV version 1.14