LCOV - code coverage report
Current view: top level - src - filter.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 10 10 100.0 %
Date: 2019-01-29 11:06:41 Functions: 3 3 100.0 %

          Line data    Source code
       1             : //////////////////////////////////////////////////////////////////////
       2             : //
       3             : //  FILE:       filter.h
       4             : //              Filter and CompressedFilter Classes
       5             : //
       6             : //  Part of:    Scid (Shane's Chess Information Database)
       7             : //  Version:    1.4
       8             : //
       9             : //  Notice:     Copyright (c) 2000  Shane Hudson.  All rights reserved.
      10             : //
      11             : //  Author:     Shane Hudson (sgh@users.sourceforge.net)
      12             : //
      13             : //////////////////////////////////////////////////////////////////////
      14             : 
      15             : 
      16             : #ifndef SCID_FILTER_H
      17             : #define SCID_FILTER_H
      18             : 
      19             : #include "common.h"
      20             : 
      21             : 
      22             : //////////////////////////////////////////////////////////////////////
      23             : //
      24             : // CompressedFilter class:
      25             : //    Holds the same data as a filter, in compressed format.
      26             : //    Random access to individual values is not possible.
      27             : //    A CompressedFilter is created from, or restored to, a regular
      28             : //    filter with the methods CompressFrom() and UncompressTo().
      29             : class CompressedFilter
      30             : {
      31             :   private:
      32             : 
      33             :     uint    CFilterSize;
      34             :     uint    CFilterCount;
      35             :     uint    CompressedLength;
      36             :     byte *  CompressedData;
      37             : 
      38             :   public:
      39        3500 :     CompressedFilter (void)     { Init(); }
      40        7000 :     ~CompressedFilter (void) {
      41        3500 :         if (CompressedData != NULL) delete[] CompressedData;
      42        3500 :     }
      43             : 
      44             :     inline void Clear();
      45             : 
      46             :     uint Size() const { return CFilterSize; }
      47             :     uint Count() { return CFilterCount; }
      48             : 
      49             :     errorT Verify (Filter * filter);
      50             : 
      51             :     void CompressFrom (Filter * filter);
      52             :     errorT UncompressTo(Filter * filter) const;
      53             : 
      54             :   private:
      55             :     CompressedFilter(const CompressedFilter&);
      56             :     void operator=(const CompressedFilter&);
      57             : 
      58             :     inline void Init();
      59             : };
      60             : 
      61             : inline void
      62        3500 : CompressedFilter::Init ()
      63             : {
      64        3500 :     CFilterSize = 0;
      65        3500 :     CFilterCount = 0;
      66        3500 :     CompressedLength = 0;
      67        3500 :     CompressedData = NULL;
      68        3500 : }
      69             : 
      70             : inline void
      71             : CompressedFilter::Clear ()
      72             : {
      73             :     if (CompressedData != NULL) { delete[] CompressedData; }
      74             :     Init();
      75             : }
      76             : 
      77             : 
      78             : #endif  // #ifndef SCID_FILTER_H
      79             : 
      80             : //////////////////////////////////////////////////////////////////////
      81             : //  EOF: filter.h
      82             : //////////////////////////////////////////////////////////////////////

Generated by: LCOV version 1.13