ctkAbstractQObjectFactory.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) 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.txt
  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. /// \ingroup Core
  22. template<typename BaseClassType>
  23. class ctkAbstractQObjectFactory : public ctkAbstractObjectFactory<BaseClassType>
  24. {
  25. public:
  26. /// Constructor/Desctructor
  27. explicit ctkAbstractQObjectFactory();
  28. virtual ~ctkAbstractQObjectFactory();
  29. /// \brief Return a name allowing to uniquely identify the QObject
  30. /// By default, it return \a objectName obtained using staticMetaObject.className()
  31. virtual QString objectNameToKey(const QString& objectName);
  32. /// \brief Register an object in the factory
  33. /// The parameter \a key passed by reference will be updated with the
  34. /// associated object name obtained using ::objectNameToKey()
  35. template<typename ClassType>
  36. bool registerQObject(QString& key);
  37. private:
  38. ctkAbstractQObjectFactory(const ctkAbstractQObjectFactory &); /// Not implemented
  39. void operator=(const ctkAbstractQObjectFactory&); /// Not implemented
  40. };
  41. #include "ctkAbstractQObjectFactory.tpp"
  42. #endif