Created
March 10, 2014 17:11
-
-
Save kingsamchen/9469381 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef std::string Record; | |
class GTAClient { | |
public: | |
virtual ~GTAClient() {} | |
virtual bool Filter(const Record&) | |
{ | |
return true; | |
} | |
virtual bool ProcessRow(const std::string& primary_key) = 0; | |
}; | |
class MyWorker : public GTAClient { | |
public: | |
virtual bool Filter(const Record&) | |
{ | |
std::cout << "we dont filter any records in MyWork strategy" << std::endl; | |
return true; | |
} | |
virtual bool ProcessRow(const std::string& primary_key) | |
{ | |
std::cout << "the primary key in this row is: " << primary_key << std::endl; | |
return true; | |
} | |
}; | |
bool GenericTableAglorithm(const string& table, GTAClient& method) | |
{ | |
std::cout << "start processing" << std::endl; | |
std::cout << "the table is -> " << table << std::endl; | |
method.Filter(Record()); | |
method.ProcessRow("New_Worker"); | |
return true; | |
} | |
int main() | |
{ | |
GenericTableAglorithm("customer", MyWorker()); | |
_getch(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment