summaryrefslogtreecommitdiffstats
path: root/include/astra/AstraObjectFactory.h
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-07-23 11:39:28 +0200
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-07-23 11:39:28 +0200
commit8f37932efdbf7585c85ba1e7653e7080e17d7714 (patch)
tree046f813f526fda500f5237e835c7061186cc5f8b /include/astra/AstraObjectFactory.h
parent7a4cfe2e5fe384691f0516020b2fcd48b35a7f63 (diff)
downloadastra-8f37932efdbf7585c85ba1e7653e7080e17d7714.tar.gz
astra-8f37932efdbf7585c85ba1e7653e7080e17d7714.tar.bz2
astra-8f37932efdbf7585c85ba1e7653e7080e17d7714.tar.xz
astra-8f37932efdbf7585c85ba1e7653e7080e17d7714.zip
Reduce code duplication
Diffstat (limited to 'include/astra/AstraObjectFactory.h')
-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;
}
//----------------------------------------------------------------------------------------