From 9e077994b382b2df63e4b79dd2afebc50366d419 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Thu, 23 Jul 2015 11:43:47 +0200 Subject: Add hooks for plugin support to AstraObjectFactory To use these hooks, add a specialization of findPlugin for the desired type of object (e.g., Algorithms). --- include/astra/AstraObjectFactory.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'include/astra/AstraObjectFactory.h') diff --git a/include/astra/AstraObjectFactory.h b/include/astra/AstraObjectFactory.h index c935a7c..356acf9 100644 --- a/include/astra/AstraObjectFactory.h +++ b/include/astra/AstraObjectFactory.h @@ -73,6 +73,13 @@ public: */ T* create(const Config& _cfg); + /** Find a plugin. + * + * @param _sType Name of plugin to find. + * @return Pointer to a new, uninitialized object, or NULL if not found. + */ + T* findPlugin(std::string _sType); + }; @@ -93,6 +100,15 @@ CAstraObjectFactory::~CAstraObjectFactory() } + +//---------------------------------------------------------------------------------------- +// Hook for finding plugin in registered plugins. +template +T* CAstraObjectFactory::findPlugin(std::string _sType) +{ + return NULL; +} + //---------------------------------------------------------------------------------------- // Create template @@ -101,6 +117,9 @@ T* CAstraObjectFactory::create(std::string _sType) functor_find finder = functor_find(); finder.tofind = _sType; CreateObject::find(finder); + if (finder.res == NULL) { + finder.res = findPlugin(_sType); + } return finder.res; } -- cgit v1.2.3