LTP GCOV extension - code coverage report
Current view: directory - frmts/pcidsk/sdk/core - sysvirtualfile.h
Test: gdal_filtered.info
Date: 2010-07-12 Instrumented lines: 1
Code covered: 0.0 % Executed lines: 0

       1                 : /******************************************************************************
       2                 :  *
       3                 :  * Purpose:  Declaration of the SysVirtualFile class.
       4                 :  *
       5                 :  * This class is used to manage access to a single virtual file stored in
       6                 :  * SysBData segments based on a block map stored in the SysBMDir segment 
       7                 :  * (and managed by SysBlockMap class). 
       8                 :  *
       9                 :  * The virtual files are allocated in 8K chunks (block_size) in segments.
      10                 :  * To minimize IO requests, other overhead, we keep one such 8K block in
      11                 :  * our working cache for the virtual file stream.  
      12                 :  *
      13                 :  * This class is primarily used by the CTiledChannel class for access to 
      14                 :  * tiled images.
      15                 :  * 
      16                 :  ******************************************************************************
      17                 :  * Copyright (c) 2009
      18                 :  * PCI Geomatics, 50 West Wilmot Street, Richmond Hill, Ont, Canada
      19                 :  *
      20                 :  * Permission is hereby granted, free of charge, to any person obtaining a
      21                 :  * copy of this software and associated documentation files (the "Software"),
      22                 :  * to deal in the Software without restriction, including without limitation
      23                 :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      24                 :  * and/or sell copies of the Software, and to permit persons to whom the
      25                 :  * Software is furnished to do so, subject to the following conditions:
      26                 :  *
      27                 :  * The above copyright notice and this permission notice shall be included
      28                 :  * in all copies or substantial portions of the Software.
      29                 :  *
      30                 :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
      31                 :  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      32                 :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      33                 :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      34                 :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      35                 :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      36                 :  * DEALINGS IN THE SOFTWARE.
      37                 :  ****************************************************************************/
      38                 : #ifndef __INCLUDE_CORE_SYSVIRTUALFILE_H
      39                 : #define __INCLUDE_CORE_SYSVIRTUALFILE_H
      40                 : 
      41                 : #include "pcidsk_buffer.h"
      42                 : 
      43                 : #include <vector>
      44                 : 
      45                 : #define SYSVIRTUALFILE_BLOCKSIZE    8192
      46                 : 
      47                 : namespace PCIDSK
      48                 : {
      49                 :     class CPCIDSKFile;
      50                 :     class SysBlockMap;
      51                 :     /************************************************************************/
      52                 :     /*                            SysVirtualFile                            */
      53                 :     /************************************************************************/
      54                 : 
      55                 :     class SysVirtualFile
      56                 :     {
      57                 :     public:
      58                 :         SysVirtualFile( CPCIDSKFile *file, int start_block, uint64 image_length,
      59                 :                         PCIDSKBuffer &block_map_data, SysBlockMap *sysblockmap,
      60                 :                         int image_index );
      61                 :         ~SysVirtualFile();
      62                 : 
      63                 :         void      Synchronize();
      64                 : 
      65                 :         void      WriteToFile( const void *buffer, uint64 offset, uint64 size );
      66                 :         void      ReadFromFile( void *buffer, uint64 offset, uint64 size );
      67                 : 
      68               0 :         uint64    GetLength() { return file_length; }
      69                 :     
      70                 :         static const int       block_size;
      71                 :     
      72                 :     private:
      73                 :         CPCIDSKFile           *file;
      74                 :         SysBlockMap           *sysblockmap;
      75                 :         int                    image_index;
      76                 : 
      77                 :         uint64                 file_length;
      78                 : 
      79                 :         std::vector<int>       block_segment;
      80                 :         std::vector<int>       block_index;
      81                 : 
      82                 :         int                    loaded_block;
      83                 :         uint8                  block_data[SYSVIRTUALFILE_BLOCKSIZE];
      84                 :         bool                   loaded_block_dirty;
      85                 : 
      86                 :         int                    last_bm_index;
      87                 : 
      88                 :         void                   LoadBlock( int requested_block );
      89                 :         void                   LoadBlocks( int requested_block_start,
      90                 :             int requested_block_count, void* const buffer);
      91                 :         void                   GrowVirtualFile(std::ptrdiff_t requested_block);
      92                 :         void                   FlushDirtyBlock();
      93                 :         void                   WriteBlocks(int first_block, int block_count,
      94                 :             void* const buffer);
      95                 :     };
      96                 : }
      97                 : 
      98                 : #endif // __INCLUDE_CORE_SYSVIRTUALFILE_H

Generated by: LTP GCOV extension version 1.5