#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_CONNECTION_WAIT, LFS_SUCCESS, LFS_FAILURE, LFS_TIMEOUT, LFS_CONNECTION_CLOSED } |
void | state_changed (int new_state) |
Change the state. More... | |
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... | |
Public Types | |
Public Methods | |
TAO_LF_Event (void) | |
Constructor. More... | |
virtual | ~TAO_LF_Event (void) |
Destructor. More... | |
int | bind (TAO_LF_Follower *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. More... | |
int | unbind (void) |
Unbind the follower. More... | |
int | keep_waiting (void) |
Check if we should keep waiting. More... | |
void | reset_state (int new_state) |
Reset the state, irrespective of the previous states. More... | |
Protected Methods | |
void | state_changed_i (int new_state) |
Validate the state change. More... | |
Private Methods | |
int | is_state_final (void) |
Check whether we have reached the final state.. More... | |
void | set_state (int new_state) |
Set the state. More... | |
Private Attributes | |
int | state_ |
The current state. More... | |
TAO_LF_Follower * | follower_ |
The bound follower thread. More... | |
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.
|
|
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.
|