From 8f37932efdbf7585c85ba1e7653e7080e17d7714 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Thu, 23 Jul 2015 11:39:28 +0200 Subject: Reduce code duplication --- include/astra/AstraObjectFactory.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'include') 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::create(std::string _sType) template T* CAstraObjectFactory::create(const Config& _cfg) { - functor_find finder = functor_find(); - finder.tofind = _cfg.self.getAttribute("type"); - CreateObject::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; } //---------------------------------------------------------------------------------------- -- cgit v1.2.3