prune-trace: pruners may add own command-line switches

Change-Id: I23293e7e6cf8ab1c3456337ba5e4af9b5e106ccb
This commit is contained in:
Horst Schirmeier
2014-04-28 10:33:26 +02:00
parent 6300a2b364
commit 0cf5a34a9f
2 changed files with 14 additions and 0 deletions

View File

@ -18,6 +18,12 @@ public:
const std::vector<std::string>& benchmarks,
const std::vector<std::string>& benchmarks_exclude);
/**
* Callback function that can be used to add command line options
* to the cmd interface
*/
virtual bool commandline_init() { return true; }
virtual std::string method_name() = 0;
virtual bool create_database();

View File

@ -70,6 +70,14 @@ int main(int argc, char *argv[]) {
pruner = new BasicPruner();
}
if (pruner && !(pruner->commandline_init())) {
std::cerr << "Pruner's commandline initialization failed" << std::endl;
exit(-1);
}
// Since the pruner might have added command line options, we need to
// reparse all arguments.
cmd.parse();
if (cmd[HELP]) {
cmd.printUsage();
exit(0);