Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kingsamchen/9469381 to your computer and use it in GitHub Desktop.
Save kingsamchen/9469381 to your computer and use it in GitHub Desktop.
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