Ignore:
Timestamp:
Oct 21, 2017, 9:44:16 AM (20 months ago)
Author:
cameron
Message:

Refactoring, clean-up, set initial threads to 2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/grep_engine.h

    r5700 r5703  
    2424public:
    2525
    26     GrepEngine() : mGrepDriver(nullptr), mFileSuffix(InitialTabFlag ? "\t:" : ":"), grepMatchFound(false), fileCount(0) {}
    27 
     26    GrepEngine();
    2827    virtual ~GrepEngine();
    2928   
    30     void initFileResult(std::vector<std::string> filenames);
    31    
     29    void initFileResult(std::vector<std::string> & filenames);
    3230    virtual void grepCodeGen(std::vector<re::RE *> REs);
    33 
    34     void run();
    35    
    36     void PrintResults();
    37    
    38    
     31    bool searchAllFiles();
     32    void writeMatches();
    3933   
    4034protected:
    4135    static void * DoGrepThreadFunction(void *args);
    42     virtual uint64_t doGrep(const std::string & fileName, const uint32_t fileIdx);
     36    virtual uint64_t doGrep(const std::string & fileName, const uint32_t fileIdx) = 0;
    4337    std::string linePrefix(std::string fileName);
    44    
     38    int32_t openFile(const std::string & fileName, std::stringstream & msgstrm);
     39
    4540    Driver * mGrepDriver;
    4641
     
    5550};
    5651
    57 class CountOnlyGrepEngine : public GrepEngine {
     52class EmitMatchesEngine : public GrepEngine {
    5853public:
    59    
    60     CountOnlyGrepEngine() : GrepEngine() {mFileSuffix = ":";}
     54    EmitMatchesEngine();
    6155    void grepCodeGen(std::vector<re::RE *> REs) override;
    6256private:
    6357    uint64_t doGrep(const std::string & fileName, const uint32_t fileIdx) override;
    64    
    6558};
    6659
    67 class MatchOnlyGrepEngine : public CountOnlyGrepEngine {
     60class CountOnlyEngine : public GrepEngine {
    6861public:
    69    
    70     MatchOnlyGrepEngine() : CountOnlyGrepEngine(), mRequiredCount(Mode != FilesWithoutMatch) {mFileSuffix = NullFlag ? std::string("\0", 1) : "\n";}
     62    CountOnlyEngine();
     63private:
     64    uint64_t doGrep(const std::string & fileName, const uint32_t fileIdx) override;
     65};
     66
     67class MatchOnlyEngine : public GrepEngine {
     68public:
     69    MatchOnlyEngine(bool showFilesWithoutMatch);
    7170private:
    7271    uint64_t doGrep(const std::string & fileName, const uint32_t fileIdx) override;
Note: See TracChangeset for help on using the changeset viewer.