Ignore:
Timestamp:
Oct 19, 2017, 8:06:18 AM (19 months ago)
Author:
cameron
Message:

Modularization progress

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/icgrep.cpp

    r5695 r5698  
    185185    }
    186186
    187     grep::GrepEngine grepEngine;
     187    grep::GrepEngine * grepEngine;
     188   
     189    if (grep::Mode == grep::NormalMode) {
     190        grepEngine = new grep::GrepEngine();
     191    }
     192    else {
     193        grepEngine = new grep::CountOnlyGrepEngine();
     194    }
    188195
    189196               
    190     grepEngine.grepCodeGen(REs, grep::Mode);
    191 
    192     grepEngine.initFileResult(allFiles);
     197    grepEngine->grepCodeGen(REs);
     198
     199    grepEngine->initFileResult(allFiles);
    193200
    194201    if (Threads <= 1) {
    195202        for (unsigned i = 0; i != allFiles.size(); ++i) {
    196             grepEngine.doGrep(allFiles[i], i);
     203            grepEngine->doGrep(allFiles[i], i);
    197204        }
    198205    } else if (Threads > 1) {
     
    201208
    202209        for(unsigned long i = 0; i < numOfThreads; ++i){
    203             const int rc = pthread_create(&threads[i], nullptr, grep::DoGrepThreadFunction, (void *)&grepEngine);
     210            const int rc = pthread_create(&threads[i], nullptr, grep::DoGrepThreadFunction, (void *)grepEngine);
    204211            if (rc) {
    205212                llvm::report_fatal_error("Failed to create thread: code " + std::to_string(rc));
     
    216223
    217224   
    218     grepEngine.PrintResults();
     225    grepEngine->PrintResults();
     226   
     227    delete(grepEngine);
    219228   
    220229    return 0;
Note: See TracChangeset for help on using the changeset viewer.