Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

TAO_LF_CH_Event Class Reference

Use the Leader/Follower loop to wait for one specific event in the invocation path. More...

#include <LF_CH_Event.h>

Inheritance diagram for TAO_LF_CH_Event:

Inheritance graph
[legend]
Collaboration diagram for TAO_LF_CH_Event:

Collaboration graph
[legend]
List of all members.

[NOHEADER]

int successful (void) const
 Return 1 if the condition was satisfied successfully, 0 if it has not. More...

int error_detected (void) const
 Return 1 if an error was detected while waiting for the event. More...

void reset_state (int new_state)
 Reset the state, irrespective of the previous states. More...

virtual int is_state_final (void)
 Check whether we have reached the final state.. More...


Public Methods

 TAO_LF_CH_Event (void)
 Constructor. More...

virtual ~TAO_LF_CH_Event (void)
 Destructor. More...


Private Methods

virtual void state_changed_i (int new_state)
 Validate and change the state. More...

virtual void set_state (int new_state)
 Set the state irrespective of anything. More...


Private Attributes

int prev_state_
 The previous state that the LF_CH_Event was in. More...


Detailed Description

Use the Leader/Follower loop to wait for one specific event in the invocation path.

Concrete event types and manipulation class which is used for connection handleing purposes.

Definition at line 31 of file LF_CH_Event.h.


Constructor & Destructor Documentation

TAO_LF_CH_Event::TAO_LF_CH_Event void   
 

Constructor.

Definition at line 10 of file LF_CH_Event.cpp.

00011   : TAO_LF_Event (),
00012     prev_state_ (TAO_LF_Event::LFS_IDLE)
00013 
00014 {
00015 }

TAO_LF_CH_Event::~TAO_LF_CH_Event void    [virtual]
 

Destructor.

Definition at line 17 of file LF_CH_Event.cpp.

00018 {
00019 }


Member Function Documentation

int TAO_LF_CH_Event::error_detected void    const [virtual]
 

Return 1 if an error was detected while waiting for the event.

Implements TAO_LF_Event.

Definition at line 91 of file LF_CH_Event.cpp.

References TAO_LF_Event::LFS_CONNECTION_CLOSE_WAIT, TAO_LF_Event::LFS_CONNECTION_CLOSED, TAO_LF_Event::LFS_CONNECTION_WAIT, prev_state_, and TAO_LF_Event::state_.

Referenced by TAO_Reactive_Connect_Strategy::wait.

00092 {
00093   if (this->prev_state_ == TAO_LF_Event::LFS_CONNECTION_WAIT)
00094     return this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSED;
00095   else if (this->prev_state_ == TAO_LF_Event::LFS_CONNECTION_CLOSE_WAIT)
00096     return (this->state_ != TAO_LF_Event::LFS_CONNECTION_CLOSED);
00097 
00098   return 0;
00099 }

int TAO_LF_CH_Event::is_state_final void    [protected, virtual]
 

Check whether we have reached the final state..

Implements TAO_LF_Event.

Definition at line 114 of file LF_CH_Event.cpp.

References TAO_LF_Event::LFS_CONNECTION_CLOSED, and TAO_LF_Event::state_.

Referenced by TAO_Connection_Handler::is_finalized, and set_state.

00115 {
00116   return this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSED;
00117 }

void TAO_LF_CH_Event::reset_state int    new_state
 

Reset the state, irrespective of the previous states.

Reimplemented from TAO_LF_Event.

void TAO_LF_CH_Event::set_state int    new_state [private, virtual]
 

Set the state irrespective of anything.

Reimplemented from TAO_LF_Event.

Definition at line 102 of file LF_CH_Event.cpp.

References is_state_final, TAO_LF_Event::LFS_TIMEOUT, and TAO_LF_Event::state_.

