// Version: $Id$ // // // Commentary: // // // Change Log: // // // Code: #pragma once template dtkCorePluginFactory::dtkCorePluginFactory(void) { } template dtkCorePluginFactory::~dtkCorePluginFactory(void) { } // ///////////////////////////////////////////////////////////////// // Type creator registration // ///////////////////////////////////////////////////////////////// template void dtkCorePluginFactory::record(const QString& key, creator func) { if (this->creators.contains(key)) { qDebug() << "Factory already contains key" << key << ". Nothing is done"; return; } this->creators.insert(key, func); } // ///////////////////////////////////////////////////////////////// // Type creator invokation // ///////////////////////////////////////////////////////////////// template T *dtkCorePluginFactory::create(const QString& key) { if(!this->creators.contains(key)) return NULL; return this->creators.value(key)(); } // ///////////////////////////////////////////////////////////////// // Type creator inspection // ///////////////////////////////////////////////////////////////// template QStringList dtkCorePluginFactory::keys(void) { return this->creators.keys(); } // // dtkCorePluginFactory_t.h ends here