From: stephan b. <sg...@us...> - 2004-12-24 23:26:48
|
Update of /cvsroot/pclasses/pclasses2/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11982/test Modified Files: FactoryTest.cpp Log Message: Now demonstrates loading a plugin to get at multiple classes. Index: FactoryTest.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/test/FactoryTest.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- FactoryTest.cpp 24 Dec 2004 23:06:27 -0000 1.4 +++ FactoryTest.cpp 24 Dec 2004 23:26:40 -0000 1.5 @@ -21,7 +21,7 @@ TheBase * a = 0; -#define CLOAD(CN) a = P::CL::classload<TheBase>( CN ); \ +#define CLOAD(CN) a = P::NamedTypeFactory<TheBase>::instance().create( CN ); \ CERR << CN << " classload()ed? == " << a << "\n"; \ if( a ) CERR << "classname="<<a->classname()<<"\n"; \ delete( a ); a = 0; @@ -42,7 +42,8 @@ try { - pm.addPlugin( "CType" ); + ::P::System::SharedLib * sh = pm.addPlugin( "CType" ); + CERR << "CType lib = " << sh << "\n"; // throw P::Exception( "Foo!", P_SOURCEINFO ); } catch( const ::P::Exception & ex ) @@ -50,10 +51,11 @@ CERR << "Exception:\n"<<ex.where()<<"\n"<<ex.what()<<"\n"; } + LOAD("CType"); + LOAD("XtraType"); LOAD("TheBase"); LOAD("AType"); LOAD("BType"); - LOAD("CType"); LOAD("NoType"); return 0; |