Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | 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

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

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>
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.

References s11n::object_factory< T, SubT >::actual_type, and s11n::object_factory< T, SubT >::result_type.

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

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

References s11n::object_factory< T, SubT >::result_type.


The documentation for this struct was generated from the following file:
Generated on Tue Jul 20 10:46:49 2004 for s11n by doxygen 1.3.7