ctkEventAdminActivator_p.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 CTKEVENTADMINACTIVATOR_H
  16. #define CTKEVENTADMINACTIVATOR_H
  17. #include <ctkPluginActivator.h>
  18. #include <service/log/ctkLogService.h>
  19. class ctkEALogTracker;
  20. class ctkEAConfiguration;
  21. class ctkEventAdminActivator : public QObject,
  22. public ctkPluginActivator
  23. {
  24. Q_OBJECT
  25. Q_INTERFACES(ctkPluginActivator)
  26. public:
  27. ctkEventAdminActivator();
  28. ~ctkEventAdminActivator();
  29. /**
  30. * Called upon starting of the plugin. Constructs and registers the ctkEventAdmin
  31. * service with the framework. Note that the properties of the service are
  32. * requested from the context in this method hence, the plugin has to be
  33. * restarted in order to take changed properties into account.
  34. *
  35. * @param context The plugin context passed by the framework
  36. *
  37. * @see ctkPluginActivator#start(ctkPluginContext*)
  38. */
  39. void start(ctkPluginContext* context);
  40. /**
  41. * Called upon stopping the plugin. This will block until all pending events are
  42. * delivered. An std::logic_error will be thrown on new events starting with
  43. * the begin of this method. However, it might take some time until we settle
  44. * down which is somewhat cumbersome given that the spec asks for return in
  45. * a timely manner.
  46. *
  47. * @param context The plugin context passed by the framework
  48. *
  49. * @see ctkPluginActivator#stop(ctkPluginContext*)
  50. */
  51. void stop(ctkPluginContext* context);
  52. /**
  53. * Gets a wrapper log service object. This object will either print messages
  54. * to standard out if no ctkLogService is present or call the respective
  55. * methods of available ctkLogService instances.
  56. */
  57. static ctkLogService* getLogService();
  58. private:
  59. QFile logFileFallback;
  60. static ctkEALogTracker* logTracker;
  61. ctkEAConfiguration* config;
  62. };
  63. #endif // CTKEVENTADMINACTIVATOR_H