00001 #include "tao/LF_CH_Event.h"
00002
00003 ACE_RCSID(tao,
00004 LF_Invocation_Event,
00005 "$Id: LF_CH_Event.cpp 72638 2006-05-14 02:38:11Z mesnier_p $")
00006
00007 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00008
00009 TAO_LF_CH_Event::TAO_LF_CH_Event (void)
00010 : TAO_LF_Event (),
00011 prev_state_ (TAO_LF_Event::LFS_IDLE)
00012
00013 {
00014 }
00015
00016 TAO_LF_CH_Event::~TAO_LF_CH_Event (void)
00017 {
00018 }
00019
00020 void
00021 TAO_LF_CH_Event::state_changed_i (int new_state)
00022 {
00023 if (this->state_ == new_state)
00024 return;
00025
00026
00027 if (this->state_ == TAO_LF_Event::LFS_IDLE)
00028 {
00029
00030 if (new_state == TAO_LF_Event::LFS_CONNECTION_WAIT)
00031 {
00032 this->prev_state_ = this->state_;
00033 this->state_ = new_state;
00034 }
00035 return;
00036 }
00037 else if (this->state_ == TAO_LF_Event::LFS_CONNECTION_WAIT)
00038 {
00039
00040 if (new_state == TAO_LF_Event::LFS_CONNECTION_CLOSED
00041 || new_state == TAO_LF_Event::LFS_SUCCESS)
00042 {
00043 this->prev_state_ = this->state_;
00044 this->state_ = new_state;
00045 }
00046
00047 return;
00048 }
00049 else if (this->state_ == TAO_LF_Event::LFS_SUCCESS)
00050 {
00051 if (new_state == TAO_LF_Event::LFS_CONNECTION_CLOSED)
00052 {
00053 this->prev_state_ = this->state_;
00054 this->state_ = new_state;
00055 }
00056 return;
00057 }
00058 else if (this->state_ == TAO_LF_Event::LFS_TIMEOUT)
00059 {
00060 if (new_state == TAO_LF_Event::LFS_CONNECTION_CLOSED)
00061 {
00062
00063 this->state_ = new_state;
00064 }
00065 }
00066 return;
00067 }
00068
00069
00070 int
00071 TAO_LF_CH_Event::successful (void) const
00072 {
00073 if (this->prev_state_ == TAO_LF_Event::LFS_CONNECTION_WAIT)
00074 return this->state_ == TAO_LF_Event::LFS_SUCCESS;
00075
00076 return this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSED;
00077 }
00078
00079 int
00080 TAO_LF_CH_Event::error_detected (void) const
00081 {
00082 if (this->prev_state_ == TAO_LF_Event::LFS_CONNECTION_WAIT)
00083 return this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSED;
00084
00085 return this->state_ == TAO_LF_Event::LFS_TIMEOUT;
00086 }
00087
00088 void
00089 TAO_LF_CH_Event::set_state (int new_state)
00090 {
00091
00092 if (this->is_state_final () == 0
00093 && new_state == TAO_LF_Event::LFS_TIMEOUT)
00094 {
00095 this->state_ = new_state;
00096 }
00097 }
00098
00099 int
00100 TAO_LF_CH_Event::is_state_final (void)
00101 {
00102 return this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSED;
00103 }
00104
00105 TAO_END_VERSIONED_NAMESPACE_DECL