![]() |
|
|
Bdb packages | Design docs | Source docs | Guidelines | Recent releases |
|
Main Page Modules Namespace List Class Hierarchy Alphabetical List Compound List File List Compound Members File Members /BdbBitMap/BdbBMBuilderCmd.cc
Go to the documentation of this file.00001 //-------------------------------------------------------------------------- 00002 // File and Version Information: 00003 // $Id: BdbBMBuilderCmd.cc,v 1.5 1999/02/03 19:53:43 gapon Exp $ 00004 // 00005 // Description: 00006 // Command line utility used to create and populate the indexing 00007 // database. 00008 // 00009 // Environment: 00010 // Software developed for the BaBar Detector at the SLAC B-Factory. 00011 // 00012 // Author List: 00013 // Igor A. Gaponenko Original Author 00014 // 00015 //------------------------------------------------------------------------ 00016 00017 // --------------- 00018 // -- C Headers -- 00019 // --------------- 00020 00021 #include <string.h> 00022 #include <assert.h> 00023 #include <stdlib.h> 00024 #include <stdio.h> 00025 00026 // ----------------- 00027 // -- C++ Headers -- 00028 // ----------------- 00029 00030 #include <iostream.h> 00031 #include <fstream.h> 00032 00033 // --------------------------------- 00034 // -- Collaborating Class Headers -- 00035 // --------------------------------- 00036 00037 #include "BdbUtil/Bdb.hh" 00038 #include "BdbApplication/BdbApplication.hh" 00039 #include "BdbIndexing/BdbDimTypes.hh" 00040 #include "BdbIndexing/BdbIndexItr.hh" 00041 #include "BdbBitMap/BdbBMIndexBuilderAPI.hh" 00042 #include "BdbBitMap/BdbBMDimensionDescr.hh" 00043 00044 //----------------------------------------------------------------------- 00045 // Local Macros, Typedefs, Structures, Unions and Forward Declarations -- 00046 //----------------------------------------------------------------------- 00047 00048 static const char rcsid[] = "$Id: BdbBMBuilderCmd.cc,v 1.5 1999/02/03 19:53:43 gapon Exp $"; 00049 00050 /** 00051 ** usage() - print "usage" information page. 00052 **/ 00053 00054 void usage(const char* message) 00055 { 00056 cout << endl 00057 << "BdbBMBuilderCmd: " << message << endl 00058 << endl 00059 << "USAGE: BdbBMBuilderCmd help" << endl 00060 << " BdbBMBuilderCmd list -a /<auth-level>[/<auth-name>]" << endl 00061 << " BdbBMBuilderCmd list -c <collection>" << endl 00062 << " BdbBMBuilderCmd status <index>" << endl 00063 << " BdbBMBuilderCmd create <index> <config-file>" << endl 00064 << " BdbBMBuilderCmd load <index> {-f <input-file> | -c <collection>}" << endl 00065 << " BdbBMBuilderCmd dump <index> <elements> [<attr> [<bin>]]" << endl 00066 << " BdbBMBuilderCmd reset <index>" << endl 00067 << " BdbBMBuilderCmd destroy <index>" << endl 00068 << endl ; 00069 } 00070 00071 /** 00072 ** help() 00073 ** help_config() 00074 ** help_input() 00075 ** 00076 ** print "help" information pages 00077 **/ 00078 00079 void help() 00080 { 00081 cout << endl 00082 << "DESCRIPTION: command line interface to BDB index builder." << endl 00083 << endl 00084 << "REQUIREMENTS:" << endl 00085 << endl 00086 << " Environment variable OO_FD_BOOT must point to the Objectivity/DB (TM)" << endl 00087 << " boot file location." << endl 00088 << endl 00089 << "GENERAL SYNTAX:" << endl 00090 << endl 00091 << " BdbBMBuilderCmd <command-name> [<par1> [<par2> ... ]]" << endl 00092 << endl 00093 << "COMMANDS:" << endl 00094 << endl 00095 << " help - print this page or more information on specified topic" << endl 00096 << " list - list all the indexes within specified scope" << endl 00097 << " status - print index status (configuration, statistics, etc.)" << endl 00098 << " create - create new empty index" << endl 00099 << " load - load index for specified target" << endl 00100 << " dump - dump index contents" << endl 00101 << " reset - reset index contents to the state just after its creation" << endl 00102 << " destroy - destroy specified index" << endl 00103 << endl 00104 << "SYNTAX OF THE COMMANDS:" << endl 00105 << endl 00106 << " BdbBMBuilderCmd help [<topic>]" << endl 00107 << " BdbBMBuilderCmd list -a /<auth-level>[/<auth-name>]" << endl 00108 << " BdbBMBuilderCmd list -c <collection>" << endl 00109 << " BdbBMBuilderCmd status <index>" << endl 00110 << " BdbBMBuilderCmd create <index> <config-file>" << endl 00111 << " BdbBMBuilderCmd build <index> {-f <input-file> | -c <collection>}" << endl 00112 << " BdbBMBuilderCmd dump <index> <elements> [<attr> [<bin>]]" << endl 00113 << " BdbBMBuilderCmd reset <index>" << endl 00114 << " BdbBMBuilderCmd destroy <index>" << endl 00115 << endl 00116 << "PARAMETERS:" << endl 00117 << endl 00118 << " index - index name (use: \"help index\" " << endl 00119 << " <auth-level> - authorization level (use: \"help index\" " << endl 00120 << " <auth-name> - authorization name (use: \"help index\" " << endl 00121 << " config-file - index configuration file (use: \"help config\")" << endl 00122 << " input-file - input text file for the index builder (use: \"help input\")" << endl 00123 << " collection - is Babar Event Store collection name" << endl 00124 << " elements - number of the first index elements to print" << endl 00125 << " attr - attribute name" << endl 00126 << " bin - index of a bin: 0,1,2, etc." << endl 00127 << endl ; 00128 } 00129 00130 void help_config() 00131 { 00132 cout << endl 00133 << "CONFIGURATION FILE SYNTAX:" << endl 00134 << endl 00135 << " - This should be a text file" << endl 00136 << " - Each line has two words: keyword and value" << endl 00137 << " - A keyword must be completed by \":\" wich is actually considered" << endl 00138 << " as a part of the keyword" << endl 00139 << " - Keywords must be typed in capital letters" << endl 00140 << " - A keyword is separated from their value by space(s) or/and tab(s)" << endl 00141 << " - The sequesnce of keyword-value pairs has a strict order" << endl 00142 << endl 00143 << "EXAMPLE:" << endl 00144 << endl 00145 << " The following configuration file describes the 2-dimension" << endl 00146 << " compressed index. The names of dimensions (attributes) are X, Y." << endl 00147 << " The first dimension (X) has 2 bins of equal width." << endl 00148 << " Another dimension (Y) has 10 bins of variable sizes, with a supplied list" << endl 00149 << " of split points" << endl 00150 << endl 00151 << " IS_COMPRESSED: 1" << endl 00152 << " NUMBER_OF_DIMENSIONS: 2" << endl 00153 << endl 00154 << " DIMENSION: X" << endl 00155 << " MIN: 0" << endl 00156 << " MAX: 1" << endl 00157 << " NUMBER_OF_BINS: 2" << endl 00158 << " EQUAL_BINS: 1" << endl 00159 << endl 00160 << " DIMENSION: Y" << endl 00161 << " MIN: -10.0" << endl 00162 << " MAX: 0.0" << endl 00163 << " NUMBER_OF_BINS: 10" << endl 00164 << " EQUAL_BINS: 0" << endl 00165 << endl 00166 << " SPLIT_POINT: -10.0" << endl 00167 << " SPLIT_POINT: -9.99" << endl 00168 << " SPLIT_POINT: -8.0" << endl 00169 << " SPLIT_POINT: -7.0" << endl 00170 << " SPLIT_POINT: -6.0" << endl 00171 << " SPLIT_POINT: -5.0" << endl 00172 << " SPLIT_POINT: -4.0" << endl 00173 << " SPLIT_POINT: -3.0" << endl 00174 << " SPLIT_POINT: -2.0" << endl 00175 << " SPLIT_POINT: -1.0" << endl 00176 << " SPLIT_POINT: 0.0" << endl 00177 << endl ; 00178 } 00179 00180 void help_input() 00181 { 00182 cout << endl 00183 << "INPUT FILE SYNTAX:" << endl 00184 << endl 00185 << " - A file contains as many lines as many events are to be indexed" << endl 00186 << " - Each line decsribes a particular event" << endl 00187 << " - The values in each line describe the values of the corresponding" << endl 00188 << " attributes in the same order as they are known to the indexing database" << endl 00189 << " - The values are separated by space(s) or/and tab(s)" << endl 00190 << endl 00191 << "EXAMPLE:" << endl 00192 << endl 00193 << " The following sample demonstrates 2-dimension input file" << endl 00194 << " having 3 events" << endl 00195 << endl 00196 << " 0.1 2.99" << endl 00197 << " 1.1 0.34" << endl 00198 << " 12.1 0.0" << endl 00199 << endl ; 00200 } 00201 00202 void help_index() 00203 { 00204 cout << endl 00205 << "NAMING CONVENTIONS FOR INDEXES :" << endl 00206 << endl 00207 << " The indexes are named and physically stored in the database" << endl 00208 << " according to a role a user plays in the database." << endl 00209 << " The role is determined by the current authorization level." << endl 00210 << " The user may change the roles as freely as it is allowed by" << endl 00211 << " his authorization priveleges." << endl 00212 << endl 00213 << " In connection with said above, the following general syntax" << endl 00214 << " for the indexes names is supported by this Utility: " << endl 00215 << endl 00216 << " /<auth-level>/[<auth-name>/]<index-name>" << endl 00217 << endl 00218 << " WHERE:" << endl 00219 << endl 00220 << " <auth-level> - is {system|group|user}" << endl 00221 << " <auth-name> - is a group name for \"group\" autharization level" << endl 00222 << " or is a user name for \"user\" authorization level" << endl 00223 << " <index-name> - is an index name itself." << endl 00224 << endl 00225 << " NOTE:" << endl 00226 << endl 00227 << " The naming conventions assume that all the names are the" << endl 00228 << " case-sensitive." << endl 00229 << " Beware, also, that each index is uniquely identified by a fully" << endl 00230 << " qualified string, rather then by just its last name." << endl 00231 << endl 00232 << "EXAMPLE:" << endl 00233 << endl 00234 << " System scope index: /system/Index1" << endl 00235 << " Group scope index: /groups/students/Index2" << endl 00236 << " User scope index: /users/gapon/Index3" << endl 00237 << endl ; 00238 } 00239 00240 // -------------------------------------------- 00241 // -- Forward declaration of the "executors" -- 00242 // -------------------------------------------- 00243 00244 static int execute_list(const char* auth = (char*) 0, 00245 const char* collection = (char*) 0) ; 00246 00247 static int execute_status(const char* index) ; 00248 00249 static int execute_create(const char* index, 00250 const char* config_file) ; 00251 00252 static int execute_load (const char* index, 00253 const char* prefix, 00254 const char* target) ; 00255 00256 static int execute_dump (const char* index, 00257 const char* elements, 00258 const char* attr = (char*) 0, 00259 const char* bin = (char*) 0 ) ; 00260 00261 static int execute_reset(const char* index) ; 00262 00263 static int execute_destroy(const char* index) ; 00264 00265 /** 00266 ** main() - main function 00267 **/ 00268 00269 int 00270 main( int argc, char* argv[] ) 00271 { 00272 00273 // Initialize Objectivity/DB client context 00274 00275 ooInit() ; 00276 00277 if ( argc < 2 ) { 00278 usage("too few arguments") ; 00279 return 1 ; 00280 } 00281 00282 while ( 1 ) { 00283 00284 // --- help --- // 00285 00286 if ( ! strcmp("help", argv[1])) { 00287 00288 switch ( argc ) { 00289 case 2: 00290 00291 help() ; 00292 break ; 00293 00294 case 3: 00295 00296 if ( ! strcmp("config", argv[2])) { 00297 help_config() ; 00298 break ; 00299 } 00300 if ( ! strcmp("input", argv[2])) { 00301 help_input() ; 00302 break ; 00303 } 00304 if ( ! strcmp("index", argv[2])) { 00305 help_index() ; 00306 break ; 00307 } 00308 00309 usage("unknown help topic") ; 00310 return 1 ; 00311 00312 default: 00313 00314 usage("illegal number of parameters for \"help\"") ; 00315 return 1 ; 00316 00317 } 00318 break ; 00319 } 00320 00321 // --- list --- // 00322 00323 if ( ! strcmp("list", argv[1])) { 00324 00325 switch ( argc ) { 00326 case 4: 00327 00328 if ( ! strcmp("-a", argv[2])) { 00329 return execute_list(argv[3], 0) ; 00330 } 00331 if ( ! strcmp("-c", argv[2])) { 00332 return execute_list(0, argv[3]) ; 00333 } 00334 00335 usage("illegal switch for \"list\"") ; 00336 return 1 ; 00337 00338 default: 00339 00340 usage("illegal number of parameters for \"list\"") ; 00341 return 1 ; 00342 00343 } 00344 break ; 00345 } 00346 00347 // --- status --- // 00348 00349 if ( ! strcmp("status", argv[1])) { 00350 00351 switch ( argc ) { 00352 case 3: 00353 00354 return execute_status(argv[2]) ; 00355 00356 default: 00357 00358 usage("illegal number of parameters for \"status\"") ; 00359 return 1 ; 00360 00361 } 00362 break ; 00363 } 00364 00365 // --- create --- // 00366 00367 if ( ! strcmp("create", argv[1])) { 00368 00369 switch ( argc ) { 00370 case 4: 00371 00372 return execute_create(argv[2], argv[3]) ; 00373 00374 default: 00375 00376 usage("illegal number of parameters for \"create\"") ; 00377 return 1 ; 00378 00379 } 00380 break ; 00381 } 00382 00383 // --- load --- // 00384 00385 if ( ! strcmp("load", argv[1])) { 00386 00387 switch ( argc ) { 00388 case 5: 00389 00390 if ( ! strcmp("-f", argv[3])) { 00391 return execute_load(argv[2], "FILE:", argv[4]) ; 00392 } 00393 if ( ! strcmp("-c", argv[3])) { 00394 return execute_load(argv[2], "COLLECTION:", argv[4]) ; 00395 } 00396 00397 usage("illegal target switch for \"load\"") ; 00398 return 1 ; 00399 00400 default: 00401 00402 usage("illegal number of parameters for \"load\"") ; 00403 return 1 ; 00404 00405 } 00406 break ; 00407 } 00408 00409 // --- dump --- // 00410 00411 if ( ! strcmp("dump", argv[1])) { 00412 00413 switch ( argc ) { 00414 case 4: return execute_dump(argv[2], argv[3]) ; 00415 case 5: return execute_dump(argv[2], argv[3], argv[4]) ; 00416 case 6: return execute_dump(argv[2], argv[3], argv[4], argv[5]) ; 00417 default: 00418 00419 usage("illegal number of parameters for \"dump\"") ; 00420 return 1 ; 00421 00422 } 00423 break ; 00424 } 00425 00426 // --- reset --- // 00427 00428 if ( ! strcmp("reset", argv[1])) { 00429 00430 switch ( argc ) { 00431 case 3: 00432 00433 return execute_reset(argv[2]) ; 00434 00435 default: 00436 00437 usage("illegal number of parameters for \"reset\"") ; 00438 return 1 ; 00439 00440 } 00441 break ; 00442 } 00443 00444 // --- destroy --- // 00445 00446 if ( ! strcmp("destroy", argv[1])) { 00447 00448 switch ( argc ) { 00449 case 3: 00450 00451 return execute_destroy(argv[2]) ; 00452 00453 default: 00454 00455 usage("illegal number of parameters for \"destroy\"") ; 00456 return 1 ; 00457 00458 } 00459 break ; 00460 } 00461 00462 usage("unknonw comand specified") ; 00463 return 1 ; 00464 } 00465 return 0 ; 00466 } 00467 00468 /** 00469 ** execute_list() - locate all the indexes in given scope 00470 **/ 00471 00472 static int execute_list(const char* auth, 00473 const char* collection) 00474 { 00475 BdbStatus status = BdbcError ; 00476 00477 BdbApplication::instance()->startRead("Indexing") ; 00478 00479 while ( 1 ) { 00480 00481 // List all the known Indeces for specified authorization level/name. 00482 00483 if ( auth != (char*) 0 ) { 00484 00485 cout << endl 00486 << "=============================================" << endl 00487 << "== INDEX REGISTRY: " << auth << endl 00488 << "=============================================" << endl 00489 << endl ; 00490 00491 00492 BdbIndexItr itr ; 00493 00494 status = itr.set(auth) ; 00495 if ( BdbcSuccess == status ) { 00496 00497 int number = 0 ; 00498 00499 while ( itr.next()) { 00500 cout << number++ << ": " << (const char*) itr.name() << endl ; 00501 } 00502 00503 cout << endl 00504 << "Total of " << number << " indexes were found." 00505 << endl ; 00506 00507 } 00508 } else if ( collection != (char*) 0 ) { 00509 00510 cout << endl 00511 << "BdbBMBuilderCmd: to be implemented" 00512 << endl ; 00513 00514 } 00515 00516 break ; 00517 } 00518 00519 BdbApplication::instance()->commit("Indexing") ; 00520 00521 return ( BdbcSuccess != status ) ; 00522 } 00523 00524 /** 00525 ** execute_status() - print index status 00526 **/ 00527 00528 static int execute_status(const char* index) 00529 { 00530 BdbBMIndexBuilderAPI* builder ; 00531 BdbStatus status ; 00532 00533 builder = new BdbBMIndexBuilderAPI() ; 00534 00535 builder->startUpdate() ; 00536 00537 status = builder->open(index) ; 00538 if ( BdbcSuccess == status ) { 00539 status = builder->dump() ; 00540 } 00541 00542 builder->commit() ; 00543 00544 return ( BdbcSuccess != status ) ; 00545 } 00546 00547 /** 00548 ** getToken() - get next token from the input stream 00549 **/ 00550 00551 template<class T> 00552 d_Boolean getToken(istream& infile, const char* token, T& value) 00553 { 00554 char buf[255] ; 00555 00556 if ( infile.eof()) { 00557 cout << "Error\t: Reading config file." << endl 00558 << "\t: File is not open." << endl ; 00559 return false ; 00560 } 00561 infile >> buf ; 00562 00563 if ( strcmp(token, buf)) { 00564 cout << "Error\t: Reading config file." << endl 00565 << "\t: Keyword \"" << token << "\" was expected" << endl 00566 << "\t: instead of: \"" << buf << "\"" << endl ; 00567 return false ; 00568 } 00569 infile >> value ; 00570 00571 return true ; 00572 } 00573 00574 /** 00575 ** execute_create() - create new index 00576 **/ 00577 00578 static int execute_create(const char* index, 00579 const char* config_file) 00580 { 00581 BdbBMIndexBuilderAPI* builder ; 00582 BdbStatus status = BdbcError ; 00583 00584 ifstream infile(config_file) ; 00585 00586 int flag ; // This flag is needed to provide typoe conversion for IOSTREAM 00587 // lacks direct support for d_Boolean type. 00588 00589 d_Boolean isCompressed ; 00590 d_UShort nDims ; 00591 00592 BdbBMDimensionDescr** dims ; 00593 00594 char dimName[80] ; 00595 ooVArray(d_Float) minVal ; 00596 ooVArray(d_Float) maxVal ; 00597 d_ULong nBins ; 00598 d_Boolean equalBins ; 00599 d_Float* splits ; 00600 00601 // Load configuration. 00602 00603 while ( 1 ) { 00604 00605 if ( infile.eof()) { 00606 cout << "Error\t: Opening specified configuration file." << endl 00607 << "\t: File does not exist." << endl ; 00608 break ; 00609 } 00610 00611 if ( ! getToken(infile, "IS_COMPRESSED:", flag)) { 00612 break; 00613 } 00614 isCompressed = flag ? d_True : d_False ; 00615 00616 if ( ! getToken(infile, "NUMBER_OF_DIMENSIONS:", nDims)) { 00617 break ; 00618 } 00619 00620 // Allocate memory for specified number of dimensions. 00621 00622 dims = new BdbBMDimensionDescr* [nDims] ; 00623 00624 status = minVal.resize(nDims) ; 00625 if ( BdbcSuccess != status ) { 00626 break ; 00627 } 00628 status = maxVal.resize(nDims) ; 00629 if ( BdbcSuccess != status ) { 00630 break ; 00631 } 00632 00633 // Process each dimension - one by one. 00634 00635 for ( d_ULong i = 0 ; i < nDims ; i++ ) { 00636 00637 if ( ! getToken(infile, "DIMENSION:", dimName)) { 00638 status = BdbcError ; 00639 break ; 00640 } 00641 if ( ! getToken(infile, "MIN:", minVal[i])) { 00642 cout << "\t: Dimension: " << dimName << endl ; 00643 status = BdbcError ; 00644 break ; 00645 } 00646 if ( ! getToken(infile, "MAX:", maxVal[i])) { 00647 cout << "\t: Dimension: " << dimName << endl ; 00648 status = BdbcError ; 00649 break ; 00650 } 00651 if ( ! getToken(infile, "NUMBER_OF_BINS:", nBins)) { 00652 cout << "\t: Dimension: " << dimName << endl ; 00653 status = BdbcError ; 00654 break ; 00655 } 00656 00657 splits = new d_Float[nBins+1] ; 00658 00659 while ( 1 ) { 00660 00661 if ( ! getToken(infile, "EQUAL_BINS:", flag)) { 00662 cout << "\t: Dimension: " << dimName << endl ; 00663 status = BdbcError ; 00664 break ; 00665 } 00666 equalBins = flag ? d_True : d_False ; 00667 00668 if ( ! equalBins ) { 00669 for ( d_ULong j = 0 ; j <= nBins ; j++ ) { 00670 00671 if ( ! getToken(infile, "SPLIT_POINT:", splits[j])) { 00672 cout << "\t: Dimension: " << dimName << endl ; 00673 status = BdbcError ; 00674 break ; 00675 } 00676 } 00677 if ( BdbcSuccess != status ) { 00678 break ; 00679 } 00680 } 00681 dims[i] = new BdbBMDimensionDescr(dimName, BdbDimTypes::FloatDimType, 00682 minVal[i], maxVal[i], 00683 nBins, equalBins, splits) ; 00684 00685 break ; 00686 } 00687 delete splits ; 00688 00689 if ( BdbcSuccess != status ) { 00690 break ; 00691 } 00692 } 00693 break ; 00694 } 00695 00696 if ( BdbcSuccess == status ) { 00697 00698 builder = new BdbBMIndexBuilderAPI(isCompressed) ; 00699 00700 builder->startUpdate() ; 00701 00702 status = builder->create(index, (const BdbAbsDimensionDescr**) dims, nDims) ; 00703 00704 builder->commit() ; 00705 } 00706 delete [] dims ; 00707 00708 return ( BdbcSuccess != status ) ; 00709 } 00710 00711 /** 00712 ** execute_load() - build new index 00713 **/ 00714 00715 static int execute_load(const char* index, 00716 const char* prefix, 00717 const char* target) 00718 { 00719 BdbBMIndexBuilderAPI* builder ; 00720 BdbStatus status ; 00721 00722 char* tmp ; 00723 00724 tmp = new char[1+strlen(prefix)+strlen(target)] ; 00725 00726 strcpy(tmp, prefix) ; 00727 strcat(tmp, target) ; 00728 00729 builder = new BdbBMIndexBuilderAPI() ; 00730 00731 builder->startUpdate() ; 00732 00733 status = builder->open(index) ; 00734 if ( BdbcSuccess == status ) { 00735 status = builder->build(tmp) ; 00736 } 00737 00738 builder->commit() ; 00739 00740 delete tmp ; 00741 00742 return ( BdbcSuccess != status ) ; 00743 } 00744 00745 /** 00746 ** execute_dump() - dump index contents 00747 **/ 00748 00749 static int execute_dump(const char* index, 00750 const char* elements, 00751 const char* attr, 00752 const char* bin) 00753 { 00754 BdbBMIndexBuilderAPI* builder ; 00755 BdbStatus status ; 00756 00757 d_ULong nElem ; 00758 d_ULong nBin ; 00759 00760 sscanf(elements, "%ld", &nElem) ; 00761 00762 builder = new BdbBMIndexBuilderAPI() ; 00763 00764 builder->startUpdate() ; 00765 00766 status = builder->open(index) ; 00767 if ( BdbcSuccess == status ) { 00768 if ( attr == (char*) 0 ) { 00769 status = builder->dump() ; 00770 } else { 00771 if ( bin == (char*) 0 ) { 00772 status = builder->dump(attr, nElem) ; 00773 } else { 00774 sscanf(bin, "%ld", &nBin) ; 00775 status = builder->dump(attr, nBin, nElem) ; 00776 } 00777 } 00778 } 00779 builder->commit() ; 00780 00781 return ( BdbcSuccess != status ) ; 00782 00783 } 00784 00785 /** 00786 ** execute_reset() - reset index contents 00787 **/ 00788 00789 static int execute_reset(const char* index) 00790 { 00791 BdbBMIndexBuilderAPI* builder ; 00792 BdbStatus status ; 00793 00794 builder = new BdbBMIndexBuilderAPI() ; 00795 00796 builder->startUpdate() ; 00797 00798 status = builder->open(index) ; 00799 if ( BdbcSuccess == status ) { 00800 status = builder->reset() ; 00801 } 00802 00803 builder->commit() ; 00804 00805 return ( BdbcSuccess != status ) ; 00806 } 00807 00808 /** 00809 ** execute_destroy() - destroy index 00810 **/ 00811 00812 static int execute_destroy(const char* index) 00813 { 00814 BdbBMIndexBuilderAPI* builder ; 00815 BdbStatus status ; 00816 00817 builder = new BdbBMIndexBuilderAPI() ; 00818 00819 builder->startUpdate() ; 00820 00821 status = builder->open(index) ; 00822 if ( BdbcSuccess == status ) { 00823 status = builder->destroy() ; 00824 } 00825 00826 builder->commit() ; 00827 00828 return ( BdbcSuccess != status ) ; 00829 } 00830 00831 ///////////////// 00832 // End Of File // 00833 /////////////////
BaBar Public Site | SLAC | News | Links | Who's Who | Contact Us
Page Owner: Jacek Becla
Last Update: October 04, 2002