00103 {
00104   // @@ NOTE: Is this still required?
00105   if (this->is_state_final () == 0
00106       && new_state == TAO_LF_Event::LFS_TIMEOUT)
00107     {
00108       this->state_ = new_state;
00109     }
00110 }

void TAO_LF_CH_Event::state_changed_i int    new_state [private, virtual]
 

Validate and change the state.

Implements TAO_LF_Event.

Definition at line 22 of file LF_CH_Event.cpp.

References TAO_LF_Event::LFS_CONNECTION_CLOSE_WAIT, TAO_LF_Event::LFS_CONNECTION_CLOSED, TAO_LF_Event::LFS_CONNECTION_WAIT, TAO_LF_Event::LFS_IDLE, TAO_LF_Event::LFS_SUCCESS, TAO_LF_Event::LFS_TIMEOUT, prev_state_, and TAO_LF_Event::state_.

00023 {
00024   if (this->state_ == new_state)
00025     return;
00026 
00027     // Validate the state change
00028   if (this->state_ == TAO_LF_Event::LFS_IDLE)
00029     {
00030       // From the LFS_IDLE state we can only become active.
00031       if (new_state == TAO_LF_Event::LFS_CONNECTION_WAIT)
00032         {
00033           this->prev_state_ = this->state_;
00034           this->state_ = new_state;
00035         }
00036       return;
00037     }
00038   else if (this->state_ == TAO_LF_Event::LFS_CONNECTION_WAIT)
00039     {
00040       // Only a few states are possible from CONNECTION_WAIT states
00041       if (new_state == TAO_LF_Event::LFS_CONNECTION_CLOSED
00042           || new_state == TAO_LF_Event::LFS_SUCCESS)
00043         {
00044           this->prev_state_ = this->state_;
00045           this->state_ = new_state;
00046         }
00047 
00048       return;
00049     }
00050   else if (this->state_ == TAO_LF_Event::LFS_SUCCESS)
00051     {
00052       if (new_state == TAO_LF_Event::LFS_CONNECTION_CLOSE_WAIT
00053           || new_state == TAO_LF_Event::LFS_CONNECTION_CLOSED)
00054         {
00055           this->prev_state_ = this->state_;
00056           this->state_ = new_state;
00057         }
00058       return;
00059     }
00060   else if (this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSE_WAIT)
00061     {
00062       if (new_state == TAO_LF_Event::LFS_CONNECTION_CLOSED)
00063         {
00064           // Dont reset the previous state. We could have come only
00065           // from SUCESS. Let that state be preserved.
00066           this->state_ = new_state;
00067         }
00068     }
00069   else if (this->state_ == TAO_LF_Event::LFS_TIMEOUT)
00070     {
00071       if (new_state == TAO_LF_Event::LFS_CONNECTION_CLOSED)
00072         {
00073           // Dont reset the previous state
00074           this->state_ = new_state;
00075         }
00076     }
00077   return;
00078 }

int TAO_LF_CH_Event::successful void    const [virtual]
 

Return 1 if the condition was satisfied successfully, 0 if it has not.

Implements TAO_LF_Event.

Definition at line 82 of file LF_CH_Event.cpp.

References TAO_LF_Event::LFS_CONNECTION_CLOSED, TAO_LF_Event::LFS_CONNECTION_WAIT, TAO_LF_Event::LFS_SUCCESS, prev_state_, and TAO_LF_Event::state_.

Referenced by TAO_Transport::close_connection_shared, and TAO_LF_Connect_Strategy::wait.

00083 {
00084   if (this->prev_state_ == TAO_LF_Event::LFS_CONNECTION_WAIT)
00085     return this->state_ == TAO_LF_Event::LFS_SUCCESS;
00086 
00087   return this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSED;
00088 }


Member Data Documentation

int TAO_LF_CH_Event::prev_state_ [private]
 

The previous state that the LF_CH_Event was in.

Definition at line 109 of file LF_CH_Event.h.

Referenced by error_detected, state_changed_i, and successful.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 15:23:13 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002