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

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

Grapheme Cluster Break kernel

File size: 2.5 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<std::string> externals, 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<std::string> mExternals;
51    std::vector<cc::Alphabet *> mAlphabets;
52};
53
54class MatchedLinesKernel : public pablo::PabloKernel {
55public:
56    MatchedLinesKernel(const std::unique_ptr<kernel::KernelBuilder> & builder);
57    bool isCachable() const override { return true; }
58    bool hasSignature() const override { return false; }
59protected:
60    void generatePabloMethod() override;   
61};
62
63class InvertMatchesKernel : public BlockOrientedKernel {
64public:
65    InvertMatchesKernel(const std::unique_ptr<kernel::KernelBuilder> & builder);
66private:
67    void generateDoBlockMethod(const std::unique_ptr<kernel::KernelBuilder> & iBuilder) override;
68};
69
70class PopcountKernel : public pablo::PabloKernel {
71public:
72    PopcountKernel(const std::unique_ptr<kernel::KernelBuilder> & builder);
73    bool isCachable() const override { return true; }
74    bool hasSignature() const override { return false; }
75protected:
76    void generatePabloMethod() override;   
77};
78   
79}
80#endif
Note: See TracBrowser for help on using the repository browser.