#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 below. | |
enum | { LFS_IDLE, LFS_ACTIVE, LFS_SUCCESS, LFS_FAILURE, LFS_TIMEOUT, LFS_CONNECTION_CLOSED } |
void | state_changed (int new_state) |
Change the state. | |
int | successful (void) const |
Return 1 if the condition was satisfied successfully, 0 if it has not. | |
int | error_detected (void) const |
Return 1 if an error was detected while waiting for the event. | |
Public Methods | |
TAO_LF_Event (void) | |
Constructor. | |
virtual | ~TAO_LF_Event (void) |
Destructor. | |
int | bind (TAO_LF_Follower *follower) |
Bind a follower. More... | |
int | unbind (void) |
Unbind the follower. | |
int | keep_waiting (void) |
Check if we should keep waiting. | |
void | reset_state (int new_state) |
Reset the state, irrespective of the previous states. | |
Protected Methods | |
void | state_changed_i (int new_state) |
Validate the state change. | |
Private Methods | |
int | is_state_final (void) |
Check whether we have reached the final state.. | |
void | set_state (int new_state) |
Set the state. | |
Private Attributes | |
int | state_ |
The current state. | |
TAO_LF_Follower* | follower_ |
The bound follower thread. | |
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.)
|
|
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.
|
|
Check whether we have reached the final state..
|
|
Check if we should keep waiting.
|
|
Reset the state, irrespective of the previous states.
|
|
Set the state.
|
|
Change the state.
|
|
Validate the state change.
|
|
Return 1 if the condition was satisfied successfully, 0 if it has not.
|
|
Unbind the follower.
|
|
|
|
The bound follower thread.
|
|
The current state.
|