|
From: stephan b. <sg...@us...> - 2004-12-31 15:10:02
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15300/include/pclasses Modified Files: Factory.h Log Message: Minor code touch-ups, pedantic reorgs. One compile fix in uninstantiated template code. Index: Factory.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Factory.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- Factory.h 29 Dec 2004 20:11:11 -0000 1.15 +++ Factory.h 31 Dec 2004 15:09:52 -0000 1.16 @@ -82,7 +82,7 @@ */ ResultType operator()() { - return create(); + return this->create(); } }; @@ -192,27 +192,56 @@ { public: + + /** + A typedef for the KeyType used by this class. + */ + typedef KeyType key_type; + + /** Same as ContextType */ + typedef ContextT ContextType; + /** A typedef for the InterfaceT used by this class. + For conformance with the Adaptable Unary Functor + model */ typedef InterfaceT value_type; /** - Same as (InterfaceT *), for conformance with the - Adaptable Unary Functor model. + Same as (InterfaceT *). */ typedef InterfaceT * ResultType; + /** + Convenience typedef. + */ + typedef Factory< InterfaceT, ContextType, KeyType > ThisType; + + /** + A map type for storing lookup key aliases. + */ + typedef std::map<key_type,key_type> AliasMap; + + Factory() {} + + virtual ~Factory() {} /** - A typedef for the KeyType used by this class. + The type of factories used by this class: a + function taking void and returning (value_type + *). See factoryMap(). + + todo: implement proper functor support. */ - typedef KeyType key_type; + typedef ResultType ( *FactoryFuncType ) (); - /** Same as ContextType */ - typedef ContextT ContextType; + /** + Internal container type used for mapping keys to + factories. + */ + typedef std::map < key_type, FactoryFuncType > FactoryMap; - typedef std::map<key_type,key_type> AliasMap; /** Returns the map of classname aliases. @@ -274,30 +303,6 @@ return exp; } - /** - Convenience typedef. - */ - typedef Factory< InterfaceT, ContextType, KeyType > ThisType; - - Factory() {} - - virtual ~Factory() {} - - /** - The type of factories used by this class: a - function taking void and returning (value_type - *). See factoryMap(). - - todo: implement proper functor support. - */ - typedef ResultType ( *FactoryFuncType ) (); - - /** - Internal container type used for mapping keys to - factories. - */ - typedef std::map < key_type, FactoryFuncType > FactoryMap; - /** Tries to instantiate an instance of value_type @@ -345,7 +350,7 @@ */ ResultType operator()( const key_type & key ) { - return this->internal( key ); + return this->create( key ); } @@ -429,7 +434,7 @@ /** The CL namespace encapsulates P's classloader-related API. - All of the functions in this API use the obbject + All of the functions in this API use the object NamedTypeFactory<InterfaceT>::instance() for factory-related operations. Thus, using the various Hook classes you can force these functions to use your factory. @@ -437,12 +442,10 @@ i don't like this namespace. Maybe move these functions into Factory itself??? They're simply proxying that type, after all. - */ namespace CL { using namespace ::P; - using namespace ::P::Sharing; /** Registers classname with InterfaceT. If factory_function is 0 |