File: PbiFilter_CustomFilter.txt

package info (click to toggle)
pbbam 0.19.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 10,280 kB
  • sloc: cpp: 50,244; python: 1,371; ansic: 949; xml: 903; sh: 317; makefile: 185
file content (21 lines) | stat: -rw-r--r-- 557 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
struct MyCustomFilter
{
    bool Accepts(const PbiRawData& index, const size_t row) const
    {
        // Look up data for record at the provided row. Do any calculations
        // necessary, then return whether that record passes your 
        // filter criteria. 
        
        return true;
    }
};

// use in composite filters
PbiFilter f;
f.Add(PbiMovieNameFilter("foo"));
f.Add(MyCustomFilter());

// pass directly to PbiFilterQuery
PbiFilterQuery query(MyCustomFilter(), "foo.bam");
for (const BamRecord& record : query)
    // ... do stuff ...