ctkTrackedPlugin_p.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*=============================================================================
  2. Library: CTK
  3. Copyright (c) German Cancer Research Center,
  4. Division of Medical and Biological Informatics
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. =============================================================================*/
  15. #ifndef CTKTRACKEDPLUGIN_P_H
  16. #define CTKTRACKEDPLUGIN_P_H
  17. #include <QSharedPointer>
  18. #include "ctkTrackedPluginListener_p.h"
  19. #include "ctkPluginAbstractTracked_p.h"
  20. #include "ctkPluginEvent.h"
  21. #include "ctkPlugin.h"
  22. /**
  23. * \ingroup PluginFramework
  24. */
  25. template<class T>
  26. class ctkTrackedPlugin : public ctkTrackedPluginListener,
  27. public ctkPluginAbstractTracked<QSharedPointer<ctkPlugin>, T, ctkPluginEvent>
  28. {
  29. public:
  30. ctkTrackedPlugin(ctkPluginTracker<T>* pluginTracker,
  31. ctkPluginTrackerCustomizer<T>* customizer);
  32. /**
  33. * Slot for the <code>ctkPluginTracker</code>
  34. * class. This method must NOT be synchronized to avoid deadlock
  35. * potential.
  36. *
  37. * @param event <code>ctkPluginEvent</code> object from the framework.
  38. */
  39. void pluginChanged(const ctkPluginEvent& event);
  40. private:
  41. typedef ctkPluginAbstractTracked<QSharedPointer<ctkPlugin>, T, ctkPluginEvent> Superclass;
  42. ctkPluginTracker<T>* pluginTracker;
  43. ctkPluginTrackerCustomizer<T>* customizer;
  44. /**
  45. * Call the specific customizer adding method. This method must not be
  46. * called while synchronized on this object.
  47. *
  48. * @param item Item to be tracked.
  49. * @param related Action related object.
  50. * @return Customized object for the tracked item or <code>null</code>
  51. * if the item is not to be tracked.
  52. */
  53. T customizerAdding(QSharedPointer<ctkPlugin> item,
  54. const ctkPluginEvent& related);
  55. /**
  56. * Call the specific customizer modified method. This method must not be
  57. * called while synchronized on this object.
  58. *
  59. * @param item Tracked item.
  60. * @param related Action related object.
  61. * @param object Customized object for the tracked item.
  62. */
  63. void customizerModified(QSharedPointer<ctkPlugin> item,
  64. const ctkPluginEvent& related, T object);
  65. /**
  66. * Call the specific customizer removed method. This method must not be
  67. * called while synchronized on this object.
  68. *
  69. * @param item Tracked item.
  70. * @param related Action related object.
  71. * @param object Customized object for the tracked item.
  72. */
  73. void customizerRemoved(QSharedPointer<ctkPlugin> item,
  74. const ctkPluginEvent& related, T object);
  75. };
  76. #include "ctkTrackedPlugin.tpp"
  77. #endif // CTKTRACKEDPLUGIN_P_H