ctkAbstractQObjectFactory.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) 2010 Kitware Inc.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. =========================================================================*/
  14. #ifndef __ctkAbstractQObjectFactory_h
  15. #define __ctkAbstractQObjectFactory_h
  16. // Qt includes
  17. #include <QDebug>
  18. // CTK includes
  19. #include "ctkAbstractObjectFactory.h"
  20. //----------------------------------------------------------------------------
  21. template<typename BaseClassType>
  22. class ctkAbstractQObjectFactory : public ctkAbstractObjectFactory<BaseClassType>
  23. {
  24. public:
  25. //-----------------------------------------------------------------------------
  26. ///
  27. /// Constructor/Desctructor
  28. explicit ctkAbstractQObjectFactory();
  29. virtual ~ctkAbstractQObjectFactory();
  30. //----------------------------------------------------------------------------
  31. ///
  32. /// Create an instance of the object
  33. virtual BaseClassType * instantiate(const QString& itemKey);
  34. //----------------------------------------------------------------------------
  35. ///
  36. /// Uninstanciate the object
  37. virtual void uninstantiate(const QString& itemKey);
  38. //-----------------------------------------------------------------------------
  39. ///
  40. /// Register an object in the factory
  41. /// Note: The parameter 'key' passed by reference will be updated with the associated object name
  42. template<typename ClassType>
  43. bool registerQObject(QString& key);
  44. private:
  45. ctkAbstractQObjectFactory(const ctkAbstractQObjectFactory &); /// Not implemented
  46. void operator=(const ctkAbstractQObjectFactory&); /// Not implemented
  47. };
  48. #include "ctkAbstractQObjectFactory.tpp"
  49. #endif