/* * Read through all objects of ABC type on disk * * Uses dynamic_cast<Type *>(pobj) * * Sequencially reads through all objects * */ #include <stdlib.h> #include <typeinfo> #include "POBroker.h" #include "example.h" int main() { POBroker<POBObj> pob("TEST.DAT"); pob.register_create_function(typeid(ABC).name(), ABC::create); POBObj* pobj; ABC* pabc; unsigned long oi; do { oi = pob.readObj(pobj); cout << "oi=" << oi << endl; if ( pabc = dynamic_cast<ABC *>(pobj) ) { cout << "Read Object:" << endl; cout << *pabc << endl; } pob.deleteRef(pabc); } while ( ! pob.eof() ); return 0; }
Hosted by www.Geocities.ws

1