Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

RMCast_Receiver_Module.cpp

Go to the documentation of this file.
00001 //
00002 // $Id: RMCast_Receiver_Module.cpp,v 1.1.1.1 2001/12/04 14:33:17 chad Exp $
00003 //
00004 
00005 #include "RMCast_Receiver_Module.h"
00006 #include "RMCast_Proxy.h"
00007 #include "ace/Log_Msg.h"
00008 
00009 #if !defined (__ACE_INLINE__)
00010 # include "RMCast_Receiver_Module.i"
00011 #endif /* ! __ACE_INLINE__ */
00012 
00013 ACE_RCSID(ace, RMCast_Receiver_Module, "$Id: RMCast_Receiver_Module.cpp,v 1.1.1.1 2001/12/04 14:33:17 chad Exp $")
00014 
00015 ACE_RMCast_Receiver_Module::~ACE_RMCast_Receiver_Module (void)
00016 {
00017 }
00018 
00019 int
00020 ACE_RMCast_Receiver_Module::data (ACE_RMCast::Data &data)
00021 {
00022   switch (this->state_)
00023     {
00024     case RS_NON_EXISTENT:
00025     case RS_JOINING:
00026       if (data.source != 0)
00027         {
00028           //ACE_DEBUG ((LM_DEBUG,
00029           //            "Receiver_Module::data - joining\n"));
00030 
00031           this->state_ = RS_JOINING;
00032           ACE_RMCast::Join join;
00033           if (data.source->reply_join (join) != 0)
00034             this->leaving (data.source);
00035         }
00036       break;
00037 
00038     case RS_JOINED:
00039       // ACE_DEBUG ((LM_DEBUG,
00040       //             "Receiver_Module::data - joined\n"));
00041       if (this->ACE_RMCast_Module::data (data) != 0)
00042         this->leaving (data.source);
00043       break;
00044 
00045     default:
00046     case RS_LEAVING:
00047       this->leaving (data.source);
00048       break;
00049     }
00050   return 0;
00051 }
00052 
00053 int
00054 ACE_RMCast_Receiver_Module::poll (ACE_RMCast::Poll &poll)
00055 {
00056   switch (this->state_)
00057     {
00058     case RS_NON_EXISTENT:
00059     case RS_JOINING:
00060       if (poll.source != 0)
00061         {
00062           this->state_ = RS_JOINING;
00063           ACE_RMCast::Join join;
00064           if (poll.source->reply_join (join) != 0)
00065             this->leaving (poll.source);
00066         }
00067       break;
00068 
00069     case RS_JOINED:
00070       if (this->ACE_RMCast_Module::poll (poll) != 0)
00071         this->leaving (poll.source);
00072 
00073     default:
00074     case RS_LEAVING:
00075       this->leaving (poll.source);
00076       break;
00077     }
00078   return 0;
00079 }
00080 
00081 int
00082 ACE_RMCast_Receiver_Module::ack_join (ACE_RMCast::Ack_Join &ack_join)
00083 {
00084   switch (this->state_)
00085     {
00086     case RS_NON_EXISTENT:
00087       if (ack_join.source != 0)
00088         {
00089           //ACE_DEBUG ((LM_DEBUG,
00090           //            "Receiver_Module::ack_join - joining\n"));
00091 
00092           this->state_ = RS_JOINING;
00093           ACE_RMCast::Join join;
00094           if (ack_join.source->reply_join (join) != 0)
00095             this->leaving (ack_join.source);
00096         }
00097       break;
00098 
00099     case RS_JOINING:
00100     case RS_JOINED:
00101       //ACE_DEBUG ((LM_DEBUG,
00102       //            "Receiver_Module::ack_join - joined\n"));
00103 
00104       this->state_ = RS_JOINED;
00105       if (this->ACE_RMCast_Module::ack_join (ack_join) != 0)
00106         this->leaving (ack_join.source);
00107       break;
00108 
00109     default:
00110     case RS_LEAVING:
00111       this->leaving (ack_join.source);
00112       break;
00113     }
00114   return 0;
00115 }
00116 
00117 int
00118 ACE_RMCast_Receiver_Module::ack_leave (ACE_RMCast::Ack_Leave &ack_leave)
00119 {
00120   //ACE_DEBUG ((LM_DEBUG,
00121   //            "Receiver_Module::ack_leave\n"));
00122 
00123   (void) this->ACE_RMCast_Module::ack_leave (ack_leave);
00124 
00125   // Returning -1 should remove the Proxy from the local set
00126   return -1;
00127 }
00128 
00129 int
00130 ACE_RMCast_Receiver_Module::ack (ACE_RMCast::Ack &)
00131 {
00132   return -1;
00133 }
00134 
00135 int
00136 ACE_RMCast_Receiver_Module::join (ACE_RMCast::Join &)
00137 {
00138   return -1;
00139 }
00140 
00141 int
00142 ACE_RMCast_Receiver_Module::leave (ACE_RMCast::Leave &)
00143 {
00144   return -1;
00145 }
00146 
00147 void
00148 ACE_RMCast_Receiver_Module::leaving (ACE_RMCast_Proxy *proxy)
00149 {
00150   this->state_ = RS_LEAVING;
00151   if (proxy != 0)
00152     {
00153       ACE_RMCast::Leave leave;
00154       (void) proxy->reply_leave (leave);
00155     }
00156   (void) this->close ();
00157 }

Generated on Mon Jun 16 13:12:37 2003 for ACE_RMCast by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002