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

Last change on this file since 5864 was 5816, checked in by cameron, 19 months ago

Supporting multiple alphabets in RE compilation - initial check-in

File size: 2.4 KB
RevLine 
[5404]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
[5408]9
[5404]10namespace IDISA { class IDISA_Builder; }
[5408]11namespace re { class RE; }
[5816]12namespace cc { class Alphabet; }
[5404]13namespace kernel {
14
[5561]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
[5769]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 {
[5404]44public:
[5816]45    ICGrepKernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, re::RE * const re_ast, std::vector<cc::Alphabet *> alphabets = {});
[5440]46    std::string makeSignature(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override;
[5431]47    bool isCachable() const override { return true; }
[5436]48protected:
49    void generatePabloMethod() override;
[5816]50    std::vector<cc::Alphabet *> mAlphabets;
[5404]51};
52
[5548]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
[5413]62class InvertMatchesKernel : public BlockOrientedKernel {
63public:
[5436]64    InvertMatchesKernel(const std::unique_ptr<kernel::KernelBuilder> & builder);
[5413]65private:
[5440]66    void generateDoBlockMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override;
[5413]67};
68
69class PopcountKernel : public pablo::PabloKernel {
70public:
[5436]71    PopcountKernel(const std::unique_ptr<kernel::KernelBuilder> & builder);
[5491]72    bool isCachable() const override { return true; }
73    bool hasSignature() const override { return false; }
74protected:
75    void generatePabloMethod() override;   
[5413]76};
[5548]77   
[5404]78}
79#endif
Note: See TracBrowser for help on using the repository browser.