AppCore
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
State Class Referenceabstract

abstract interface class creating API for states. More...

#include <State.h>

Inheritance diagram for State:
Inheritance graph
[legend]
Collaboration diagram for State:
Collaboration graph
[legend]

Public Member Functions

virtual ~State ()
 
virtual StateClone (StorageList &inputStream)=0
 Function returns concreete new instantion of descendent EState class.
 
QString GetStateName () const
 Function returns string representation of state.
 
virtual void OnEnter ()
 This method is called when state is going to be active.
 
virtual void OnEnter (const int32_t stateRequestCode)
 
virtual void OnResume ()
 This method is called when state is going to be reactivated from state history.
 
virtual void OnResume (const int32_t stateRequestCode, const int32_t stateResultCode, StorageList &storageList)
 
virtual void OnLeave ()
 This method is called immediately before state is to be inactivated.
 
virtual void OnTimeOut ()
 Called when on show of timer is expired.
 
virtual void OnSecondTick ()
 Called every second.
 
virtual void OnMinuteTick ()
 Called on every minute change.
 
virtual ~State ()
 
virtual StateClone (StorageList &inputStream)=0
 Function returns concreete new instantion of descendent EState class.
 
QString GetStateName () const
 Function returns string representation of state.
 
virtual void OnEnter ()
 This method is called when state is going to be active.
 
virtual void OnEnter (const int32_t stateRequestCode)
 
virtual void OnResume ()
 This method is called when state is going to be reactivated from state history.
 
virtual void OnResume (const int32_t stateRequestCode, const int32_t stateResultCode, StorageList &storageList)
 
virtual void OnLeave ()
 This method is called immediately before state is to be inactivated.
 
virtual void OnTimeOut ()
 Called when on show of timer is expired.
 
virtual void OnSecondTick ()
 Called every second.
 
virtual void OnMinuteTick ()
 Called on every minute change.
 

Protected Member Functions

 State (const QString &stateName, StateManager *context)
 
virtual void TimerStart (unsigned long timeout)
 
virtual void TimerStop ()
 Stop currently running timer.
 
virtual bool IsTimerActive ()
 Method to determine if timer is now running.
 
virtual StateDefines::StateAlgorithmResult ChangeState (const QString &stateName, StorageList &storageList, const StateDefines::ChangeStateFlag changeStateFlag=StateDefines::ChangeStateFlagUndefined)
 Launch a new state. You will not receive any information about when the state exits.
 
virtual StateDefines::StateAlgorithmResult ChangeStateForResult (const QString &stateName, StorageList &storageList, const int32_t stateRequestCode)
 Launch state for which you would like a result when it finished. When this state (stateName) exits, your OnResume() method will be called with the given stateRequestCode.
 
virtual StateDefines::StateAlgorithmResult FinishState (const StateDefines::FinishStateFlag finishStateFlag=StateDefines::FinishStateFlagUndefined)
 Call this when your state is done and should be closed. finishStateFlag - Additional options for how state should be finished.
 
virtual StateDefines::StateAlgorithmResult FinishStateWithResult (const int32_t stateResultCode, StorageList &storageList)
 Call this when your state is done and should be closed. State result code stateResultCode is propagated back to whoever launched you via State::ChangeStateForResult.
 
