ctkPluginFrameworkContextPrivate_p.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*=============================================================================
  2. Library: CTK
  3. Copyright (c) 2010 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 CTKPLUGINFRAMEWORKCONTEXTPRIVATE_P_H
  16. #define CTKPLUGINFRAMEWORKCONTEXTPRIVATE_P_H
  17. #include <QDebug>
  18. #include <QMutex>
  19. #include "ctkPluginFrameworkContext.h"
  20. #include "ctkPluginFramework.h"
  21. #include "ctkPluginStorage_p.h"
  22. #include "ctkPlugins_p.h"
  23. #include "ctkPluginFrameworkListeners_p.h"
  24. namespace ctk {
  25. class Plugin;
  26. class PluginFrameworkContextPrivate {
  27. public:
  28. /**
  29. * All plugins in this framework.
  30. */
  31. Plugins* plugins;
  32. /**
  33. * All listeners in this framework.
  34. */
  35. PluginFrameworkListeners listeners;
  36. /**
  37. * All registered services in this framework.
  38. */
  39. //Services services;
  40. /**
  41. * System plugin
  42. */
  43. PluginFramework systemPlugin;
  44. /**
  45. * Plugin storage
  46. */
  47. PluginStorage storage;
  48. /**
  49. * Framework id.
  50. */
  51. int id;
  52. /**
  53. * global lock.
  54. */
  55. static QMutex globalFwLock;
  56. /**
  57. * Id to use for next instance of plugin framework.
  58. */
  59. static int globalId;
  60. PluginFrameworkContext::Properties props;
  61. /**
  62. * Contruct a framework context
  63. *
  64. */
  65. PluginFrameworkContextPrivate(const PluginFrameworkContext::Properties& initProps);
  66. /**
  67. * Initialize the framework
  68. *
  69. */
  70. void init();
  71. /**
  72. * Undo as much as possible of what init() does.
  73. *
  74. */
  75. void uninit();
  76. /**
  77. *
  78. */
  79. int getId() const;
  80. /**
  81. * Check that the plugin belongs to this framework instance.
  82. *
  83. */
  84. void checkOurPlugin(Plugin* plugin) const;
  85. /**
  86. * Check that the plugin specified can resolve all its
  87. * Require-Plugin constraints.
  88. *
  89. * @param plugin Plugin to check, must be in INSTALLED state
  90. *
  91. * @throws PluginException
  92. */
  93. void resolvePlugin(PluginPrivate* plugin);
  94. /**
  95. * Log message for debugging framework
  96. *
  97. */
  98. QDebug log() const;
  99. private:
  100. QSet<PluginPrivate*> tempResolved;
  101. void checkRequirePlugin(PluginPrivate* plugin);
  102. };
  103. }
  104. #endif // CTKPLUGINFRAMEWORKCONTEXTPRIVATE_P_H