Update of /cvsroot/pclasses/pclasses2/include/pclasses
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13361/include/pclasses
Modified Files:
Factory.h
Log Message:
Doc additions and naming convention corrections.
Index: Factory.h
===================================================================
RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Factory.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- Factory.h 25 Dec 2004 01:45:14 -0000 1.8
+++ Factory.h 25 Dec 2004 02:45:48 -0000 1.9
@@ -170,15 +170,17 @@
foo = fac.create( "my_key" ); // == a new MyClass object
</pre>
- Note that all instantiators of the same type use the same
- object factories. The ContextType template parameter can be
- used to limit the scope of the object factory registrations
- to a specific context: Factories with different Contexts
- use different maps. ContextType is only used as a marker type,
- and is never instantiated by this class.
+ Note that all instantiations of the same Factory type use
+ the same object factories map. The ContextType template
+ parameter can be used to limit the scope of a
+ Factory<InterfaceT>, such that it it does not collide with
+ other Factory<InterfaceT> instantiations. ContextType is
+ only used as a marker type, and is never instantiated by
+ this class. Used cleverly, it can allow you quite a bit
+ of freedome in what code has access to which factories.
*/
template < class InterfaceT,
- class ContextType = Sharing::FactoryContext,
+ class ContextT = Sharing::FactoryContext,
class KeyType = std::string
>
class Factory
@@ -202,7 +204,7 @@
typedef KeyType key_type;
/** Same as ContextType */
- typedef ContextType context_type;
+ typedef ContextT ContextType;
/**
Convenience typedef.
@@ -297,10 +299,14 @@
It is safe to call this post-main(), but such calls
may return an empty map!
+
+ TODO: use a Hook or Traits type to allow the user
+ to replace this object with his own, so that he can
+ control the scope of the map more fully.
*/
static FactoryMap & factoryMap()
{
- return Phoenix<FactoryMap,context_type>::instance();
+ return Phoenix<FactoryMap,ContextType>::instance();
}
/**
|