CuteHMI - Services (CuteHMI.Services.3)
|
Serviceable interface. More...
#include <cutehmi/services/Serviceable.hpp>
Public Types | |
typedef std::function< void(QState &state, const QString &status)> | AssignStatusFunction |
Public Member Functions | |
virtual void | configureStarting (QState *starting, AssignStatusFunction assignStatus)=0 |
Configure starting state. More... | |
virtual void | configureStarted (QState *active, const QState *idling, const QState *yielding, AssignStatusFunction assignStatus)=0 |
Configure started state. More... | |
virtual void | configureStopping (QState *stopping, AssignStatusFunction assignStatus)=0 |
Configure stopping state. More... | |
virtual void | configureBroken (QState *broken, AssignStatusFunction assignStatus)=0 |
Configure broken state. More... | |
virtual void | configureRepairing (QState *repairing, AssignStatusFunction assignStatus)=0 |
Configure repairing state. More... | |
virtual void | configureEvacuating (QState *evacuating, AssignStatusFunction assignStatus)=0 |
Configure evacuating state. More... | |
virtual std::unique_ptr< QAbstractTransition > | transitionToStarted () const =0 |
Transition to started state. More... | |
virtual std::unique_ptr< QAbstractTransition > | transitionToStopped () const =0 |
Transition to stopped state. More... | |
virtual std::unique_ptr< QAbstractTransition > | transitionToBroken () const =0 |
Transition to broken state. More... | |
virtual std::unique_ptr< QAbstractTransition > | transitionToYielding () const =0 |
Transition to yielding state. More... | |
virtual std::unique_ptr< QAbstractTransition > | transitionToIdling () const =0 |
Transition to idling state. More... | |
Protected Member Functions | |
Serviceable ()=default | |
virtual | ~Serviceable ()=default |
Serviceable (const Serviceable &other)=default | |
Serviceable & | operator= (const Serviceable &other)=default |
Serviceable interface.
By implementing this interface object is allowed to be embedded inside Service instance.
Implementing Serviceable interface involves configuring states and defining transitions. During configuration state interface can be extended by adding additional child states to the states passed by configuration functions.
Standard states and transitions are shown on the following state chart diagram.
Implementing object can utilize the state machine according to its needs by:
typedef std::function<void (QState & state, const QString & status)> cutehmi::services::Serviceable::AssignStatusFunction |
|
protecteddefault |
|
protectedvirtualdefault |
|
protecteddefault |
|
pure virtual |
Configure broken state.
broken | state. |
assignStatus | a function callback that allows one to associate the state with custom service status. |
Implemented in cutehmi::services::SelfService, and cutehmi::services::ServiceGroup.
|
pure virtual |
Configure evacuating state.
evacuating | state. |
assignStatus | a function callback that allows one to associate the state with custom service status. |
Implemented in cutehmi::services::SelfService, and cutehmi::services::ServiceGroup.
|
pure virtual |
Configure repairing state.
repairing | state. |
assignStatus | a function callback that allows one to associate the state with custom service status. |
Implemented in cutehmi::services::SelfService, and cutehmi::services::ServiceGroup.
|
pure virtual |
Configure started state.
Started state is not directly accessible. Intead its child states shall be configured.
active | active state. In this state any resource-hungry and intense operations shall be performed. Serviceable object may add child states to active state for its own use. |
idling | idling state. In this state a serviceable should not perform any intense operations or consume resources. Serviceable decides by itself when to enter idling state. Some objects may never activate the transition to idling state. When serviceable object is ready to become active again it should signal it by activating transitionToIdling(). No child states can be added to idling state. |
yielding | yielding state. In this state a service should not perform any intense operations or consume resources. It should just wait until it is activated, therefore no child states can be added to yielding state. |
assignStatus | a function callback that allows one to associate the state with custom service status. |
Implemented in cutehmi::services::SelfService, and cutehmi::services::ServiceGroup.
|
pure virtual |
Configure starting state.
starting | state. |
assignStatus | a function callback that allows one to associate the state with custom service status. |
Implemented in cutehmi::services::SelfService, and cutehmi::services::ServiceGroup.
|
pure virtual |
Configure stopping state.
stopping | state. |
assignStatus | a function callback that allows one to associate the state with custom service status. |
Implemented in cutehmi::services::SelfService, and cutehmi::services::ServiceGroup.
|
protecteddefault |
|
pure virtual |
Transition to broken state.
nullptr
. In such case service will never enter broken or repairing states. Implemented in cutehmi::services::SelfService, and cutehmi::services::ServiceGroup.
|
pure virtual |
Transition to idling state.
nullptr
. In such case service will not enter idling state and will remain persistently active. This will make service impolite. Implemented in cutehmi::services::SelfService, and cutehmi::services::ServiceGroup.
|
pure virtual |
Transition to started state.
nullptr
. In such case transition from starting to started state will be immediate. Implemented in cutehmi::services::SelfService, and cutehmi::services::ServiceGroup.
|
pure virtual |
Transition to stopped state.
nullptr
. In such case transition from stopping to stopped state will be immediate. Implemented in cutehmi::services::SelfService, and cutehmi::services::ServiceGroup.
|
pure virtual |
Transition to yielding state.
nullptr
. In such case service will skip yielding state and immediately become active. This will make service impolite. Implemented in cutehmi::services::SelfService, and cutehmi::services::ServiceGroup.