You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
1.4 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Dr.Frucht Systems Ltd.
  3. // Copyright � 2000-2016. All Rights Reserved.
  4. // Version 2.0 3/30/2016
  5. // Last modification: 3/30/2016
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: basicEvtDispatcher.h
  9. // AUTHOR: gagua
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Header file of basicEvtDispatcher.h
  13. //----------------------------------------------------------------------------
  14. //
  15. #ifndef __BASICEVTDISPATCHER_H_INCL__
  16. #define __BASICEVTDISPATCHER_H_INCL__
  17. // #include <pthread.h>
  18. #include "basicEvent.h"
  19. #include "basicMutex.h"
  20. /**
  21. * TODO: Add class description
  22. *
  23. * @author gagua
  24. */
  25. class EventDispatchService
  26. {
  27. public:
  28. EventDispatchService() {}
  29. ~EventDispatchService() {}
  30. virtual void dispatch(basicEvent * Evt) {}
  31. };
  32. class basicEventLogger : public EventDispatchService
  33. {
  34. private:
  35. bool bLogging;
  36. const char * sLogFileName;
  37. public:
  38. basicEventLogger()
  39. {
  40. bLogging = false;
  41. sLogFileName = NULL;
  42. }
  43. basicEventLogger(const char * FileName);
  44. ~basicEventLogger() {}
  45. void dispatch(basicEvent * Evt);
  46. };
  47. class basicEventDispatcherCollection
  48. {
  49. private:
  50. // pthread_mutex_t m_mQueueMutex;
  51. basicMutex m_mQueueMutex;
  52. EventQueue * m_pEvtQueue;
  53. public:
  54. basicEventDispatcherCollection();
  55. ~basicEventDispatcherCollection();
  56. void addHandler(EventDispatchService * handler);
  57. void broadcast(basicEvent * Evt);
  58. };
  59. #endif // __BASICEVTDISPATCHER_H_INCL__