diff options
author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2015-07-23 11:39:28 +0200 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2015-07-23 11:39:28 +0200 |
commit | 8f37932efdbf7585c85ba1e7653e7080e17d7714 (patch) | |
tree | 046f813f526fda500f5237e835c7061186cc5f8b /include/astra/AstraObjectFactory.h | |
parent | 7a4cfe2e5fe384691f0516020b2fcd48b35a7f63 (diff) | |
download | astra-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.h | 13 |
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; } //---------------------------------------------------------------------------------------- |