#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) |
virtual int | successful (void) const =0 |
virtual int | error_detected (void) const =0 |
int | keep_waiting (void) |
Check if we should keep waiting. | |
Public Member Functions | |
TAO_LF_Event (void) | |
Constructor. | |
virtual | ~TAO_LF_Event (void) |
Destructor. | |
int | bind (TAO_LF_Follower *follower) |
Bind a follower. | |
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.)
|
|
Constructor.
|
|
Destructor.
|
|
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.
|
|
Return 1 if an error was detected while waiting for the event Implemented in TAO_LF_CH_Event, and TAO_LF_Invocation_Event. |
|
Check whether we have reached the final state..
Implemented in TAO_LF_CH_Event, and TAO_LF_Invocation_Event. |
|
Check if we should keep waiting.
|
|
Reset the state, irrespective of the previous states.
Reimplemented in TAO_LF_CH_Event. |
|
Set the state irrespective of anything.
Reimplemented in TAO_LF_CH_Event. |
|
Accessor to change the state. The state isnt changed unless certain conditions are satisfied. |
|
Validate the state change.
Implemented in TAO_LF_CH_Event, and TAO_LF_Invocation_Event. |
|
Return 1 if the condition was satisfied successfully, 0 if it has not Implemented in TAO_LF_CH_Event, and TAO_LF_Invocation_Event. |
|
Unbind the follower.
|
|
|
|
The bounded follower.
|
|
The current state.
|