ctkAbstractQObjectFactory.tpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  4. All rights reserved.
  5. Distributed under a BSD License. See LICENSE.txt file.
  6. This software is distributed "AS IS" WITHOUT ANY WARRANTY; without even
  7. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the above copyright notice for more information.
  9. =========================================================================*/
  10. #ifndef __ctkAbstractQObjectFactory_tpp
  11. #define __ctkAbstractQObjectFactory_tpp
  12. // QT includes
  13. #include <QDebug>
  14. // CTK includes
  15. #include "ctkAbstractObjectFactory.h"
  16. //----------------------------------------------------------------------------
  17. template<typename BaseClassType>
  18. ctkAbstractQObjectFactory<BaseClassType>::ctkAbstractQObjectFactory()
  19. {
  20. }
  21. //----------------------------------------------------------------------------
  22. template<typename BaseClassType>
  23. ctkAbstractQObjectFactory<BaseClassType>::~ctkAbstractQObjectFactory()
  24. {
  25. }
  26. //----------------------------------------------------------------------------
  27. template<typename BaseClassType>
  28. BaseClassType* ctkAbstractQObjectFactory<BaseClassType>::instantiate(const QString& itemKey)
  29. {
  30. return this->ctkAbstractObjectFactory<BaseClassType>::instantiate(itemKey);
  31. }
  32. //----------------------------------------------------------------------------
  33. template<typename BaseClassType>
  34. void ctkAbstractQObjectFactory<BaseClassType>::uninstantiate(const QString& itemKey)
  35. {
  36. this->ctkAbstractObjectFactory<BaseClassType>::uninstantiate(itemKey);
  37. }
  38. //----------------------------------------------------------------------------
  39. template<typename BaseClassType>
  40. template<typename ClassType>
  41. bool ctkAbstractQObjectFactory<BaseClassType>::registerQObject(QString& key)
  42. {
  43. key = QString::fromLatin1(ClassType::staticMetaObject.className());
  44. return this->ctkAbstractObjectFactory<BaseClassType>::template registerObject<ClassType>(key);
  45. }
  46. #endif