TwiceAsNice  2019-02-18
Public Member Functions | List of all members
Basda::ServiceStateMachine Class Reference

A ServiceStateMachine keeps track of scheduled and current state (one out of 6). More...

#include <ServiceStateMachine.h>

Inheritance diagram for Basda::ServiceStateMachine:
Inheritance graph
Collaboration diagram for Basda::ServiceStateMachine:
Collaboration graph

Public Member Functions

 ServiceStateMachine (const ServiceState &_state)
 ctor that jumps into a fixed state. More...
 
 ServiceStateMachine ()
 default ctor. Enters in the OFFLINE state. More...
 
 ServiceStateMachine (const ServiceStateMachineVar &_sm)
 ctor copying another state machine. More...
 
 ServiceStateMachine (const ServiceStateMachine &_sm)
 ctor copying another state machine. More...
 
bool operator== (const ServiceStateMachine &__rhs) const
 compare this state with another More...
 
ServiceStateMachineoperator= (const Basda::ServiceStateMachine &_sm)
 
 operator ServiceState ()
 
ServiceStateMachineinit (const ServiceState &_init)
 initialize current previous and next stat with the same state. More...
 
ServiceState now () const
 retreive the current state More...
 
ServiceState next () const
 retreive the next (scheduled) state More...
 
ServiceState last () const
 retreive the penultimate state. More...
 
bool transit () const
 get the flag that says this is a temporary transiting state. More...
 
bool isSettled ()
 figure out whether the current state equals the next one. More...
 
bool stateHasChanged ()
 figure out whether the current state equals the previous one. More...
 
ServiceStateMachinesetNow (ServiceState _now)
 set a new state in the "now" slot. More...
 
ServiceStateMachinesetNext (ServiceState _next)
 update the "next" slot. Also sets the completion state ty "BUSY" More...
 
ServiceStateMachinesetTransit (bool _t)
 reset the transit flag. More...
 
ServiceStateMachinesetAction (const std::string &_action, int _percent)
 update the percentage of completion. More...
 
Nice::Completion completion () const
 
 ServiceStateMachine (const ServiceState &_state)
 ctor that jumps into a fixed state. More...
 
 ServiceStateMachine ()
 default ctor. Enters in the OFFLINE state. More...
 
 ServiceStateMachine (const ServiceStateMachineVar &_sm)
 ctor copying another state machine. More...
 
 ServiceStateMachine (const ServiceStateMachine &_sm)
 ctor copying another state machine. More...
 
bool operator== (const ServiceStateMachine &__rhs) const
 compare this state with another More...
 
ServiceStateMachineoperator= (const Basda::ServiceStateMachine &_sm)
 
 operator ServiceState ()
 
ServiceStateMachineinit (const ServiceState &_init)
 initialize current previous and next stat with the same state. More...
 
ServiceState now () const
 retreive the current state More...
 
ServiceState next () const
 retreive the next (scheduled) state More...
 
ServiceState last () const
 retreive the penultimate state. More...
 
bool transit () const
 get the flag that says this is a temporary transiting state. More...
 
bool isSettled ()
 figure out whether the current state equals the next one. More...
 
bool stateHasChanged ()
 figure out whether the current state equals the previous one. More...
 
ServiceStateMachinesetNow (ServiceState _now)
 set a new state in the "now" slot. More...
 
ServiceStateMachinesetNext (ServiceState _next)
 update the "next" slot. Also sets the completion state ty "BUSY" More...
 
ServiceStateMachinesetTransit (bool _t)
 reset the transit flag. More...
 
ServiceStateMachinesetAction (const std::string &_action, int _percent)
 update the percentage of completion. More...
 
Nice::Completion completion () const
 

Additional Inherited Members

- Public Attributes inherited from Basda::ServiceStateMachineVar
::Basda::ServiceState now
 
::Basda::ServiceState next
 
::Basda::ServiceState last
 
bool transit
 
::Nice::CompletionVar completion
 

Detailed Description

A ServiceStateMachine keeps track of scheduled and current state (one out of 6).

