#include <LF_Event.h>
Inheritance diagram for TAO_LF_Event:
State management | |
A Leader/Followers event goes through several states during its lifetime. We use an enum to represent those states and state changes are validated according to the rules defined in the concrete classes. We treat the states as finite states in a FSM. The possible sequence of states through which the FSM migrates is defined in the concrete classes. | |
enum | { LFS_IDLE = 0, LFS_ACTIVE, LFS_CONNECTION_WAIT, LFS_SUCCESS, LFS_FAILURE, LFS_TIMEOUT, LFS_CONNECTION_CLOSED } |
void | state_changed (int new_state, TAO_Leader_Follower &lf) |
virtual int | successful (void) const=0 |
virtual int | error_detected (void) const=0 |
int | keep_waiting (void) |
Check if we should keep waiting. | |
Public Types | |
Public Member Functions | |
TAO_LF_Event (void) | |
Constructor. | |
virtual | ~TAO_LF_Event (void) |
Destructor. | |
virtual int | bind (TAO_LF_Follower *follower) |
Bind a follower. | |
virtual int | unbind (void) |
Unbind the follower. | |
void | reset_state (int new_state) |
Reset the state, irrespective of the previous states. | |
Protected Member Functions | |
virtual void | state_changed_i (int new_state)=0 |
Validate the state change. | |
virtual int | is_state_final (void)=0 |
Check whether we have reached the final state.. | |
Protected Attributes | |
int | state_ |
The current state. | |
TAO_LF_Follower * | follower_ |
The bounded follower. | |
Private Member Functions | |
virtual void | set_state (int new_state) |
Set the state irrespective of anything. | |
Friends | |
class | TAO_Leader_Follower |
The Leader/Follower event loop is used to wait for incoming responses, as well as to wait for all the data to be flushed. This class encapsulates this event loop. It uses Template Method to parametrize the 'waited for' predicate (i.e. reply received or message sent or connection establishment etc.)
Definition at line 50 of file LF_Event.h.
|
Definition at line 88 of file LF_Event.h.
00088 { 00089 /// The event is created, and is in initial state 00090 LFS_IDLE = 0, 00091 /// The event is active 00092 LFS_ACTIVE, 00093 /// The event is waiting for connection completion. 00094 LFS_CONNECTION_WAIT, 00095 /// The event has completed successfully 00096 LFS_SUCCESS, 00097 /// A failure has been detected while the event was active 00098 LFS_FAILURE, 00099 /// The event has timed out 00100 LFS_TIMEOUT, 00101 /// The connection was closed. 00102 LFS_CONNECTION_CLOSED 00103 }; |
|
Constructor.
Definition at line 18 of file LF_Event.cpp.
|
|
Destructor.
Definition at line 24 of file LF_Event.cpp.
00025 { 00026 } |
|
Bind a follower. An event can be waited on by at most one follower thread, this method is used to bind the waiting thread to the event, in order to let the event signal any important state changes. This is virtual to allow the LF_Multi_Event derived type share the follower with all the subordinate LF_CH_Events.
Reimplemented in TAO_LF_Multi_Event. Definition at line 8 of file LF_Event.inl. References follower_. Referenced by TAO_LF_Multi_Event::bind(), and TAO_LF_Event_Binder::TAO_LF_Event_Binder().
|
|
Return 1 if an error was detected while waiting for the event Implemented in TAO_LF_CH_Event, TAO_LF_Invocation_Event, and TAO_LF_Multi_Event. Referenced by keep_waiting(), TAO_Leader_Follower::wait_for_event(), TAO_Reactive_Connect_Strategy::wait_i(), and TAO_LF_Connect_Strategy::wait_i(). |
|
Check whether we have reached the final state..
Implemented in TAO_LF_CH_Event, TAO_LF_Invocation_Event, and TAO_LF_Multi_Event. Referenced by state_changed(). |
|
Check if we should keep waiting.
Definition at line 32 of file LF_Event.inl. References error_detected(), and successful(). Referenced by TAO_IIOP_Connector::complete_connection(), TAO_Wait_On_Read::wait(), TAO_Wait_On_Reactor::wait(), TAO_Leader_Follower::wait_for_event(), and TAO_Reactive_Connect_Strategy::wait_i().
00033 { 00034 return (this->successful () == 0) && (this->error_detected () == 0); 00035 } |
|
Reset the state, irrespective of the previous states.
Definition at line 26 of file LF_Event.inl. Referenced by TAO_IIOP_Connection_Handler::handle_timeout().
00027 { 00028 this->state_ = new_state; 00029 } |
|
Set the state irrespective of anything.
Reimplemented in TAO_LF_CH_Event. Definition at line 44 of file LF_Event.cpp. Referenced by TAO_Leader_Follower::wait_for_event().
00045 { 00046 this->state_ = new_state; 00047 } |
|
|
Validate the state change.
Implemented in TAO_LF_CH_Event, TAO_LF_Invocation_Event, and TAO_LF_Multi_Event. Referenced by state_changed(). |
|
Return 1 if the condition was satisfied successfully, 0 if it has not Implemented in TAO_LF_CH_Event, TAO_LF_Invocation_Event, and TAO_LF_Multi_Event. Referenced by keep_waiting(), and TAO_Leader_Follower::wait_for_event(). |
|
Unbind the follower.
Reimplemented in TAO_LF_Multi_Event. Definition at line 17 of file LF_Event.inl. References follower_. Referenced by ACE_RCSID(), and TAO_LF_Multi_Event::unbind().
|
|
Definition at line 54 of file LF_Event.h. |
|
The bounded follower.
Definition at line 145 of file LF_Event.h. Referenced by bind(), state_changed(), and unbind(). |
|
The current state.
Definition at line 142 of file LF_Event.h. |