// // $Id: handle_t.cpp,v 1.3 2002/08/25 20:24:28 melanson Exp $ // // File: test_handle.cpp // Purpose: // Created: 28-OCT-1997 John Hobbs // // $Revision: 1.3 $ // // // Include files #include using namespace std; using namespace dgs; int main() { int data[]={0,1,2,3,4,5,6,7,8,9}; const int datasize=sizeof(data)/4; HandleCache cache; Handle hdata[datasize]; cout << "Array has " << datasize << " elements." << endl; // Create the handles. cout << "** Testing handle creation" << endl; for( int i=0 ; i x = cache.create_handle(11,&ix); cout << cache; // x goes out of scope after this } cout << cache; // Can I update in situ as promised? cout << "** Reassign address pointed to by Handle[5] to object at handle[9]" << endl; cache.refresh_handle(5,&data[9]); cout << "i=" << 5 << " *(Handle[5]) = " << *(hdata[5]) << endl; // Test the existance member cout << "** Testing handle id existance member, handle_exists **" << endl; cout << "Handle w/id=5 exists? " << cache.handle_exists(5) << endl; cout << "Handle w/id=12 exists? " << cache.handle_exists(12) << endl; return 0; }