ctkPluginTracker_p.h 2.6 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 CTKPLUGINTRACKERPRIVATE_H
  16. #define CTKPLUGINTRACKERPRIVATE_H
  17. #include "ctkPlugin.h"
  18. #include <QSharedPointer>
  19. #include <QMutex>
  20. /**
  21. * \ingroup PluginFramework
  22. */
  23. template<class T>
  24. class ctkPluginTrackerPrivate
  25. {
  26. public:
  27. ctkPluginTrackerPrivate(ctkPluginTracker<T>* pt,
  28. ctkPluginContext* context, ctkPlugin::States stateMask,
  29. ctkPluginTrackerCustomizer<T>* customizer);
  30. ~ctkPluginTrackerPrivate();
  31. /**
  32. * Accessor method for the current ctkTrackedPlugin object. This method is only
  33. * intended to be used by the unsynchronized methods which do not modify the
  34. * trackedPlugin field.
  35. *
  36. * @return The current ctkTrackedPlugin object.
  37. */
  38. QSharedPointer<ctkTrackedPlugin<T> > tracked() const;
  39. /* set this to true to compile in debug messages */
  40. static const bool DEBUG_FLAG; // = false;
  41. /**
  42. * The Bundle Context used by this <code>ctkPluginTracker</code>.
  43. */
  44. ctkPluginContext* const context;
  45. /**
  46. * The <code>ctkPluginTrackerCustomizer</code> object for this tracker.
  47. */
  48. ctkPluginTrackerCustomizer<T>* customizer;
  49. /**
  50. * Tracked plugins: <code>ctkPlugin</code> object -> customized Object and
  51. * plugin listener slot.
  52. */
  53. QSharedPointer<ctkTrackedPlugin<T> > trackedPlugin;
  54. /**
  55. * State mask for plugins being tracked. This field contains the ORed values
  56. * of the plugin states being tracked.
  57. */
  58. ctkPlugin::States mask;
  59. mutable QMutex mutex;
  60. private:
  61. inline ctkPluginTracker<T>* q_func()
  62. {
  63. return static_cast<ctkPluginTracker<T> *>(q_ptr);
  64. }
  65. inline const ctkPluginTracker<T>* q_func() const
  66. {
  67. return static_cast<const ctkPluginTracker<T> *>(q_ptr);
  68. }
  69. friend class ctkPluginTracker<T>;
  70. ctkPluginTracker<T> * const q_ptr;
  71. };
  72. #include "ctkPluginTracker_p.tpp"
  73. #endif // CTKPLUGINTRACKERPRIVATE_H