home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Found / FWNotifn / FWRecevr.cpp < prev    next >
Encoding:
Text File  |  1996-09-17  |  3.1 KB  |  106 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWRecevr.cpp
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #include "FWFound.hpp"
  11.  
  12. #ifndef FWRECEVR_H
  13. #include "FWRecevr.h"
  14. #endif
  15.  
  16. #ifndef FWINTSPC_H
  17. #include "FWIntSpc.h"
  18. #endif
  19.  
  20. #ifndef FWINTERE_H
  21. #include "FWIntere.h"
  22. #endif
  23.  
  24. //========================================================================================
  25. // CLASS FW_MReceiver
  26. //========================================================================================
  27.  
  28. FW_DEFINE_CLASS_M0(FW_MReceiver)
  29. FW_DEFINE_AUTO(FW_MReceiver)
  30.  
  31. //----------------------------------------------------------------------------------------
  32. // FW_MReceiver::FW_MReceiver
  33. //----------------------------------------------------------------------------------------
  34.  
  35. FW_MReceiver::FW_MReceiver() :
  36.     fIsConnected(TRUE),
  37.     fReceiverID(0)
  38. {
  39.     FW_END_CONSTRUCTOR
  40. }
  41.  
  42. //----------------------------------------------------------------------------------------
  43. // FW_MReceiver::~FW_MReceiver
  44. //----------------------------------------------------------------------------------------
  45.  
  46. FW_MReceiver::~FW_MReceiver()
  47. {
  48.     FW_START_DESTRUCTOR
  49.     
  50.     RemoveAllInterests();    
  51. }
  52.  
  53. //----------------------------------------------------------------------------------------
  54. // FW_MReceiver::AddInterest
  55. //----------------------------------------------------------------------------------------
  56.  
  57. void FW_MReceiver::AddInterest(const FW_CInterest& interest)
  58. {
  59.     FW_CPrivInterestSpace::Instance()->AddReceiverInterest(this, interest);
  60. }
  61.  
  62. //----------------------------------------------------------------------------------------
  63. // FW_MReceiver::RemoveAllInterests
  64. //----------------------------------------------------------------------------------------
  65.  
  66. void FW_MReceiver::RemoveAllInterests()
  67. {
  68.     FW_CPrivInterestSpace::Instance()->RemoveReceiver(this);
  69. }
  70.  
  71. //----------------------------------------------------------------------------------------
  72. // FW_MReceiver::RemoveInterest
  73. //----------------------------------------------------------------------------------------
  74.  
  75. void FW_MReceiver::RemoveInterest(const FW_CInterest& interest)
  76. {
  77.     FW_CPrivInterestSpace::Instance()->RemoveReceiverInterest(this, interest, true);
  78. }
  79.     
  80. //----------------------------------------------------------------------------------------
  81. // FW_MReceiver::Connect
  82. //----------------------------------------------------------------------------------------
  83.  
  84. void FW_MReceiver::Connect()
  85. {
  86.     if (!fIsConnected)
  87.     {
  88.         fIsConnected = true;
  89.         FW_CPrivInterestSpace::Instance()->SetReceiverIsConnected(this, true);
  90.     }
  91. }
  92.                                
  93. //----------------------------------------------------------------------------------------
  94. // FW_MReceiver::Disconnect
  95. //----------------------------------------------------------------------------------------
  96.  
  97. void FW_MReceiver::Disconnect()
  98. {
  99.     if (fIsConnected)
  100.     {
  101.         fIsConnected = false;
  102.         FW_CPrivInterestSpace::Instance()->SetReceiverIsConnected(this, false);
  103.  
  104.     }
  105. }
  106.