31 #ifndef RTABMAP_FLANN_OBJECT_FACTORY_H_
32 #define RTABMAP_FLANN_OBJECT_FACTORY_H_
43 template<
typename BaseClass,
44 typename UniqueIdType,
45 typename ObjectCreator = BaseClass* (*)()>
48 typedef ObjectFactory<BaseClass,UniqueIdType,ObjectCreator> ThisClass;
49 typedef std::map<UniqueIdType, ObjectCreator> ObjectRegistry;
56 bool subscribe(UniqueIdType
id, ObjectCreator creator)
58 if (object_registry.find(
id) != object_registry.end())
return false;
60 object_registry[
id] = creator;
64 bool unregister(UniqueIdType
id)
66 return object_registry.erase(
id) == 1;
69 ObjectCreator
create(UniqueIdType
id)
71 typename ObjectRegistry::const_iterator
iter = object_registry.find(
id);
73 if (
iter == object_registry.end()) {
86 ObjectRegistry object_registry;