CuteHMI - Services (CuteHMI.Services.2)
cutehmi::services::Serviceable Class Referenceabstract

Serviceable interface. More...

#include <cutehmi/services/Serviceable.hpp>

Public Types

typedef QHash< QState *, QStringServiceStatuses
 

Public Member Functions

 Serviceable ()=default
 
virtual std::unique_ptr< ServiceStatusesconfigureStarted (QState *active, const QState *idling, const QState *yielding)=0
 Configure started state. More...
 
virtual std::unique_ptr< ServiceStatusesconfigureStarting (QState *starting)=0
 Configure starting state. More...
 
virtual std::unique_ptr< ServiceStatusesconfigureStopping (QState *stopping)=0
 Configure stopping state. More...
 
virtual std::unique_ptr< ServiceStatusesconfigureBroken (QState *broken)=0
 Configure broken state. More...
 
virtual std::unique_ptr< ServiceStatusesconfigureRepairing (QState *repairing)=0
 Configure repairing state. More...
 
virtual std::unique_ptr< ServiceStatusesconfigureEvacuating (QState *evacuating)=0
 Configure evacuating state. More...
 
virtual std::unique_ptr< QAbstractTransitiontransitionToStarted () const =0
 Transition to started state. More...
 
virtual std::unique_ptr< QAbstractTransitiontransitionToStopped () const =0
 Transition to stopped state. More...
 
virtual std::unique_ptr< QAbstractTransitiontransitionToBroken () const =0
 Transition to broken state. More...
 
virtual std::unique_ptr< QAbstractTransitiontransitionToYielding () const =0
 Transition to yielding state. More...
 
virtual std::unique_ptr< QAbstractTransitiontransitionToIdling () const =0
 Transition to idling state. More...
 

Protected Member Functions

virtual ~Serviceable ()=default
 
 Serviceable (const Serviceable &other)=default
 
Serviceableoperator= (const Serviceable &other)=default
 

Detailed Description

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.

State interface

Implementing object can utilize the state machine according to its needs by:

  • defining when standard transitions take place (and likely trigger them)
  • adding custom states to the standard ones
  • connecting slots to QState signals (custom or standard ones)

Member Typedef Documentation

◆ ServiceStatuses

Constructor & Destructor Documentation

◆ Serviceable() [1/2]

cutehmi::services::Serviceable::Serviceable ( )
default

◆ ~Serviceable()

virtual cutehmi::services::Serviceable::~Serviceable ( )
protectedvirtualdefault

◆ Serviceable() [2/2]

cutehmi::services::Serviceable::Serviceable ( const Serviceable other)
protecteddefault

Member Function Documentation

◆ configureBroken()

virtual std::unique_ptr<ServiceStatuses> cutehmi::services::Serviceable::configureBroken ( QState broken)
pure virtual

Configure broken state.

Parameters
brokenstate.
Returns
optional hash map containing status name for each state or nullptr if default statuses should be used.

◆ configureEvacuating()

virtual std::unique_ptr<ServiceStatuses> cutehmi::services::Serviceable::configureEvacuating ( QState evacuating)
pure virtual

Configure evacuating state.

Parameters
evacuatingstate.
Returns
optional hash map containing status name for each state or nullptr if default statuses should be used.

◆ configureRepairing()

virtual std::unique_ptr<ServiceStatuses> cutehmi::services::Serviceable::configureRepairing ( QState repairing)
pure virtual

Configure repairing state.

Parameters
repairingstate.
Returns
optional hash map containing status name for each state or nullptr if default statuses should be used.

◆ configureStarted()

virtual std::unique_ptr<ServiceStatuses> cutehmi::services::Serviceable::configureStarted ( QState active,
const QState idling,
const QState yielding 
)
pure virtual

Configure started state.

Started state is not directly accessible. Intead its child states shall be configured.

Parameters
activeactive state.
idlingidling state.
yieldingyielding state.
Returns
optional hash map containing status name for each state or nullptr if default statuses should be used.

◆ configureStarting()

virtual std::unique_ptr<ServiceStatuses> cutehmi::services::Serviceable::configureStarting ( QState starting)
pure virtual

Configure starting state.

Parameters
startingstate.
Returns
optional hash map containing status name for each state or nullptr if default statuses should be used.

◆ configureStopping()

virtual std::unique_ptr<ServiceStatuses> cutehmi::services::Serviceable::configureStopping ( QState stopping)
pure virtual

Configure stopping state.

Parameters
stoppingstate.
Returns
optional hash map containing status name for each state or nullptr if default statuses should be used.

◆ operator=()

Serviceable& cutehmi::services::Serviceable::operator= ( const Serviceable other)
protecteddefault

◆ transitionToBroken()

virtual std::unique_ptr<QAbstractTransition> cutehmi::services::Serviceable::transitionToBroken ( ) const
pure virtual

Transition to broken state.

Returns
transition to broken state. It is allowed to return nullptr. In such case service will never enter broken or repairing states.

◆ transitionToIdling()

virtual std::unique_ptr<QAbstractTransition> cutehmi::services::Serviceable::transitionToIdling ( ) const
pure virtual

Transition to idling state.

Returns
transition to idling state. It is allowed to return nullptr. In such case service will not enter idling state and will remain persistently active. This will make service impolite.

◆ transitionToStarted()

virtual std::unique_ptr<QAbstractTransition> cutehmi::services::Serviceable::transitionToStarted ( ) const
pure virtual

Transition to started state.

Returns
transition to started state. It is allowed to return nullptr. In such case transition from starting to started state will be immediate.

◆ transitionToStopped()

virtual std::unique_ptr<QAbstractTransition> cutehmi::services::Serviceable::transitionToStopped ( ) const
pure virtual

Transition to stopped state.

Returns
transition to stopped state. It is allowed to return nullptr. In such case transition from stopping to stopped state will be immediate.

◆ transitionToYielding()

virtual std::unique_ptr<QAbstractTransition> cutehmi::services::Serviceable::transitionToYielding ( ) const
pure virtual

Transition to yielding state.

Returns
transition to yielding state. It is allowed to return nullptr. In such case service will skip yielding state and immediately become active. This will make service impolite.