ctkAbstractQObjectFactory.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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_h
  11. #define __ctkAbstractQObjectFactory_h
  12. #include "ctkAbstractObjectFactory.h"
  13. #include <QDebug>
  14. //----------------------------------------------------------------------------
  15. template<typename BaseClassType>
  16. class ctkAbstractQObjectFactory : public ctkAbstractObjectFactory<BaseClassType>
  17. {
  18. public:
  19. //-----------------------------------------------------------------------------
  20. ///
  21. /// Constructor/Desctructor
  22. explicit ctkAbstractQObjectFactory();
  23. virtual ~ctkAbstractQObjectFactory();
  24. //----------------------------------------------------------------------------
  25. ///
  26. /// Create an instance of the object
  27. virtual BaseClassType * instantiate(const QString& itemKey);
  28. //----------------------------------------------------------------------------
  29. ///
  30. /// Uninstanciate the object
  31. virtual void uninstantiate(const QString& itemKey);
  32. //-----------------------------------------------------------------------------
  33. ///
  34. /// Register an object in the factory
  35. /// Note: The parameter 'key' passed by reference will be updated with the associated object name
  36. template<typename ClassType>
  37. bool registerQObject(QString& key);
  38. private:
  39. ctkAbstractQObjectFactory(const ctkAbstractQObjectFactory &); /// Not implemented
  40. void operator=(const ctkAbstractQObjectFactory&); /// Not implemented
  41. };
  42. #include "ctkAbstractQObjectFactory.tpp"
  43. #endif