| 1 | #include <cstdio> |
|---|
| 2 | #include <cstdlib> |
|---|
| 3 | #include <cstring> |
|---|
| 4 | #include <sys/times.h> |
|---|
| 5 | |
|---|
| 6 | #include "ps_tools.hxx" |
|---|
| 7 | #include "ps_database.hxx" |
|---|
| 8 | |
|---|
| 9 | // ==================================================== |
|---|
| 10 | |
|---|
| 11 | int main( int argc, char *argv[] ) { |
|---|
| 12 | |
|---|
| 13 | if (argc < 3) { |
|---|
| 14 | printf( "Missing arguments\n Usage %s <output database name> <input database name> <input database name2> [[input3]...]\n", argv[0] ); |
|---|
| 15 | exit( 1 ); |
|---|
| 16 | } |
|---|
| 17 | |
|---|
| 18 | // |
|---|
| 19 | // init database object |
|---|
| 20 | // |
|---|
| 21 | const char *input_DB_name = argv[2]; |
|---|
| 22 | struct tms before; |
|---|
| 23 | times( &before ); |
|---|
| 24 | printf( "Opening 1st input-probe-set-database '%s'..\n", input_DB_name ); |
|---|
| 25 | PS_Database *db = new PS_Database( input_DB_name, PS_Database::READONLY ); |
|---|
| 26 | db->load(); |
|---|
| 27 | PS_print_time_diff( &before, "(enter to continue) " ); |
|---|
| 28 | // getchar(); |
|---|
| 29 | |
|---|
| 30 | // |
|---|
| 31 | // merge in other databasefiles |
|---|
| 32 | // |
|---|
| 33 | for (int i = 3; i < argc; ++i) { |
|---|
| 34 | input_DB_name = argv[i]; |
|---|
| 35 | printf( "Appending input-probe-set-database '%s'..\n", input_DB_name ); |
|---|
| 36 | times( &before ); |
|---|
| 37 | db->merge( input_DB_name ); |
|---|
| 38 | PS_print_time_diff( &before ); |
|---|
| 39 | } |
|---|
| 40 | printf( "Merged databases (enter to continue)\n" ); |
|---|
| 41 | // getchar(); |
|---|
| 42 | |
|---|
| 43 | // |
|---|
| 44 | // write one big whole tree to file |
|---|
| 45 | // |
|---|
| 46 | const char *output_DB_name = argv[1]; |
|---|
| 47 | times( &before ); |
|---|
| 48 | printf( "Writing output-probe-set-database '%s'..\n",output_DB_name ); |
|---|
| 49 | db->saveTo( output_DB_name ); |
|---|
| 50 | PS_print_time_diff( &before, "(enter to continue) " ); |
|---|
| 51 | // getchar(); |
|---|
| 52 | |
|---|
| 53 | printf( "cleaning up...\n" ); |
|---|
| 54 | if (db) delete db; |
|---|
| 55 | // printf( "root should be destroyed now\n" ); |
|---|
| 56 | // printf( "(enter to continue)\n" ); |
|---|
| 57 | // getchar(); |
|---|
| 58 | |
|---|
| 59 | return 0; |
|---|
| 60 | } |
|---|