source: icGREP/icgrep-devel/icgrep/kernels/grep_kernel.h @ 5561

Last change on this file since 5561 was 5561, checked in by cameron, 22 months ago

Factor out required streams into a separate kernel

File size: 2.3 KB
Line 
1/*
2 *  Copyright (c) 2017 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 */
5#ifndef GREP_KERNEL_H
6#define GREP_KERNEL_H
7
8#include <pablo/pablo_kernel.h>  // for PabloKernel
9
10namespace IDISA { class IDISA_Builder; }
11namespace re { class RE; }
12namespace kernel {
13
14struct RegularExpressionOptimizer {
15    RegularExpressionOptimizer(re::RE * re_ast);
16protected:
17    re::RE * const  mRE;
18    std::string     mSignature;
19};
20
21
22   
23class RequiredStreams_UTF8 : public pablo::PabloKernel {
24public:
25    RequiredStreams_UTF8(const std::unique_ptr<kernel::KernelBuilder> & kb);
26    bool isCachable() const override { return true; }
27    bool hasSignature() const override { return false; }
28protected:
29    void generatePabloMethod() override;
30};
31
32class RequiredStreams_UTF16 : public pablo::PabloKernel {
33public:
34    RequiredStreams_UTF16(const std::unique_ptr<kernel::KernelBuilder> & kb);
35    bool isCachable() const override { return true; }
36    bool hasSignature() const override { return false; }
37protected:
38    void generatePabloMethod() override;
39};
40
41
42class ICGrepKernel : public RegularExpressionOptimizer, public pablo::PabloKernel {
43public:
44    ICGrepKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, re::RE * const re_ast);
45    std::string makeSignature(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override;
46    bool isCachable() const override { return true; }
47protected:
48    void generatePabloMethod() override;
49};
50
51class MatchedLinesKernel : public pablo::PabloKernel {
52public:
53    MatchedLinesKernel(const std::unique_ptr<kernel::KernelBuilder> & builder);
54    bool isCachable() const override { return true; }
55    bool hasSignature() const override { return false; }
56protected:
57    void generatePabloMethod() override;   
58};
59
60class InvertMatchesKernel : public BlockOrientedKernel {
61public:
62    InvertMatchesKernel(const std::unique_ptr<kernel::KernelBuilder> & builder);
63private:
64    void generateDoBlockMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override;
65};
66
67class PopcountKernel : public pablo::PabloKernel {
68public:
69    PopcountKernel(const std::unique_ptr<kernel::KernelBuilder> & builder);
70    bool isCachable() const override { return true; }
71    bool hasSignature() const override { return false; }
72protected:
73    void generatePabloMethod() override;   
74};
75   
76}
77#endif
Note: See TracBrowser for help on using the repository browser.