diff options
author | bala <balanatarajan@users.noreply.github.com> | 2002-11-12 18:49:19 +0000 |
---|---|---|
committer | bala <balanatarajan@users.noreply.github.com> | 2002-11-12 18:49:19 +0000 |
commit | cc750e7f952a20c1c0604f4f60734cf3ed66699a (patch) | |
tree | 0cc3c26b5c6f6833ce11a7212d9165f1205f22d9 /TAO/tao/LF_CH_Event.cpp | |
parent | c5fd88734436fd8ce99508ea840fd419efb43102 (diff) | |
download | ATCD-cc750e7f952a20c1c0604f4f60734cf3ed66699a.tar.gz |
ChangeLogTag: Tue Nov 12 12:47:31 2002 Balachandran Natarajan <bala@isis-server.isis.vanderbilt.edu>
Diffstat (limited to 'TAO/tao/LF_CH_Event.cpp')
-rw-r--r-- | TAO/tao/LF_CH_Event.cpp | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/TAO/tao/LF_CH_Event.cpp b/TAO/tao/LF_CH_Event.cpp new file mode 100644 index 00000000000..0597f99e582 --- /dev/null +++ b/TAO/tao/LF_CH_Event.cpp @@ -0,0 +1,101 @@ +#include "LF_CH_Event.h" +#include "ace/Log_Msg.h" + + +#if !defined (__ACE_INLINE__) +# include "LF_CH_Event.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(tao, + LF_Invocation_Event, + "$Id$") + +TAO_LF_CH_Event::TAO_LF_CH_Event (void) + : TAO_LF_Event (), + prev_state_ (TAO_LF_Event::LFS_IDLE) + +{ +} + +TAO_LF_CH_Event::~TAO_LF_CH_Event (void) +{ +} + +void +TAO_LF_CH_Event::state_changed_i (int new_state) +{ + if (this->state_ == new_state) + return; + + // Validate the state change + if (this->state_ == TAO_LF_Event::LFS_IDLE) + { + // From the LFS_IDLE state we can only become active. + if (new_state == TAO_LF_Event::LFS_CONNECTION_WAIT) + { + this->prev_state_ = this->state_; + this->state_ = new_state; + } + return; + } + else if (this->state_ == TAO_LF_Event::LFS_CONNECTION_WAIT) + { + // Only a few states are possible from CONNECTION_WAIT states + if (new_state == TAO_LF_Event::LFS_CONNECTION_CLOSED + || new_state == TAO_LF_Event::LFS_SUCCESS) + { + this->prev_state_ = this->state_; + this->state_ = new_state; + } + + return; + } + else if (this->state_ == TAO_LF_Event::LFS_SUCCESS) + { + if (new_state == TAO_LF_Event::LFS_CONNECTION_CLOSED) + { + this->prev_state_ = this->state_; + this->state_ = new_state; + } + return; + } + + return; +} + + +int +TAO_LF_CH_Event::successful (void) const +{ + if (this->prev_state_ == TAO_LF_Event::LFS_CONNECTION_WAIT) + return this->state_ == TAO_LF_Event::LFS_SUCCESS; + else if (this->prev_state_ == TAO_LF_Event::LFS_SUCCESS) + return this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSED; + + return 0; +} + +int +TAO_LF_CH_Event::error_detected (void) const +{ + if (this->prev_state_ == TAO_LF_Event::LFS_CONNECTION_WAIT) + return this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSED; + else if (this->prev_state_ == TAO_LF_Event::LFS_SUCCESS) + return (this->state_ != TAO_LF_Event::LFS_CONNECTION_CLOSED); + + return 0; +} + +void +TAO_LF_CH_Event::set_state (int new_state) +{ + this->prev_state_ = this->state_; + this->state_ = new_state; +} + + +int +TAO_LF_CH_Event::is_state_final (void) +{ + return this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSED; +} |