FEDEM Solver  R8.0
Source code of the dynamics solver
Public Member Functions | Private Types | Private Attributes | List of all members
FFaGenericFactory< T, Key, ArgType > Class Template Reference

Template singelton class defining a general object creation factory. More...

#include <FFaGenericFactory.H>

Inheritance diagram for FFaGenericFactory< T, Key, ArgType >:
Inheritance graph
[legend]
Collaboration diagram for FFaGenericFactory< T, Key, ArgType >:
Collaboration graph
[legend]

Public Member Functions

bool registerCreator (const Key &key, const CreatorCB &creator)
 Registers a new object creation method on key. More...
 
T * create (const Key &key, ArgType id)
 Invokes the object creation method for given key. More...
 
void getKeys (std::vector< Key > &keys) const
 Gets a list of all registered object creator keys. More...
 
void clear ()
 Clears the object creator map myCreatorMap. More...
 

Private Types

using CreatorCB = FFaDynCB2< ArgType, T *& >
 Type alias for object creation callback. More...
 
using CreatorMap = std::map< Key, CreatorCB >
 Key --> creator callback mapping. More...
 

Private Attributes

CreatorMap myCreatorMap
 Object creator callbacks container. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from FFaSingelton< FFaGenericFactory< T, std::string, int > >
static FFaGenericFactory< T, std::string, int > * instance ()
 Returns the actual instance of this class. More...
 
static void removeInstance ()
 Deletes the dynamically allocated instance. More...
 
static bool allocated ()
 Returns true, if the instance has been allocated. More...
 
- Protected Member Functions inherited from FFaSingelton< FFaGenericFactory< T, std::string, int > >
 FFaSingelton ()
 The constructor is protected to allow objects of sub-classes only. More...
 
 FFaSingelton (const FFaSingelton &)=delete
 Disable default copy constructor. More...
 
FFaSingelton & operator= (const FFaSingelton &)=delete
 Disable default assignment operator. More...
 

Detailed Description

template<class T, class Key = std::string, class ArgType = int>
class FFaGenericFactory< T, Key, ArgType >

Template singelton class defining a general object creation factory.

This class is used for managing methods for creating instances of a varity of classes, such as finite element types, etc. Call back methods creating an instance of a specific type are stored as function pointers in a map with the object type name as lookup key.

Member Typedef Documentation

◆ CreatorCB

template<class T , class Key = std::string, class ArgType = int>
using FFaGenericFactory< T, Key, ArgType >::CreatorCB = FFaDynCB2<ArgType,T*&>
private

Type alias for object creation callback.

◆ CreatorMap

template<class T , class Key = std::string, class ArgType = int>
using FFaGenericFactory< T, Key, ArgType >::CreatorMap = std::map<Key,CreatorCB>
private

Key --> creator callback mapping.

Member Function Documentation

◆ clear()

template<class T , class Key = std::string, class ArgType = int>
void FFaGenericFactory< T, Key, ArgType >::clear ( )
inline

Clears the object creator map myCreatorMap.

◆ create()

template<class T , class Key = std::string, class ArgType = int>
T* FFaGenericFactory< T, Key, ArgType >::create ( const Key &  key,
ArgType  id 
)
inline

Invokes the object creation method for given key.

◆ getKeys()

template<class T , class Key = std::string, class ArgType = int>
void FFaGenericFactory< T, Key, ArgType >::getKeys ( std::vector< Key > &  keys) const
inline

Gets a list of all registered object creator keys.

◆ registerCreator()

template<class T , class Key = std::string, class ArgType = int>
bool FFaGenericFactory< T, Key, ArgType >::registerCreator ( const Key &  key,
const CreatorCB &  creator 
)
inline

Registers a new object creation method on key.

Member Data Documentation

◆ myCreatorMap

template<class T , class Key = std::string, class ArgType = int>
CreatorMap FFaGenericFactory< T, Key, ArgType >::myCreatorMap
private

Object creator callbacks container.


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