From: stephan b. <sg...@us...> - 2004-12-23 13:50:03
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11870 Modified Files: Factory.h Log Message: renamed internal_instantiate() to internalInstantiate(), for consistency. still do not like the name at all! Index: Factory.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Factory.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Factory.h 23 Dec 2004 04:45:52 -0000 1.1 +++ Factory.h 23 Dec 2004 13:49:54 -0000 1.2 @@ -167,10 +167,10 @@ Sample usage: <pre> -typedef Factory<MyClass> CL; -CL::register_factory( "my_key" ); -MyClass *foo = CL::load( "some_key" ); // == NULL -foo = CL::instantiate( "my_key" ); // == a new object +Factory<MyClass> & fac = Factory<MyClass>::instance(); +fac.registerFactory( "my_key", MyClass::new_instance ); +MyClass *foo = fac.instantiate( "some_key" ); // == NULL +foo = fac.instantiate( "my_key" ); // == a new MyClass object </pre> Note that all instantiators of the same type use the same @@ -239,23 +239,23 @@ /** - returns instance().internal_instantiate( key ). + returns instance().internalInstantiate( key ). The caller takes responsibility for the returned pointer. */ static result_type instantiate( const key_type & key ) { - return instance().internal_instantiate( key ); + return instance().internalInstantiate( key ); } /** - Returns this->internal_instantiate(key). + Returns this->internalInstantiate(key). */ result_type operator()( const key_type & key ) { - return this->internal_instantiate( key ); + return this->internalInstantiate( key ); } @@ -322,7 +322,7 @@ Subtypes are free to implement, e.g., DLL lookups. */ - virtual result_type internal_instantiate( const key_type & key ) + virtual result_type internalInstantiate( const key_type & key ) { typename FactoryMap::const_iterator it = factoryMap().find( key ); if ( it != factoryMap().end() ) // found a factory? |