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