LCOV - code coverage report
Current view: top level - matcher - extraweightpostlist.h (source / functions) Hit Total Coverage
Test: Test Coverage for xapian-core 7028d852e609 Lines: 5 5 100.0 %
Date: 2019-02-17 14:59:59 Functions: 2 2 100.0 %
Branches: 3 6 50.0 %

           Branch data     Line data    Source code
       1                 :            : /** @file extraweightpostlist.h
       2                 :            :  * @brief PostList which adds on a term-independent weight contribution
       3                 :            :  */
       4                 :            : /* Copyright 2017 Olly Betts
       5                 :            :  *
       6                 :            :  * This program is free software; you can redistribute it and/or
       7                 :            :  * modify it under the terms of the GNU General Public License as
       8                 :            :  * published by the Free Software Foundation; either version 2 of the
       9                 :            :  * License, or (at your option) any later version.
      10                 :            :  *
      11                 :            :  * This program is distributed in the hope that it will be useful,
      12                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      13                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14                 :            :  * GNU General Public License for more details.
      15                 :            :  *
      16                 :            :  * You should have received a copy of the GNU General Public License
      17                 :            :  * along with this program; if not, write to the Free Software
      18                 :            :  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
      19                 :            :  */
      20                 :            : 
      21                 :            : #ifndef XAPIAN_INCLUDED_EXTRAWEIGHTPOSTLIST_H
      22                 :            : #define XAPIAN_INCLUDED_EXTRAWEIGHTPOSTLIST_H
      23                 :            : 
      24                 :            : #include "wrapperpostlist.h"
      25                 :            : 
      26                 :            : namespace Xapian {
      27                 :            : class Weight;
      28                 :            : }
      29                 :            : 
      30                 :            : class PostListTree;
      31                 :            : 
      32                 :            : /// PostList which adds on a term-independent weight contribution
      33                 :            : class ExtraWeightPostList : public WrapperPostList {
      34                 :            :     /// Don't allow assignment.
      35                 :            :     void operator=(const ExtraWeightPostList&) = delete;
      36                 :            : 
      37                 :            :     /// Don't allow copying.
      38                 :            :     ExtraWeightPostList(const ExtraWeightPostList&) = delete;
      39                 :            : 
      40                 :            :     Xapian::Weight* weight;
      41                 :            : 
      42                 :            :     PostListTree* pltree;
      43                 :            : 
      44                 :            :     double max_extra;
      45                 :            : 
      46                 :            :   public:
      47                 :       1334 :     ExtraWeightPostList(PostList* pl_,
      48                 :            :                         Xapian::Weight* weight_,
      49                 :            :                         PostListTree* pltree_)
      50                 :            :         : WrapperPostList(pl_),
      51                 :            :           weight(weight_),
      52                 :            :           pltree(pltree_),
      53         [ +  - ]:       1334 :           max_extra(weight->get_maxextra()) {}
      54                 :            : 
      55                 :       4002 :     ~ExtraWeightPostList() {
      56         [ +  - ]:       1334 :         delete weight;
      57         [ -  + ]:       2668 :     }
      58                 :            : 
      59                 :            :     double get_weight(Xapian::termcount doclen,
      60                 :            :                       Xapian::termcount unique_terms) const;
      61                 :            : 
      62                 :            :     double recalc_maxweight();
      63                 :            : 
      64                 :            :     PostList* next(double w_min);
      65                 :            : 
      66                 :            :     PostList* skip_to(Xapian::docid, double w_min);
      67                 :            : 
      68                 :            :     std::string get_description() const;
      69                 :            : };
      70                 :            : 
      71                 :            : #endif // XAPIAN_INCLUDED_EXTRAWEIGHTPOSTLIST_H

Generated by: LCOV version 1.11