![]() |
|
|
analysis fds | outage schedule | locked fds| data mgmt | server assignments |
|
Example: Reading Objects
#include <stdlib.h> /* getenv */ #include "oo.h" /* Objectivity/DB - specific */ int main(int argc, char* argv[]) { const char* bootFilePath = getenv("OO_FD_BOOT"); if ( 0 == bootFilePath ) { return 1; // error } ooMode accessMode = oocRead; const char* dbName = "myDB"; const char* contName = "X"; // initialize Objectivity ooInit(); // start transaction ooTrans trans; trans.start(); // open federation for reading ooHandle(ooFDObj) fdH; if ( oocSuccess != fdH.open(bootFilePath, accessMode) ) { trans.abort(); return 2; // error } // open database ooHandle(ooDBObj) dbH; if ( oocSuccess != dbH.open(fdH, dbName, accessMode) ) { trans.abort(); return 3; // error } // open container ooHandle(ooContObj) contH; if ( oocSuccess != contH.open(dbH, contName, accessMode) ) { trans.abort(); return 4; // error } // initialize iterator ooItr(ooObj) objItr; if ( oocSuccess != contH.contains(objItr, accessMode) ) { trans.abort(); return 5; } // iterate over all objects in the container while ( objItr.next() ) { ooHandle(ooObj) objH = objItr; // do something with the object } // close federation and commit transaction fdH.close(); trans.commit(); return 0; }
BaBar Public Site | SLAC | News | Links | Who's Who | Contact Us
Page Owner: Jacek Becla
Last Update: June 13, 2002