Author
brieg.nosp@m.el@m.nosp@m.pia.d.nosp@m.e
Version
09.01.26
Date
2009-07-03 11:58:06 AM

Constructor & Destructor Documentation

◆ ServiceStateMachine() [1/8]

Basda::ServiceStateMachine::ServiceStateMachine ( const ServiceState _state)
inline

ctor that jumps into a fixed state.


Parameters
_state

◆ ServiceStateMachine() [2/8]

Basda::ServiceStateMachine::ServiceStateMachine ( )
inline

default ctor. Enters in the OFFLINE state.


◆ ServiceStateMachine() [3/8]

Basda::ServiceStateMachine::ServiceStateMachine ( const ServiceStateMachineVar _sm)
inline

ctor copying another state machine.


Parameters
_smThe status that is copied into this state machine.

◆ ServiceStateMachine() [4/8]

Basda::ServiceStateMachine::ServiceStateMachine ( const ServiceStateMachine _sm)
inline

ctor copying another state machine.


Parameters
_smThe status that is copied into this state machine.

◆ ServiceStateMachine() [5/8]

Basda::ServiceStateMachine::ServiceStateMachine ( const ServiceState _state)
inline

ctor that jumps into a fixed state.


Parameters
_state

◆ ServiceStateMachine() [6/8]

Basda::ServiceStateMachine::ServiceStateMachine ( )
inline

default ctor. Enters in the OFFLINE state.


◆ ServiceStateMachine() [7/8]

Basda::ServiceStateMachine::ServiceStateMachine ( const ServiceStateMachineVar _sm)
inline

ctor copying another state machine.


Parameters
_smThe status that is copied into this state machine.

◆ ServiceStateMachine() [8/8]

Basda::ServiceStateMachine::ServiceStateMachine ( const ServiceStateMachine _sm)
inline

ctor copying another state machine.


Parameters
_smThe status that is copied into this state machine.

Member Function Documentation

◆ completion() [1/2]

Nice::Completion Basda::ServiceStateMachine::completion ( ) const
inline

◆ completion() [2/2]

Nice::Completion Basda::ServiceStateMachine::completion ( ) const
inline

◆ init() [1/2]

ServiceStateMachine& Basda::ServiceStateMachine::init ( const ServiceState _init)
inline

initialize current previous and next stat with the same state.


Parameters
_initThe status to enter into.

Completion percentage is set to zero.

◆ init() [2/2]

ServiceStateMachine& Basda::ServiceStateMachine::init ( const ServiceState _init)
inline

initialize current previous and next stat with the same state.


Parameters
_initThe status to enter into.

Completion percentage is set to zero.

◆ isSettled() [1/2]

bool Basda::ServiceStateMachine::isSettled ( )
inline

figure out whether the current state equals the next one.


Returns
true If there are no pending actions..

◆ isSettled() [2/2]

bool Basda::ServiceStateMachine::isSettled ( )
inline

figure out whether the current state equals the next one.


Returns
true If there are no pending actions..

◆ last() [1/2]

ServiceState Basda::ServiceStateMachine::last ( ) const
inline

retreive the penultimate state.


◆ last() [2/2]

ServiceState Basda::ServiceStateMachine::last ( ) const
inline

retreive the penultimate state.


◆ next() [1/2]

ServiceState Basda::ServiceStateMachine::next ( ) const
inline

retreive the next (scheduled) state


Nice::Guard guard ( m_mutex );

◆ next() [2/2]

ServiceState Basda::ServiceStateMachine::next ( ) const
inline

retreive the next (scheduled) state


Nice::Guard guard ( m_mutex );

◆ now() [1/2]

ServiceState Basda::ServiceStateMachine::now ( ) const
inline

retreive the current state


Nice::Guard guard ( m_mutex );

◆ now() [2/2]

ServiceState Basda::ServiceStateMachine::now ( ) const
inline

retreive the current state


Nice::Guard guard ( m_mutex );

◆ operator ServiceState() [1/2]

