Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members

s11n::object_factory< T, SubT > Struct Template Reference

object_factory is a helper object factory for the classes instantiator and class_loader. More...

#include <instantiator.h>

List of all members.

Public Types

typedef T result_type
 A typedef for the first template parameter for this type.
typedef SubT actual_type
 A typedef for the second template parameter for this type.

Public Member Functions

result_typeoperator() () const
 Same as new_instance();.

Static Public Member Functions

static result_typenew_instance ()
 This creates a new SubT, which is assumed to be a subclass of T.
static result_typeno_instance ()
 A convenience factory to assist in the registration of abstract base types.


Detailed Description

template<class T, class SubT = T>
struct s11n::object_factory< T, SubT >

object_factory is a helper object factory for the classes instantiator and class_loader.

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;

Definition at line 32 of file instantiator.h.


Member Function Documentation

template<class T, class SubT = T>
static result_type* s11n::object_factory< T, SubT >::new_instance  )  [inline, static]
 

This creates a new SubT, which is assumed to be a subclass of T.

It can be used as a factory for instantiator & class_loader.

Definition at line 51 of file instantiator.h.

Referenced by s11n::object_factory< T, SubT >::operator()().

template<class T, class SubT = T>
static result_type* s11n::object_factory< T, SubT >::no_instance  )  [inline, static]
 

A convenience factory to assist in the registration of abstract base types.

It can be used as a factory for such types, avoiding the problem that the default factory will try to use 'new T', which won't work with abstract types.

It always returns 0.

Definition at line 65 of file instantiator.h.


The documentation for this struct was generated from the following file:
Generated on Thu Jun 16 16:18:13 2005 for s11n by  doxygen 1.4.3-20050530