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.

58 lines
1.5 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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 "basicMutex.h"
  19. #include "basicEvent.h"
  20. /**
  21. * TODO: Add class description
  22. *
  23. * @author gagua
  24. */
  25. class EventDispatchService{
  26. public:
  27. EventDispatchService(){};
  28. ~EventDispatchService(){};
  29. virtual void dispatch( basicEvent *Evt ){};
  30. };
  31. class basicEventLogger: public EventDispatchService{
  32. private:
  33. bool bLogging;
  34. const char *sLogFileName;
  35. public:
  36. basicEventLogger(){ bLogging = false; sLogFileName = NULL; };
  37. basicEventLogger( const char *FileName );
  38. ~basicEventLogger(){};
  39. void dispatch( basicEvent *Evt );
  40. };
  41. class basicEventDispatcherCollection{
  42. private:
  43. //pthread_mutex_t m_mQueueMutex;
  44. basicMutex m_mQueueMutex;
  45. EventQueue *m_pEvtQueue;
  46. public:
  47. basicEventDispatcherCollection();
  48. ~basicEventDispatcherCollection();
  49. void addHandler( EventDispatchService *handler );
  50. void broadcast( basicEvent *Evt );
  51. };
  52. #endif // __BASICEVTDISPATCHER_H_INCL__