s11n::fac::create_hook< T, SubT > Struct Template Reference

create_hook is a helper object factory for the factory_mgr API. More...

#include <factory.hpp>

List of all members.

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.

Detailed Description

template<class T, class SubT>
struct s11n::fac::create_hook< T, SubT >

create_hook is a helper object factory for the factory_mgr API.

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.


Member Typedef Documentation

template<class T , class SubT >
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.

template<class T , class SubT >
typedef T* s11n::fac::create_hook< T, SubT >::result_type

The type returned by create() and operator().

Definition at line 83 of file factory.hpp.


Member Function Documentation

template<class T , class SubT >
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.

template<class T , class SubT >
result_type s11n::fac::create_hook< T, SubT >::operator() (  )  const [inline]

Same as create().

Definition at line 112 of file factory.hpp.

References s11n::fac::create().


The documentation for this struct was generated from the following file:

Generated on Sat Mar 20 12:29:25 2010 for libs11n-1.2.10 by  doxygen 1.6.1