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
int error_detected (void) const
virtual int is_state_final (void)
 Check whether we have reached the final state..


Public Member Functions

 TAO_LF_CH_Event (void)
 Constructor.

virtual ~TAO_LF_CH_Event (void)
 Destructor.


Private Member Functions

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

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


Private Attributes

int prev_state_
 The previous state that the LF_CH_Event was in.


Friends

class TAO_LF_Multi_Event

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 handling purposes.

Definition at line 37 of file LF_CH_Event.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_LF_CH_Event::TAO_LF_CH_Event void   ) 
 

Constructor.

Definition at line 9 of file LF_CH_Event.cpp.

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

TAO_LF_CH_Event::~TAO_LF_CH_Event void   )  [virtual]
 

Destructor.

Definition at line 16 of file LF_CH_Event.cpp.

00017 {
00018 }


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 80 of file LF_CH_Event.cpp.

References prev_state_.

Referenced by TAO_LF_Multi_Event::error_detected().

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 }

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 100 of file LF_CH_Event.cpp.

Referenced by TAO_LF_Multi_Event::is_state_final(), and set_state().

00101 {
00102   return this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSED;
00103 }

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 89 of file LF_CH_Event.cpp.

References is_state_final().

00090 {
00091   // @@ NOTE: Is this still required?
00092   if (this->is_state_final () == 0
00093       && new_state == TAO_LF_Event::LFS_TIMEOUT)
00094     {
00095       this->state_ = new_state;
00096     }
00097 }

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 21 of file LF_CH_Event.cpp.

References prev_state_.

00022 {
00023   if (this->state_ == new_state)
00024     return;
00025 
00026     // Validate the state change
00027   if (this->state_ == TAO_LF_Event::LFS_IDLE)
00028     {
00029       // From the LFS_IDLE state we can only become active.
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       // Only a few states are possible from CONNECTION_WAIT states
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           // Dont reset the previous state
00063           this->state_ = new_state;
00064         }
00065     }
00066   return;
00067 }

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 71 of file LF_CH_Event.cpp.

References prev_state_.

Referenced by TAO_LF_Multi_Event::successful().

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 }


Friends And Related Function Documentation

friend class TAO_LF_Multi_Event [friend]
 

The TAO_LF_Multi_Event class is another specialization of TAO_LF_Event, used for aggregating many connection handlers into a single event object.. It requires friendship so that it can check the is_state_final() flag on each of its contained connection handlers.

Definition at line 47 of file LF_CH_Event.h.


Member Data Documentation

int TAO_LF_CH_Event::prev_state_ [private]
 

The previous state that the LF_CH_Event was in.

Definition at line 114 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 Thu Nov 9 12:21:59 2006 for TAO by doxygen 1.3.6