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.

90 lines
1.8 KiB

  1. /*
  2. * REVISIONS:
  3. * ane11Nov92: Changed arg type in Equal
  4. * pcy30Nov92: Added dispatcher and Register/UnregisterEvent stuff
  5. * sja09Dec92: Took out BAD Windows Debug Code.
  6. * cad27Dec93: include file madness
  7. * cad28Feb94: added copy constructor (just prints warning)
  8. * pcy08Apr94: Trim size, use static iterators, dead code removal
  9. */
  10. #define INCL_BASE
  11. #define INCL_DOS
  12. #define INCL_NOPM
  13. #include "cdefine.h"
  14. extern "C" {
  15. #if (C_OS & C_OS2)
  16. #include <os2.h>
  17. #endif
  18. #include <stdlib.h>
  19. #include <stdio.h>
  20. }
  21. #include "_defs.h"
  22. #include "update.h"
  23. #include "event.h"
  24. #include "err.h"
  25. #include "dispatch.h"
  26. UpdateObj::UpdateObj ()
  27. {
  28. theDispatcher = (PDispatcher)NULL;
  29. }
  30. UpdateObj::UpdateObj (const UpdateObj&)
  31. {
  32. theDispatcher = (PDispatcher)NULL;
  33. #ifdef APCDEBUG
  34. printf("Warning: UpdateObj copy constructor called\n");
  35. #endif
  36. }
  37. UpdateObj::~UpdateObj ()
  38. {
  39. if (theDispatcher) {
  40. delete theDispatcher;
  41. theDispatcher = (PDispatcher)NULL;
  42. }
  43. };
  44. INT UpdateObj::Update(PEvent value)
  45. {
  46. if(theDispatcher != NULL) {
  47. theDispatcher->Update(value); // Send updates to all objects registered
  48. }
  49. return ErrNO_ERROR;
  50. }
  51. INT UpdateObj::Set(INT,PCHAR) {
  52. return ErrNO_ERROR;
  53. }
  54. INT UpdateObj::Get(INT,PCHAR) {
  55. return ErrNO_ERROR;
  56. }
  57. INT UpdateObj::RegisterEvent(INT EventCode,PUpdateObj anUpdateObj)
  58. {
  59. if(theDispatcher == NULL) {
  60. theDispatcher = new Dispatcher;
  61. }
  62. return theDispatcher->RegisterEvent(EventCode,anUpdateObj);
  63. }
  64. INT UpdateObj::UnregisterEvent(INT EventCode,PUpdateObj anUpdateObj)
  65. {
  66. INT err = ErrNO_ERROR;
  67. if(theDispatcher) {
  68. err = theDispatcher->UnregisterEvent(EventCode,anUpdateObj);
  69. }
  70. return err;
  71. }