Basda::ServiceStateMachine::operator ServiceState ( )
inline

◆ operator ServiceState() [2/2]

Basda::ServiceStateMachine::operator ServiceState ( )
inline

◆ operator=() [1/2]

ServiceStateMachine& Basda::ServiceStateMachine::operator= ( const Basda::ServiceStateMachine _sm)
inline

◆ operator=() [2/2]

ServiceStateMachine& Basda::ServiceStateMachine::operator= ( const Basda::ServiceStateMachine _sm)
inline

◆ operator==() [1/2]

bool Basda::ServiceStateMachine::operator== ( const ServiceStateMachine __rhs) const
inline

compare this state with another


Parameters
__rhsThe right hand side. The other state.
Returns
false if the main state variables (current, next and previous) differ or the time stamps of the completion differ.

◆ operator==() [2/2]

bool Basda::ServiceStateMachine::operator== ( const ServiceStateMachine __rhs) const
inline

compare this state with another


Parameters
__rhsThe right hand side. The other state.
Returns
false if the main state variables (current, next and previous) differ or the time stamps of the completion differ.

◆ setAction() [1/2]

ServiceStateMachine& Basda::ServiceStateMachine::setAction ( const std::string &  _action,
int  _percent 
)
inline

update the percentage of completion.


Parameters
_actionThe short string that indicates what is to be done.
_percentThe new percentage.
Returns
This object itself.

◆ setAction() [2/2]

ServiceStateMachine& Basda::ServiceStateMachine::setAction ( const std::string &  _action,
int  _percent 
)
inline

update the percentage of completion.


Parameters
_actionThe short string that indicates what is to be done.
_percentThe new percentage.
Returns
This object itself.

◆ setNext() [1/2]

ServiceStateMachine& Basda::ServiceStateMachine::setNext ( ServiceState  _next)
inline

update the "next" slot. Also sets the completion state ty "BUSY"


Parameters
_nextThe state scheduled to come next.
Returns
This object itself.

◆ setNext() [2/2]

ServiceStateMachine& Basda::ServiceStateMachine::setNext ( ServiceState  _next)
inline

update the "next" slot. Also sets the completion state ty "BUSY"


Parameters
_nextThe state scheduled to come next.
Returns
This object itself.

◆ setNow() [1/2]

ServiceStateMachine& Basda::ServiceStateMachine::setNow ( ServiceState  _now)
inline

set a new state in the "now" slot.


Parameters
_nowwhat is to be set as the current state.

The existing state is saved in the "last" slot.

Returns
This object itself.

◆ setNow() [2/2]

ServiceStateMachine& Basda::ServiceStateMachine::setNow ( ServiceState  _now)
inline

set a new state in the "now" slot.


Parameters
_nowwhat is to be set as the current state.

The existing state is saved in the "last" slot.

Returns
This object itself.

◆ setTransit() [1/2]

ServiceStateMachine& Basda::ServiceStateMachine::setTransit ( bool  _t)
inline

reset the transit flag.


Parameters
_tThe new flag.
Returns
This object itself.

◆ setTransit() [2/2]

ServiceStateMachine& Basda::ServiceStateMachine::setTransit ( bool  _t)
inline

reset the transit flag.


Parameters
_tThe new flag.
Returns
This object itself.

◆ stateHasChanged() [1/2]

bool Basda::ServiceStateMachine::stateHasChanged ( )
inline

figure out whether the current state equals the previous one.


Returns
true If the state variable in "next" is no longer equal to "now".

◆ stateHasChanged() [2/2]

bool Basda::ServiceStateMachine::stateHasChanged ( )
inline

figure out whether the current state equals the previous one.


Returns
true If the state variable in "next" is no longer equal to "now".

◆ transit() [1/2]

bool Basda::ServiceStateMachine::transit ( ) const
inline

get the flag that says this is a temporary transiting state.


◆ transit() [2/2]

bool Basda::ServiceStateMachine::transit ( ) const
inline

get the flag that says this is a temporary transiting state.



The documentation for this class was generated from the following file: