Leaked source code of windows server 2003
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.

87 lines
2.1 KiB

  1. /*
  2. * REVISIONS:
  3. * pcy30Nov92: Added header
  4. * pcy21Apr93: Added method to get list and re register
  5. * cad27Sep93: Add now return error code
  6. * cad28Sep93: Made sure destructor(s) virtual
  7. */
  8. #ifndef __DISPATCH_H
  9. #define __DISPATCH_H
  10. #include "apc.h"
  11. //
  12. // Defines
  13. //
  14. _CLASSDEF(Dispatcher)
  15. _CLASSDEF(EventNode)
  16. //
  17. // Implementation uses
  18. //
  19. #include "update.h"
  20. #include "list.h"
  21. //
  22. // Interface uses
  23. //
  24. _CLASSDEF(Event)
  25. class EventNode : public UpdateObj
  26. {
  27. protected:
  28. PList theUpdateList;
  29. INT theEventCode;
  30. public:
  31. EventNode(INT anEventCode,PUpdateObj anUpdateObj);
  32. virtual ~EventNode();
  33. virtual INT Update(PEvent anEvent);
  34. virtual INT IsA() const{return EVENTNODE;};
  35. virtual INT RegisterEvent(INT, PUpdateObj) {return 0;};
  36. virtual INT UnregisterEvent(INT, PUpdateObj) {return 0;};
  37. virtual INT Add(PUpdateObj anUpdateObj);
  38. virtual INT GetEventCode() { return theEventCode; };
  39. virtual INT GetCount() { return theUpdateList->GetItemsInContainer(); };
  40. virtual VOID Detach (PUpdateObj anUpdateObj);
  41. };
  42. /************************* DISPATCHER *****************************/
  43. // Dispatcher _cannot_ inherit from UpdateObj since UpdateObj has a dispatcher
  44. // as a data member. If the Dispatcher class inherits from UpdateObj, then
  45. // the construction of an UpdateObj leads to an infinite loop of the
  46. // UpdateObj constructor calling the Dispatcher constructor which turns around
  47. // and calls the UpdateObj constructor.
  48. class Dispatcher : public Obj {
  49. private:
  50. PList theDispatchEntries;
  51. public:
  52. Dispatcher();
  53. virtual ~Dispatcher();
  54. virtual INT RegisterEvent(INT id,PUpdateObj anUpdateObj);
  55. virtual INT UnregisterEvent(INT id,PUpdateObj anUpdateObj);
  56. virtual INT Update(PEvent anEvent);
  57. virtual INT RefreshEventRegistration(PUpdateObj anUpdater,
  58. PUpdateObj aRegistrant);
  59. virtual PList GetDispatchList() { return theDispatchEntries; };
  60. virtual INT GetRegisteredCount(INT id);
  61. };
  62. #endif