#include <factory.hpp>
Public Types | |
typedef T * | result_type |
The type returned by create() and operator(). | |
typedef SubT | actual_type |
A typedef for the second template parameter for this type. | |
Public Member Functions | |
result_type | operator() () const |
Same as create(). | |
Static Public Member Functions | |
static result_type | create () |
This creates a new SubT, which is assumed to be a subclass of T. |
It is used by that type to create instances of specific types. It may be specialized to provide non-default object construction.
General conventions:
SubT must derive from (or be) T and must be Default Constructuable on the heap. In short, the following must be able to succeed:
T * foo = new SubT;
Clients may freely specialize this type to hook their factories in, and the above 'new' requirement need not be imposed by client-side specializations. For example, specializations are used to provide no-op factories for abstract types, where 'new T' cannot work.
Definition at line 77 of file factory.hpp.
typedef T* s11n::fac::create_hook< T, SubT >::result_type |
typedef SubT s11n::fac::create_hook< T, SubT >::actual_type |
A typedef for the second template parameter for this type.
Definition at line 89 of file factory.hpp.
static result_type s11n::fac::create_hook< T, SubT >::create | ( | ) | [inline, static] |
This creates a new SubT, which is assumed to be a subclass of T.
It can be used as a factory for factory & class_loader.
If T or SubT are abstract types, you must specialize this type such that create() returns 0 for those. That is, we "simulate" creation of abstract types by returning 0.
The caller owns the returned pointer, which may be 0.
Definition at line 104 of file factory.hpp.
result_type s11n::fac::create_hook< T, SubT >::operator() | ( | ) | const [inline] |