Bdb packages | Design docs | Source docs | Guidelines | Recent releases

Search | Site Map .

Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/BdbBitMap/BdbBMBuilderTest.cc

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //         $Id: BdbBMBuilderTest.cc,v 1.8 1999/02/06 02:04:26 gapon Exp $
00004 //
00005 // Description:
00006 //        Main program for stand-alone program to populate indexing
00007 //      database with test information.
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 
00025 extern "C" {
00026 }
00027 
00028 // -----------------
00029 // -- C++ Headers --
00030 // -----------------
00031 
00032 #include <iostream.h>
00033 #include <fstream.h>
00034 
00035 // ---------------------------------
00036 // -- Collaborating Class Headers --
00037 // ---------------------------------
00038 
00039 #include "BdbUtil/Bdb.hh"
00040 #include "AbsEvent/AbsEvent.hh"
00041 #include "AbsEventTag/AbsEventTag.hh"
00042 #include "AbsEventTag/AbsEventTagFloatIter.hh"
00043 #include "TagData/TagTransient.hh"
00044 #include "TagDataP/TagAttribute.hh"
00045 #include "BdbAccess/BdbDbInfo.hh"
00046 #include "BdbAccess/BdbDbTreeSingleton.hh"
00047 #include "BdbClustering/BdbEvsHdrClusteringHint.hh"
00048 #include "BdbClustering/BdbSimpleClusteringHint.hh"
00049 #include "BdbTrees/BdbDbRegistrator.hh"
00050 #include "BdbEvent/BdbEvent.hh"
00051 #include "BdbEvent/BdbEventTag.hh"
00052 #include "BdbEventStore/BdbCollection.hh"
00053 #include "BdbEventStore/BdbEventStore.hh"
00054 #include "BdbEventStore/BdbTreeNodeCollectionIterator.hh"
00055 #include "BdbEventStore/BdbEventStoreIterator.hh"
00056 #include "BdbEventStore/BdbTreeCollection.hh"
00057 #include "BdbEventStore/BdbVectorCollection.hh"
00058 
00059 #include "BdbIndexing/BdbDimTypes.hh"
00060 #include "BdbBitMap/BdbBMIndexBuilderAPI.hh"
00061 #include "BdbBitMap/BdbBMDimensionDescr.hh"
00062 
00063 //-----------------------------------------------------------------------
00064 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
00065 //-----------------------------------------------------------------------
00066 
00067 static const char rcsid[] = "$Id: BdbBMBuilderTest.cc,v 1.8 1999/02/06 02:04:26 gapon Exp $";
00068 
00069 //--------------------------------------------------
00070 // Create new indexing database in different ways --
00071 //--------------------------------------------------
00072 
00073 BdbStatus createDB(BdbBMIndexBuilderAPI* builder,
00074                    const char* index)
00075 {
00076     const d_UShort nDims = 2 ;
00077     BdbBMDimensionDescr* dims[nDims] ;
00078     d_Float splits1[3] = {0.0, 1.0, 2.0} ;
00079     d_Float splits2[3] = {0.0, 1.0, 2.0} ;
00080 
00081     dims[0] = new BdbBMDimensionDescr("X-dim",
00082                                       BdbDimTypes::FloatDimType,
00083                                       0.0,
00084                                       2.0,
00085                                       2,
00086                                       false,
00087                                       splits1);
00088 
00089     dims[1] = new BdbBMDimensionDescr("Y-dim",
00090                                       BdbDimTypes::FloatDimType,
00091                                       0.0,
00092                                       2.0,
00093                                       2,
00094                                       false,
00095                                       splits2);
00096 
00097     return builder->create(index, (const BdbAbsDimensionDescr**) dims, nDims) ;
00098 }
00099 
00100 BdbStatus createDB_Interactive(BdbBMIndexBuilderAPI* builder,
00101                                const char* index)
00102 {
00103   // Configure the dimensions & database.
00104 
00105     d_ULong nDims;
00106     d_ULong i ;
00107 
00108     cout << "nDims: " ; cin >> nDims ;
00109 
00110     BdbBMDimensionDescr** dims = new BdbBMDimensionDescr* [nDims] ;
00111 
00112     ooVArray(d_Float) minVal(nDims) ;
00113     ooVArray(d_Float) maxVal(nDims) ;
00114 
00115     for ( i = 0 ; i < nDims ; i++ ) {
00116 
00117         char     dimName[80] ;
00118         d_ULong  nBins ;
00119 
00120         cout << "Dimension " << i << " name: " ; cin >> dimName ;
00121         cout << "MIN:   " ; cin >> minVal[i] ;
00122         cout << "MAX:   " ; cin >> maxVal[i] ;
00123         cout << "nBins: " ; cin >> nBins ;
00124 
00125         d_Float* splits = new d_Float[nBins+1] ;
00126 
00127         cout << "Split points (nBins+1), from MIN to MAX: " ;
00128 
00129         for ( d_ULong j = 0 ; j <= nBins ; j++ ) {
00130             cin >> splits[j] ;
00131         }
00132 
00133         dims[i] = new BdbBMDimensionDescr(dimName,
00134                                           BdbDimTypes::FloatDimType,
00135                                           minVal[i],
00136                                           maxVal[i],
00137                                           nBins,
00138                                           false,
00139                                           splits);
00140 
00141         delete splits ;
00142     }
00143 
00144     BdbStatus status = builder->create(index, (const BdbAbsDimensionDescr**) dims, nDims) ;
00145         
00146     delete [] dims ;
00147 
00148     return status ;
00149 }
00150 
00151 template<class T>
00152 d_Boolean getToken(istream& infile, const char* token, T& value)
00153 {
00154     char buf[255] ;
00155 
00156     if ( infile.eof()) {
00157         cout << "Error\t: Reading config file." << endl
00158              << "\t: File is not open." << endl ;
00159         return false ;
00160     }
00161     infile >> buf ;
00162 
00163     if ( strcmp(token, buf)) {
00164         cout << "Error\t: Reading config file." << endl
00165              << "\t: Keyword \"" << token << "\" was expected" << endl
00166              << "\t: instead of: \"" << buf << "\"" << endl ;
00167         return false ;
00168     }
00169     infile >> value ;
00170 
00171     return true ;
00172 }
00173 
00174 BdbStatus createDB_File(BdbBMIndexBuilderAPI* builder,
00175                         const char* index,
00176                         const char* filename)
00177 {
00178     ifstream infile(filename) ;
00179     int flag ;
00180 
00181     if ( infile.eof()) {
00182         cout << "Error\t: Opening specified configuration file." << endl
00183              << "\t: File does not exist." << endl ;
00184         return BdbcError ;
00185     }
00186 
00187     d_UShort nDims;
00188 
00189     if ( ! getToken(infile, "NUMBER_OF_DIMENSIONS:", nDims)) {
00190         return BdbcError ;
00191     }
00192 
00193     BdbBMDimensionDescr** dims = new BdbBMDimensionDescr* [nDims] ;
00194 
00195     ooVArray(d_Float) minVal(nDims) ;
00196     ooVArray(d_Float) maxVal(nDims) ;
00197 
00198     d_Boolean equalBins ;
00199 
00200     for ( d_ULong i = 0 ; i < nDims ; i++ ) {
00201 
00202         char     dimName[80] ;
00203         d_ULong  nBins ;
00204 
00205         if ( ! getToken(infile, "DIMENSION:", dimName)) {
00206             return BdbcError ;
00207         }
00208         if ( ! getToken(infile, "MIN:", minVal[i])) {
00209             cout << "\t: Dimension: " << dimName << endl ;
00210             return BdbcError ;
00211         }
00212         if ( ! getToken(infile, "MAX:", maxVal[i])) {
00213             cout << "\t: Dimension: " << dimName << endl ;
00214             return BdbcError ;
00215         }
00216         if ( ! getToken(infile, "NUMBER_OF_BINS:", nBins)) {
00217             cout << "\t: Dimension: " << dimName << endl ;
00218             return BdbcError ;
00219         }
00220 
00221         d_Float* splits = new d_Float[nBins+1] ;
00222 
00223         if ( ! getToken(infile, "EQUAL_BINS:", flag)) {
00224             cout << "\t: Dimension: " << dimName << endl ;
00225             return BdbcError ;
00226         }
00227 
00228         if ( flag ) {
00229             equalBins = d_True ;
00230         } else {
00231             equalBins = d_False ;
00232         }
00233 
00234         if ( ! equalBins ) {
00235             for ( d_ULong j = 0 ; j <= nBins ; j++ ) {
00236 
00237                 if ( ! getToken(infile, "SPLIT_POINT:", splits[j])) {
00238                     cout << "\t: Dimension: " << dimName << endl ;
00239                     return BdbcError ;
00240                 }
00241             }
00242         }
00243 
00244         dims[i] = new BdbBMDimensionDescr(dimName,
00245                                           BdbDimTypes::FloatDimType,
00246                                           minVal[i],
00247                                           maxVal[i],
00248                                           nBins,
00249                                           equalBins,
00250                                           splits);
00251 
00252         delete splits ;
00253     }
00254 
00255     BdbStatus status = builder->create(index, (const BdbAbsDimensionDescr**) dims, nDims) ;
00256         
00257     delete [] dims ;
00258 
00259     return status ;
00260 }
00261 
00262 //-------------------------------
00263 // Build new indexing database --
00264 //-------------------------------
00265 
00266 BdbStatus buildDB(BdbBMIndexBuilderAPI* builder, const char* filename)
00267 {
00268     return builder->build(filename) ;
00269 }
00270 
00271 //----------------------------------------------------------------
00272 // Generate a plain file to be loaded into an indexing database --
00273 //----------------------------------------------------------------
00274 
00275 BdbStatus generateFILE(const char* filename)
00276 {
00277     d_ULong nDims ;
00278     d_ULong nEvents ;
00279     d_ULong i ;
00280     d_ULong j ;
00281 
00282   // Determine the shape of the output stream.
00283 
00284     cout << "nDims:   " ; cin >> nDims ;
00285     cout << "nEvents: " ; cin >> nEvents ;
00286 
00287     ooVArray(d_Float) minVal(nDims) ;
00288     ooVArray(d_Float) maxVal(nDims) ;
00289 
00290     for ( i = 0 ; i < nDims ; i++ ) {
00291 
00292         cout << i << " : Enter MIN MAX : " ; cin >> minVal[i] >> maxVal[i] ;
00293 
00294         if ( minVal[i] >= maxVal[i] ) {
00295             cout << "MIN (" << minVal[i] << ")"
00296                  << " must be less then "
00297                  << "MAX(" << maxVal[i] << ")"
00298                  << endl ;
00299             return BdbcError ;
00300         }
00301     }
00302 
00303   // Generate the random sequence and write
00304   // into output file.
00305 
00306     ofstream outfile(filename) ;
00307     d_Float val ;
00308 
00309     for ( j = 0 ; j < nEvents ; j++ ) {
00310         for ( i = 0 ; i < nDims ; i++ ) {
00311 
00312             d_UShort ir = rand() ;
00313             d_Float  wr = ((d_Float) ir ) / ((d_Float) ( 1024 * 64 - 1)) ;
00314 
00315             val = minVal[i] + (maxVal[i] - minVal[i]) * wr  ;
00316 
00317             outfile << " " << val ;
00318         }
00319         outfile << endl ;
00320     }
00321 
00322     return BdbcSuccess ;
00323 }
00324 
00325 //------------------------------------------------------------------------------
00326 // Generate a collection of event->tag to be loaded into an indexing database --
00327 //------------------------------------------------------------------------------
00328 
00329 class TagDimensionDescription {
00330 
00331 public:
00332 
00333     TagDimensionDescription() {}
00334 
00335     inline void config(const char* name, d_Float min, d_Float max )
00336     {
00337         _name = name ;
00338         _min  = min ;
00339         _max  = max ;
00340     }
00341 
00342     inline const char*  name() { return _name.head() ; }
00343     inline d_Float      min()  { return _min ; }
00344     inline d_Float      max()  { return _max ; }
00345 
00346 private:
00347 
00348     ooVString _name ;
00349     d_Float   _min ;
00350     d_Float   _max;
00351 } ;
00352 
00353 BdbStatus generateCOLLECTION(const char* collection)
00354 {
00355     BdbStatus status = BdbcSuccess ;
00356     d_ULong nDims ;
00357     d_ULong nEvents ;
00358     d_ULong i ;
00359     d_ULong j ;
00360     TagDimensionDescription* descr ;
00361 
00362   // Determine the shape of the output stream.
00363 
00364     cout << "nDims:   " ; cin >> nDims ;
00365     cout << "nEvents: " ; cin >> nEvents ;
00366     
00367     descr = new TagDimensionDescription[nDims] ;
00368 
00369     d_Float minVal ;
00370     d_Float maxVal ;
00371     char name[80] ;
00372 
00373     for ( i = 0 ; i < nDims ; i++ ) {
00374 
00375         cout << i << " : Enter NAME:         " ; cin >> name ;
00376         cout << i << " : Enter MIN and MAX : " ; cin >> minVal >> maxVal ;
00377 
00378         if ( minVal >= maxVal ) {
00379         
00380             cout << "MIN (" << minVal << ")"
00381                  << " must be less then "
00382                  << "MAX(" << maxVal << ")"
00383                  << endl ;
00384                  
00385             status = BdbcError ;
00386             
00387             break ;
00388         }
00389 
00390         descr[i].config(name, minVal, maxVal) ;        
00391     }
00392 
00393   // Initialize clustering hints.
00394 
00395     BdbDbRegistrator registrator ;
00396     BdbDbTreeSingleton::instance()->setRegistrator(&registrator) ;
00397  
00398     BdbEventStore* theStore = BdbEventStore::instance( ) ;
00399 
00400     BdbAbstractClusteringHint* theTreHint ;
00401     BdbAbstractClusteringHint* theVecHint ;
00402     BdbAbstractClusteringHint* theEvtHint ;
00403     BdbAbstractClusteringHint* theTagHint ;
00404 
00405     theStore->configureClustering() ;
00406 
00407     if ( theStore->useFullClustering()) {
00408         theTreHint = new BdbEvsClusteringHint(*theStore) ;
00409         theVecHint = new BdbEvsClusteringHint(*theStore) ;
00410         theEvtHint = new BdbEvsClusteringHint(*theStore) ;
00411         theTagHint = new BdbEvsClusteringHint(*theStore) ;
00412     } else {
00413         theTreHint = new BdbSimpleClusteringHint(*theStore) ;
00414         theVecHint = new BdbSimpleClusteringHint(*theStore) ;
00415         theEvtHint = new BdbSimpleClusteringHint(*theStore) ;
00416         theTagHint = new BdbSimpleClusteringHint(*theStore) ;
00417     }
00418     theTreHint->setComponent("col") ;
00419     theVecHint->setComponent("col") ;
00420     theEvtHint->setComponent("evt") ;
00421     theTagHint->setComponent("tag") ;
00422 
00423     theStore->configureClustering(theTreHint, theVecHint) ;
00424 
00425   // Try to locate collection. It should not exists.
00426 
00427     BdbCollection<BdbEvent> aCollection;
00428 
00429     status = theStore->collection( aCollection, collection );
00430     if ( BdbcSuccess == status ) {
00431         cout << "Collection: " << collection << " already exists. Try new one." << endl ;
00432         return BdbcError ;
00433     }
00434     
00435   // Create new collection.
00436 
00437     status = theStore->treeCollection(aCollection, collection);
00438     if ( BdbcSuccess == status ) {
00439 
00440       // Create the description if necessary
00441       
00442         aCollection.createDescription(aCollection.name()) ;
00443         
00444       // Get a persistent reference to the newely created collection.
00445 
00446         BdbHandle(BdbCollectionP) theCollectionP = aCollection.persistent() ;
00447 
00448       // Create and fill transient tag.
00449 
00450         AbsEventTag* theTag = new TagTransient() ;
00451         d_Float val ;
00452 
00453         for ( j = 0 ; j < nEvents ; j++ ) {
00454  
00455             for ( i = 0 ; i < nDims ; i++ ) {
00456 
00457                 d_UShort ir = rand() ;
00458                 d_Float  wr = ((d_Float) ir ) / ((d_Float) ( 1024 * 64 - 1)) ;
00459 
00460                 val = descr[i].min() + (descr[i].max() - descr[i].min()) * wr  ;
00461                 
00462                 theTag->putFloat(val, descr[i].name()) ;
00463             }
00464             
00465           // Create new event event; attach it to the collection;
00466  
00467             BdbHandle(BdbEvent) theEventH = new( theEvtHint->updatedHint()) BdbEvent(j) ;
00468 
00469             aCollection.add(theEventH);
00470             theEventH->setOwner(theCollectionP) ;
00471 
00472           // Create new empty tag attached to the event.
00473 
00474             BdbHandle(BdbEventTag) theTagH = new (theTagHint->updatedHint()) BdbEventTag(theEventH) ;
00475             
00476           // Copy transient tag into the persistent one.
00477 
00478 //            theCollectionP->fillTag(theTagH, theTag) ;
00479             
00480 
00481           // First define the keys & types
00482 
00483             const char* aKey ;
00484 
00485             AbsEventTagFloatIter* floatIter = theTag->floatIter() ;
00486             while ( floatIter->next()) {
00487                 aKey = floatIter->key( );
00488                 TagAttribute<float> floatKey(aCollection, aKey) ;
00489             }
00490             delete floatIter ;
00491 
00492           // Now define the values & save them in the tag
00493 
00494             aCollection.useAndResizeTag(theTagH) ;
00495 
00496             float aFloat ;
00497             floatIter = theTag->floatIter() ;
00498             while ( floatIter->next()) {
00499                 aFloat = floatIter->value() ;
00500                 aKey   = floatIter->key() ;
00501                 TagAttribute<float> floatAttr(aCollection, aKey) ;
00502                 floatAttr = aFloat ;
00503             }
00504             delete floatIter ;
00505             
00506 
00507         }
00508     }
00509 
00510 ///    theStore->commit() ;
00511 
00512     return BdbcSuccess ;
00513 }
00514 
00515 //-----------------------------------
00516 // Dump indexing database contents --
00517 //-----------------------------------
00518 
00519 BdbStatus dumpDB_Header(BdbBMIndexBuilderAPI* builder)
00520 {
00521     return builder->dump() ;
00522 }
00523 
00524 BdbStatus dumpDB_Dimension(BdbBMIndexBuilderAPI* builder)
00525 {
00526     d_ULong dim ;
00527     d_ULong elements ;
00528 
00529     cout << "DIMENSION: " ; cin >> dim ;
00530     cout << "ELEMENTS:  " ; cin >> elements ;
00531 
00532     return builder->dump(dim, elements) ;
00533 }
00534 
00535 BdbStatus dumpDB_Bin(BdbBMIndexBuilderAPI* builder)
00536 {
00537     d_ULong dim ;
00538     d_ULong bin ;
00539     d_ULong elements ;
00540 
00541     cout << "DIMENSION: " ; cin >> dim ;
00542     cout << "BIN:       " ; cin >> bin ;
00543     cout << "ELEMENTS:  " ; cin >> elements ;
00544 
00545     return builder->dump(dim, bin, elements) ;
00546 }
00547 
00548 //-----------------
00549 // Main Function --
00550 //-----------------
00551 
00552 int
00553 main( int argc, char* argv[] )
00554 {
00555     int op ;
00556     char indexName[255] ;
00557     char collectionName[255] ;
00558     char fileName[255] ;
00559     char target[255] ;
00560     int flag ;
00561     d_Boolean isCompressed ;
00562 
00563     cout << "===================================" << endl;
00564     cout << "BitMapIndexBuilder test application" << endl;
00565     cout << "===================================" << endl;
00566 
00567     cout << " " << endl ;
00568     cout << " " << endl ;
00569     cout << " 1 - open existing database" << endl ;
00570     cout << " 2 - create new database (simplest 2D test)" << endl ;
00571     cout << " 3 - create new database (take description interactivly)" << endl ;
00572     cout << " 4 - create new database (load description from file)" << endl ;
00573     cout << " " << endl ;
00574     cout << " 5 - build database (fill by data) using events collection" << endl ;
00575     cout << " 6 - build database (fill by data) using text file" << endl ;
00576     cout << "70 - generate input tag file for index builder" << endl ;
00577     cout << "71 - generate a collection of events->tags" << endl ;
00578     cout << " " << endl ;
00579     cout << " 8 - dump : database->header" << endl ;
00580     cout << " 9 - dump : database->dimension" << endl ;
00581     cout << "10 - dump : database->dimension->bin" << endl ;
00582     cout << " " << endl ;
00583     cout << "11 - destroy existing database" << endl ;
00584     cout << "12 - reset database contents" << endl ;
00585     cout << " " << endl ;
00586     cout << "Action: " ; cin >> op ;
00587 
00588     ooInit() ;
00589 
00590     BdbBMIndexBuilderAPI* builder ;
00591 
00592   // Construct the API object in a special way,
00593   // by passing him a compression flag.
00594 
00595     if (( 2 == op ) || ( 3 == op ) || ( 4 == op )) {
00596 
00597         cout << "INDEX name:                   " ; cin >> indexName ;
00598         cout << "Compressed (0-false,1-true) : " ; cin >> flag ;
00599 
00600         if ( flag ) {
00601             isCompressed = d_True ;
00602         } else {
00603             isCompressed = d_False ;
00604         }
00605 
00606         builder = new BdbBMIndexBuilderAPI(isCompressed) ;
00607 
00608     } else {
00609 
00610         builder = new BdbBMIndexBuilderAPI() ;
00611 
00612     }
00613 
00614     builder->startUpdate( );
00615 
00616     switch ( op ) {
00617     case 1:
00618         
00619         cout << "INDEX name:     " ; cin >> indexName ;
00620 
00621         if ( BdbcSuccess == builder->open(indexName)) {
00622             cout << "open()- done." << endl ;
00623         } else {
00624             cout << "open() - failed." << endl ;
00625         }
00626 
00627         break ;
00628 
00629     case 2:
00630 
00631         if ( BdbcSuccess == createDB(builder, indexName )) {
00632             cout << "create() - done." << endl ;
00633         } else {
00634             cout << "create() - failed." << endl ;
00635         }
00636 
00637         break ;
00638 
00639     case 3:
00640 
00641         if ( BdbcSuccess == createDB_Interactive(builder, indexName)) {
00642             cout << "create() - done." << endl ;
00643         } else {
00644             cout << "create() - failed." << endl ;
00645         }
00646 
00647         break ;
00648 
00649     case 4:
00650 
00651         cout << "Configuration file name :     " ; cin >> fileName ;
00652 
00653         if ( BdbcSuccess == createDB_File(builder, indexName, fileName)) {
00654             cout << "create() - done." << endl ;
00655         } else {
00656             cout << "create() - failed." << endl ;
00657         }
00658 
00659         break ;
00660 
00661     case 5:
00662 
00663         cout << "INDEX name:            " ; cin >> indexName ;
00664         cout << "Input collection name: " ; cin >> collectionName ;
00665 
00666         strcpy(target, "COLLECTION:") ;
00667         strcat(target, collectionName) ;
00668 
00669         if ( BdbcSuccess == builder->open(indexName)) {
00670 
00671             cout << "open() - done." << endl ;
00672 
00673             if ( BdbcSuccess == buildDB(builder, target)) {
00674                 cout << "build() - done." << endl ;
00675             } else {
00676                 cout << "build() - failed." << endl ;
00677             }
00678 
00679         } else {
00680             cout << "open() - failed." << endl ;
00681         }
00682 
00683         break ;
00684 
00685     case 6:
00686 
00687         cout << "INDEX name:      " ; cin >> indexName ;
00688         cout << "Input file name: " ; cin >> fileName ;
00689 
00690         strcpy(target, "FILE:") ;
00691         strcat(target, fileName) ;
00692 
00693 
00694         if ( BdbcSuccess == builder->open(indexName)) {
00695 
00696             cout << "open() - done." << endl ;
00697 
00698             if ( BdbcSuccess == buildDB(builder, target)) {
00699                 cout << "build() - done." << endl ;
00700             } else {
00701                 cout << "build() - failed." << endl ;
00702             }
00703 
00704         } else {
00705             cout << "open() - failed." << endl ;
00706         }
00707 
00708         break ;
00709 
00710     case 70:
00711 
00712         cout << "Ouput FILE name: " ; cin >> fileName ;
00713 
00714         if ( BdbcSuccess == generateFILE(fileName)) {
00715             cout << "generateFILE() - done." << endl ;
00716         } else {
00717             cout << "generateFILE() - failed." << endl ;
00718         }
00719 
00720 
00721         break ;
00722         
00723     case 71:
00724 
00725         cout << "Ouput COLLECTION name: " ; cin >> fileName ;
00726 
00727         if ( BdbcSuccess == generateCOLLECTION(fileName)) {
00728             cout << "generateCOLLECTION() - done." << endl ;
00729         } else {
00730             cout << "generateCOLLECTION() - failed." << endl ;
00731         }
00732 
00733 
00734         break ;
00735 
00736     case 8:
00737 
00738         cout << "INDEX name:     " ; cin >> indexName ;
00739 
00740         if ( BdbcSuccess == builder->open(indexName)) {
00741 
00742             cout << "open() - done." << endl ;
00743 
00744             if ( BdbcSuccess == dumpDB_Header(builder)) {
00745                 cout << "dump() - done." << endl ;
00746             } else {
00747                 cout << "dump() - failed." << endl ;
00748             }
00749 
00750         } else {
00751             cout << "open() - failed." << endl ;
00752         }
00753 
00754         break ;
00755 
00756     case 9:
00757 
00758         cout << "INDEX name:     " ; cin >> indexName ;
00759 
00760         if ( BdbcSuccess == builder->open(indexName)) {
00761 
00762             cout << "open() - done." << endl ;
00763 
00764             if ( BdbcSuccess == dumpDB_Dimension(builder)) {
00765                 cout << "dump() - done." << endl ;
00766             } else {
00767                 cout << "dump() - failed." << endl ;
00768             }
00769 
00770         } else {
00771             cout << "open() - failed." << endl ;
00772         }
00773 
00774         break ;
00775 
00776     case 10:
00777 
00778         cout << "INDEX name:     " ; cin >> indexName ;
00779 
00780         if ( BdbcSuccess == builder->open(indexName)) {
00781 
00782             cout << "open() - done." << endl ;
00783 
00784             if ( BdbcSuccess == dumpDB_Bin(builder)) {
00785                 cout << "dump() - done." << endl ;
00786             } else {
00787                 cout << "dump() - failed." << endl ;
00788             }
00789 
00790         } else {
00791             cout << "open() - failed." << endl ;
00792         }
00793 
00794         break ;
00795 
00796     case 11:
00797         
00798         cout << "INDEX name:     " ; cin >> indexName ;
00799 
00800         if ( BdbcSuccess == builder->open(indexName)) {
00801 
00802             cout << "open() - done." << endl ;
00803 
00804             if ( BdbcSuccess == builder->destroy()) {
00805                 cout << "destroy() - done." << endl ;
00806             } else {
00807                 cout << "destroy() - failed." << endl ;
00808             }
00809 
00810         } else {
00811             cout << "open() - failed." << endl ;
00812         }
00813 
00814         break ;
00815 
00816     case 12:
00817         
00818         cout << "INDEX name:     " ; cin >> indexName ;
00819 
00820         if ( BdbcSuccess == builder->open(indexName)) {
00821 
00822             cout << "open() - done." << endl ;
00823 
00824             if ( BdbcSuccess == builder->reset()) {
00825                 cout << "reset() - done." << endl ;
00826             } else {
00827                 cout << "reset() - failed." << endl ;
00828             }
00829 
00830         } else {
00831             cout << "open() - failed." << endl ;
00832         }
00833 
00834         break ;
00835     }
00836 
00837     builder->commit( );
00838 
00839     return 0;
00840 }
00841 
00842 /////////////////
00843 // End Of File //
00844 /////////////////

 


BaBar Public Site | SLAC | News | Links | Who's Who | Contact Us

Page Owner: Jacek Becla
Last Update: October 04, 2002