summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/astra/AstraObjectFactory.h13
1 files changed, 5 insertions, 8 deletions
diff --git a/include/astra/AstraObjectFactory.h b/include/astra/AstraObjectFactory.h
index 1ed4955..efe997d 100644
--- a/include/astra/AstraObjectFactory.h
+++ b/include/astra/AstraObjectFactory.h
@@ -109,14 +109,11 @@ T* CAstraObjectFactory<T, TypeList>::create(std::string _sType)
template <typename T, typename TypeList>
T* CAstraObjectFactory<T, TypeList>::create(const Config& _cfg)
{
- functor_find<T> finder = functor_find<T>();
- finder.tofind = _cfg.self.getAttribute("type");
- CreateObject<TypeList>::find(finder);
- if (finder.res == NULL) return NULL;
- if (finder.res->initialize(_cfg))
- return finder.res;
-
- delete finder.res;
+ T* object = create(_cfg.self.getAttribute("type"));
+ if (object == NULL) return NULL;
+ if (object->initialize(_cfg))
+ return object;
+ delete object;
return NULL;
}
//----------------------------------------------------------------------------------------