torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
torc::generic::FactoryType< _Tp > Class Template Reference

A placeholder for a factory method. More...

#include <FactoryType.hpp>

+ Inheritance diagram for torc::generic::FactoryType< _Tp >:

Public Types

typedef _Tp Type
 
typedef SelfReferencing< Type >
::Pointer 
Pointer
 
typedef SelfReferencing< Type >
::WeakPointer 
WeakPointer
 

Public Member Functions

virtual void create (Pointer &outPointer) throw (Error)
 
 FactoryType ()
 
virtual ~FactoryType () throw ()
 

Private Member Functions

 FactoryType (const FactoryType< _Tp > &source)
 
FactoryType< _Tp > & operator= (const FactoryType< _Tp > &source)
 

Detailed Description

template<typename _Tp>
class torc::generic::FactoryType< _Tp >

A placeholder for a factory method.

The FactoryType template acts as a placeholder for a virtual function create that can be inherited by objects that want to create an object of an EOM type. This is typedeffed inside individual classes to generate a nested typename for a factory that can be used to create an object of that type. For example Cell::Factory can be used to create an object of type Cell.

Note
All objects creatable by FactoryType must inherit from SelfReferencing policy template

Definition at line 35 of file FactoryType.hpp.

Member Typedef Documentation

template<typename _Tp>
typedef SelfReferencing<Type>::Pointer torc::generic::FactoryType< _Tp >::Pointer

A pointer to an object of type Type

Definition at line 45 of file FactoryType.hpp.

template<typename _Tp>
typedef _Tp torc::generic::FactoryType< _Tp >::Type

A rename of the parameter type

Definition at line 40 of file FactoryType.hpp.

template<typename _Tp>
typedef SelfReferencing<Type>::WeakPointer torc::generic::FactoryType< _Tp >::WeakPointer

A weak pointer to an object of type Type

Definition at line 50 of file FactoryType.hpp.

Constructor & Destructor Documentation

template<typename _Tp>
torc::generic::FactoryType< _Tp >::FactoryType ( )
inline

Definition at line 71 of file FactoryType.hpp.

71  {
72  }
template<typename _Tp>
virtual torc::generic::FactoryType< _Tp >::~FactoryType ( )
throw (
)
inlinevirtual

Definition at line 75 of file FactoryType.hpp.

75  {
76  }
template<typename _Tp>
torc::generic::FactoryType< _Tp >::FactoryType ( const FactoryType< _Tp > &  source)
private

Member Function Documentation

template<typename _Tp>
virtual void torc::generic::FactoryType< _Tp >::create ( Pointer outPointer)
throw (Error
)
inlinevirtual

Create an object of the Type specification of Factory. If the object has a boost::weak_ptr to itself, it is the task of this method to set this after the object is created.

Returns
A pointer to the freshly created object.

Definition at line 58 of file FactoryType.hpp.

58  {
59  try {
60  Pointer temp(new _Tp()); //Do not remove
61  outPointer = temp;
62  WeakPointer weakPtr(outPointer);
63  outPointer->setWeakThis(weakPtr);
64  } catch(std::exception& e) //May receive std::bad_alloc
65  {
66  //TBD::ERROR
67  }
68  }
SelfReferencing< Type >::WeakPointer WeakPointer
Definition: FactoryType.hpp:50
SelfReferencing< Type >::Pointer Pointer
Definition: FactoryType.hpp:45
template<typename _Tp>
FactoryType<_Tp>& torc::generic::FactoryType< _Tp >::operator= ( const FactoryType< _Tp > &  source)
private

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