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

Last change on this file since 5866 was 5816, checked in by cameron, 20 months ago

Supporting multiple alphabets in RE compilation - initial check-in

File size: 2.4 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 cc { class Alphabet; }
13namespace kernel {
14
15   
16class RequiredStreams_UTF8 : public pablo::PabloKernel {
17public:
18    RequiredStreams_UTF8(const std::unique_ptr<kernel::KernelBuilder> & kb);
19    bool isCachable() const override { return true; }
20    bool hasSignature() const override { return false; }
21protected:
22    void generatePabloMethod() override;
23};
24
25class RequiredStreams_UTF16 : public pablo::PabloKernel {
26public:
27    RequiredStreams_UTF16(const std::unique_ptr<kernel::KernelBuilder> & kb);
28    bool isCachable() const override { return true; }
29    bool hasSignature() const override { return false; }
30protected:
31    void generatePabloMethod() override;
32};
33
34
35struct ICGrepSignature {
36    ICGrepSignature(re::RE * re_ast);
37protected:
38    re::RE * const  mRE;
39    std::string     mSignature;
40};
41
42   
43class ICGrepKernel : public ICGrepSignature, public pablo::PabloKernel {
44public:
45    ICGrepKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, re::RE * const re_ast, std::vector<cc::Alphabet *> alphabets = {});
46    std::string makeSignature(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override;
47    bool isCachable() const override { return true; }
48protected:
49    void generatePabloMethod() override;
50    std::vector<cc::Alphabet *> mAlphabets;
51};
52
53class MatchedLinesKernel : public pablo::PabloKernel {
54public:
55    MatchedLinesKernel(const std::unique_ptr<kernel::KernelBuilder> & builder);
56    bool isCachable() const override { return true; }
57    bool hasSignature() const override { return false; }
58protected:
59    void generatePabloMethod() override;   
60};
61
62class InvertMatchesKernel : public BlockOrientedKernel {
63public:
64    InvertMatchesKernel(const std::unique_ptr<kernel::KernelBuilder> & builder);
65private:
66    void generateDoBlockMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override;
67};
68
69class PopcountKernel : public pablo::PabloKernel {
70public:
71    PopcountKernel(const std::unique_ptr<kernel::KernelBuilder> & builder);
72    bool isCachable() const override { return true; }
73    bool hasSignature() const override { return false; }
74protected:
75    void generatePabloMethod() override;   
76};
77   
78}
79#endif
Note: See TracBrowser for help on using the repository browser.