8 #ifndef FFA_GENERIC_FACTORY_H
9 #define FFA_GENERIC_FACTORY_H
22 template <
class T,
class Key = std::
string,
class ArgType =
int>
34 return myCreatorMap.insert(std::make_pair(key,creator)).second;
37 T*
create(
const Key& key, ArgType
id)
40 typename CreatorType::iterator creator =
myCreatorMap.find(key);
42 creator->second.invoke(
id,retVal);
45 std::cerr <<
"\n *** FFaGenericFactory: No creator defined for "
51 void getKeys(std::vector<Key>& keys)
const
55 for (
const typename CreatorType::value_type& creator :
myCreatorMap)
56 keys.push_back(creator.first);
Macros for definition of dynamic callback objects.
Definition: FFaGenericFactory.H:24
FFaDynCB2< ArgType, T *& > CreatorCB
Definition: FFaGenericFactory.H:25
bool registerCreator(const Key &key, const CreatorCB &creator)
Definition: FFaGenericFactory.H:32
void getKeys(std::vector< Key > &keys) const
Definition: FFaGenericFactory.H:51
T * create(const Key &key, ArgType id)
Definition: FFaGenericFactory.H:37
CreatorType myCreatorMap
Definition: FFaGenericFactory.H:62
virtual ~FFaGenericFactory()
Definition: FFaGenericFactory.H:30
FFaGenericFactory()
Definition: FFaGenericFactory.H:29
std::map< Key, CreatorCB > CreatorType
Definition: FFaGenericFactory.H:26
void clear()
Definition: FFaGenericFactory.H:59
Template class for singleton classes.
Definition: FFaSingelton.H:20
static void removeInstance()
Deletes the dynamically allocated instance.
Definition: FFaSingelton.H:41