// // $Id: absRcpGeometer_t.cpp,v 1.4 2001/01/11 14:13:25 hobbs Exp $ // // File: absRcpGeometer_t.cpp // Purpose: // Created: 9-NOV-2000 John Hobbs // // $Revision: 1.4 $ // // // Include files #include "geometry_system/management/absRcpGeometer.hpp" #include "geometry_system/management/RcpGeometerRegistry.hpp" #include "rcp/RCPManager.hpp" using namespace std; using namespace dgs; using namespace edm; // Get the two test RCP files static RCP *t1=0,*t2=0; class t_rcpGeometer: public absRcpGeometer { public: t_rcpGeometer() {} RCP* check_version(const bool isMC, const int runNumber, const vector& versions,const Event *anEvt/*0*/) { cout << "In t_rcpGeometer check_version with run = " << runNumber << endl; if ( runNumber == 1 ) return t1; if ( runNumber == 2 ) return t2; return 0; } private: bool refresh(const RCP* newRCP) { cout << "In t_rcpGeometer refresh with RCPID = " << (newRCP->getRCPID()).asString() << endl; return true; } }; int main() { t_rcpGeometer trgeom; vector versions; RCP* anRCP=0; // Make sure that the geometer got registered OK RcpGeometerRegistry *rgr = RcpGeometerRegistry::get_instance(); const set known = rgr->known_geometers(); if( known.find(&trgeom) == known.end() ) return 9; // Check the forcible refresh with a nonexistant rcp. if( trgeom.absRefresh(anRCP) ) return 1; // Get the two new RCP's and stash the pointers for global use RCPManager* rcpman = RCPManager::instance(); RCP rcp_t1 = rcpman->extract("geometry_system","test1"); RCP rcp_t2 = rcpman->extract("geometry_system","test2"); t1 = &rcp_t1; t2 = &rcp_t2; // Force one of them to be used if( !trgeom.absRefresh(&rcp_t1) ) return 2; if( trgeom.id() != rcp_t1.getRCPID() ) return 3; // Try to update with the spec indicating the same RCP. Make sure no // update occurs if( trgeom.absRefresh(true,1,versions) ) return 4; // Try to update with the second RCP. Make sure an update occurs if( !trgeom.absRefresh(true,2,versions) ) return 5; if( trgeom.id() != rcp_t2.getRCPID() ) return 6; // Try to update with the first one again. Make sure an update occurs if( !trgeom.absRefresh(true,1,versions) ) return 7; if( trgeom.id() != rcp_t1.getRCPID() ) return 8; return 0; }