virtual bool IsChangeStateForResultMapEmpty ()
 IsChangeStateForResultMapEmpty method returns information about existing states which have to be returned in with specific result (we can exactly identify current state which does or doesn't return result)
 
StateManagerGetStateManager ()
 Method for getting used ECore.
 
virtual void FillStorageList (const StorageList &storageList)
 Copy all items from storageList and copy to member in this class.
 
virtual StorageListGetStorageList ()
 Gets storage list saved in this class.
 
 State (const QString &stateName, StateManager *context)
 
virtual void TimerStart (unsigned long timeout)
 
virtual void TimerStop ()
 Stop currently running timer.
 
virtual bool IsTimerActive ()
 Method to determine if timer is now running.
 
virtual StateDefines::StateAlgorithmResult ChangeState (const QString &stateName, StorageList &storageList, const StateDefines::ChangeStateFlag changeStateFlag=StateDefines::ChangeStateFlagUndefined)
 Launch a new state. You will not receive any information about when the state exits.
 
virtual StateDefines::StateAlgorithmResult ChangeStateForResult (const QString &stateName, StorageList &storageList, const int32_t stateRequestCode)
 Launch state for which you would like a result when it finished. When this state (stateName) exits, your OnResume() method will be called with the given stateRequestCode.
 
virtual StateDefines::StateAlgorithmResult FinishState (const StateDefines::FinishStateFlag finishStateFlag=StateDefines::FinishStateFlagUndefined)
 Call this when your state is done and should be closed. finishStateFlag - Additional options for how state should be finished.
 
virtual StateDefines::StateAlgorithmResult FinishStateWithResult (const int32_t stateResultCode, StorageList &storageList)
 Call this when your state is done and should be closed. State result code stateResultCode is propagated back to whoever launched you via State::ChangeStateForResult.
 
virtual bool IsChangeStateForResultMapEmpty ()
 IsChangeStateForResultMapEmpty method returns information about existing states which have to be returned in with specific result (we can exactly identify current state which does or doesn't return result)
 
StateManagerGetStateManager ()
 Method for getting used ECore.
 
virtual void FillStorageList (const StorageList &storageList)
 Copy all items from storageList and copy to member in this class.
 
virtual StorageListGetStorageList ()
 Gets storage list saved in this class.
 

Detailed Description

abstract interface class creating API for states.

Note
chose really wisely what to put here and what to change here. Use EStateUser and EStateService if it's possible

Constructor & Destructor Documentation

◆ ~State() [1/2]

State::~State ( )
virtual

Destructor

Note
stops 1 sec. timer

◆ State() [1/2]

INTERNAL State::State ( const QString &  stateName,
StateManager context 
)
protected

Constructor.

Parameters
stateNametext form of state identifier
contextwhich "ecore" (context manager) is used as manager of this state
Note
theoretically this state machine mechanism can work in more than one manager. But this hasn't been tested.
connects timers to signals and starts 1 sec. timer

◆ ~State() [2/2]

virtual State::~State ( )
virtual

Destructor

Note
stops 1 sec. timer

◆ State() [2/2]

State::State ( const QString &  stateName,
StateManager context 
)
protected

Constructor.

Parameters
stateNametext form of state identifier
contextwhich "ecore" (context manager) is used as manager of this state
Note
theoretically this state machine mechanism can work in more than one manager. But this hasn't been tested.
connects timers to signals and starts 1 sec. timer

Member Function Documentation

◆ ChangeState() [1/2]

StateDefines::StateAlgorithmResult State::ChangeState ( const QString &  stateName,
StorageList storageList,
const StateDefines::ChangeStateFlag  changeStateFlag = StateDefines::ChangeStateFlagUndefined 
)
protectedvirtual

Launch a new state. You will not receive any information about when the state exits.

Parameters
changeStateFlag- Additional options for how state should be started.
See also
enum StateDefines::ChangeStateFlag
Returns
See also
StateDefines::StateAlgorithmResult
Here is the call graph for this function:

◆ ChangeState() [2/2]

virtual StateDefines::StateAlgorithmResult State::ChangeState ( const QString &  stateName,
StorageList storageList,
const StateDefines::ChangeStateFlag  changeStateFlag = StateDefines::ChangeStateFlagUndefined 
)
protectedvirtual

Launch a new state. You will not receive any information about when the state exits.

Parameters
changeStateFlag- Additional options for how state should be started.
See also
enum StateDefines::ChangeStateFlag
Returns
See also
StateDefines::StateAlgorithmResult

◆ ChangeStateForResult() [1/2]

StateDefines::StateAlgorithmResult State::ChangeStateForResult ( const QString &  stateName,
StorageList storageList,
const int32_t  stateRequestCode 
)
protectedvirtual

Launch state for which you would like a result when it finished. When this state (stateName) exits, your OnResume() method will be called with the given stateRequestCode.

Here is the call graph for this function:

◆ ChangeStateForResult() [2/2]

virtual StateDefines::StateAlgorithmResult State::ChangeStateForResult ( const QString &  stateName,
StorageList storageList,
const int32_t  stateRequestCode 
)
protectedvirtual

Launch state for which you would like a result when it finished. When this state (stateName) exits, your OnResume() method will be called with the given stateRequestCode.

◆ Clone() [1/2]

virtual State * State::Clone ( StorageList inputStream)
pure virtual

Function returns concreete new instantion of descendent EState class.

Parameters
contextwhich "ecore" (context manager) is used as manager of this state
inputStreaminput stream data is stored here. Stream is no more available after finish of this function!
Returns
instance of EState like looking class.

◆ Clone() [2/2]

virtual State * State::Clone ( StorageList inputStream)
pure virtual

Function returns concreete new instantion of descendent EState class.

Parameters
contextwhich "ecore" (context manager) is used as manager of this state
inputStreaminput stream data is stored here. Stream is no more available after finish of this function!
Returns
instance of EState like looking class.

◆ FillStorageList() [1/2]

void State::FillStorageList ( const StorageList storageList)
protectedvirtual

Copy all items from storageList and copy to member in this class.

◆ FillStorageList() [2/2]

virtual void State::FillStorageList ( const StorageList storageList)
protectedvirtual

Copy all items from storageList and copy to member in this class.

◆ FinishState() [1/2]

StateDefines::StateAlgorithmResult State::FinishState ( const StateDefines::FinishStateFlag  finishStateFlag = StateDefines::FinishStateFlagUndefined)
protectedvirtual

Call this when your state is done and should be closed. finishStateFlag - Additional options for how state should be finished.

See also
enum StateDefines::FinishStateFlag
Here is the call graph for this function:

◆ FinishState() [2/2]

virtual StateDefines::StateAlgorithmResult State::FinishState ( const StateDefines::FinishStateFlag  finishStateFlag = StateDefines::FinishStateFlagUndefined)
protectedvirtual

Call this when your state is done and should be closed. finishStateFlag - Additional options for how state should be finished.

See also
enum StateDefines::FinishStateFlag

◆ FinishStateWithResult() [1/2]

StateDefines::StateAlgorithmResult State::FinishStateWithResult ( const int32_t  stateResultCode,
StorageList storageList 
)
protectedvirtual

Call this when your state is done and should be closed. State result code stateResultCode is propagated back to whoever launched you via State::ChangeStateForResult.

Here is the call graph for this function:

◆ FinishStateWithResult() [2/2]

virtual StateDefines::StateAlgorithmResult State::FinishStateWithResult ( const int32_t  stateResultCode,
StorageList storageList 
)
protectedvirtual

Call this when your state is done and should be closed. State result code stateResultCode is propagated back to whoever launched you via State::ChangeStateForResult.

◆ GetStateManager() [1/2]

StateManager * State::GetStateManager ( )
protected

Method for getting used ECore.

Here is the caller graph for this function:

◆ GetStateManager() [2/2]

StateManager * State::GetStateManager ( )
protected

Method for getting used ECore.

◆ GetStateName() [1/2]

QString State::GetStateName ( ) const

Function returns string representation of state.

Returns
state name

◆ GetStateName() [2/2]

QString State::GetStateName ( ) const

Function returns string representation of state.

Returns
state name

◆ GetStorageList() [1/2]

StorageList & State::GetStorageList ( )
protectedvirtual

Gets storage list saved in this class.

◆ GetStorageList() [2/2]

virtual StorageList & State::GetStorageList ( )
protectedvirtual

Gets storage list saved in this class.

◆ IsChangeStateForResultMapEmpty() [1/2]

bool State::IsChangeStateForResultMapEmpty ( )
protectedvirtual

IsChangeStateForResultMapEmpty method returns information about existing states which have to be returned in with specific result (we can exactly identify current state which does or doesn't return result)

Here is the call graph for this function:

◆ IsChangeStateForResultMapEmpty() [2/2]

virtual bool State::IsChangeStateForResultMapEmpty ( )
protectedvirtual

IsChangeStateForResultMapEmpty method returns information about existing states which have to be returned in with specific result (we can exactly identify current state which does or doesn't return result)

◆ IsTimerActive() [1/2]

bool State::IsTimerActive ( )
protectedvirtual

Method to determine if timer is now running.

Returns
true if timer is running false else

◆ IsTimerActive() [2/2]

virtual bool State::IsTimerActive ( )
protectedvirtual

Method to determine if timer is now running.

Returns
true if timer is running false else

◆ OnEnter() [1/4]

void State::OnEnter ( )
virtual

This method is called when state is going to be active.

Note
When function is overriden programmer should call parent's function.

◆ OnEnter() [2/4]

virtual void State::OnEnter ( )
virtual

This method is called when state is going to be active.

Note
When function is overriden programmer should call parent's function.

◆ OnEnter() [3/4]

void State::OnEnter ( const int32_t  stateRequestCode)
virtual

◆ OnEnter() [4/4]

virtual void State::OnEnter ( const int32_t  stateRequestCode)
virtual

◆ OnLeave() [1/2]

void State::OnLeave ( )
virtual

This method is called immediately before state is to be inactivated.

Note
When function is overriden programmer should call parent's function.

◆ OnLeave() [2/2]

virtual void State::OnLeave ( )
virtual

This method is called immediately before state is to be inactivated.

Note
When function is overriden programmer should call parent's function.

◆ OnMinuteTick() [1/2]

void State::OnMinuteTick ( )
virtual

Called on every minute change.

Note
Override this function if You want to use this feature.

◆ OnMinuteTick() [2/2]

virtual void State::OnMinuteTick ( )
virtual

Called on every minute change.

Note
Override this function if You want to use this feature.

◆ OnResume() [1/4]

void State::OnResume ( )
virtual

This method is called when state is going to be reactivated from state history.

Note
When function is overriden programmer should call parent's function.

◆ OnResume() [2/4]

virtual void State::OnResume ( )
virtual

This method is called when state is going to be reactivated from state history.

Note
When function is overriden programmer should call parent's function.

◆ OnResume() [3/4]

void State::OnResume ( const int32_t  stateRequestCode,
const int32_t  stateResultCode,
StorageList storageList 
)
virtual

◆ OnResume() [4/4]

virtual void State::OnResume ( const int32_t  stateRequestCode,
const int32_t  stateResultCode,
StorageList storageList 
)
virtual

◆ OnSecondTick() [1/2]

void State::OnSecondTick ( )
virtual

Called every second.

Note
Override this function if You want to use this feature.

◆ OnSecondTick() [2/2]

virtual void State::OnSecondTick ( )
virtual

Called every second.

Note
Override this function if You want to use this feature.

◆ OnTimeOut() [1/2]

void State::OnTimeOut ( )
virtual

Called when on show of timer is expired.

Note
Override this function if You want to use this feature.

◆ OnTimeOut() [2/2]

virtual void State::OnTimeOut ( )
virtual

Called when on show of timer is expired.

Note
Override this function if You want to use this feature.

◆ TimerStart() [1/2]

void State::TimerStart ( unsigned long  timeout)
protectedvirtual

◆ TimerStart() [2/2]

virtual void State::TimerStart ( unsigned long  timeout)
protectedvirtual

◆ TimerStop() [1/2]

void State::TimerStop ( )
protectedvirtual

Stop currently running timer.

◆ TimerStop() [2/2]

virtual void State::TimerStop ( )
protectedvirtual

Stop currently running timer.


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