#include <iostream.h> #include "body.h" #include "cube.h" #include "cylinder.h" main() { // this is the standard initialization code to open the // proper database file on the dbH handle ooHandle(ooDBObj) dbH; if( dbH.exist(oovTopFD, "Bodies") ) { if (dbH.open(oovTopFD, "Bodies", oocRead) != oocSuccess) { cout << "dbH.open error" << endl; return 1; } } else { cout << "Database Bodies not existing" << endl; return 1; } // ------ end of standard initialization code ---- // setup a body iterator, which returns the polymorph bodies ooItr(body) bItr; // and let it scan through the database file if ( bItr.scan(dbH) != oocSuccess) { cout << "scan error" << endl; return 1; } cout<< endl; cout << " ------------------" << endl; // and now print the properties for all returned bodies... while ( bItr.next()) { cout << "Type: " << bItr->identify() << endl; cout << "Volume: " << bItr->GetVolume() << endl; cout << "Surface: " << bItr->GetSurface() << endl; cout << " ------------------" << endl; } // we close the transaction properly if( oovTopTrans.commit() != oocSuccess ) cout << "transaction commit error" << endl; }