AppCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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. More...
 
QString GetStateName () const
 Function returns string representation of state. More...
 
virtual void OnEnter ()
 This method is called when state is going to be active. More...
 
virtual void OnEnter (const int32_t stateRequestCode)
 
virtual void OnResume ()
 This method is called when state is going to be reactivated from state history. More...
 
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. More...
 
virtual void OnTimeOut ()
 Called when on show of timer is expired. More...
 
virtual void OnSecondTick ()
 Called every second. More...
 
virtual void OnMinuteTick ()
 Called on every minute change. More...
 
virtual ~State ()
 
virtual StateClone (StorageList &inputStream)=0
 Function returns concreete new instantion of descendent EState class. More...
 
QString GetStateName () const
 Function returns string representation of state. More...
 
virtual void OnEnter ()
 This method is called when state is going to be active. More...
 
virtual void OnEnter (const int32_t stateRequestCode)
 
virtual void OnResume ()
 This method is called when state is going to be reactivated from state history. More...
 
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. More...
 
virtual void OnTimeOut ()
 Called when on show of timer is expired. More...
 
virtual void OnSecondTick ()
 Called every second. More...
 
virtual void OnMinuteTick ()
 Called on every minute change. More...
 

Protected Member Functions

 State (const QString &stateName, StateManager *context)
 
virtual void TimerStart (unsigned long timeout)
 
virtual void TimerStop ()
 Stop currently running timer. More...
 
virtual bool IsTimerActive ()
 Method to determine if timer is now running. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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) More...
 
StateManagerGetStateManager ()
 Method for getting used ECore. More...
 
virtual void FillStorageList (const StorageList &storageList)
 Copy all items from storageList and copy to member in this class. More...
 
virtual StorageListGetStorageList ()
 Gets storage list saved in this class. More...
 
 State (const QString &stateName, StateManager *context)
 
virtual void TimerStart (unsigned long timeout)
 
virtual void TimerStop ()
 Stop currently running timer. More...
 
virtual bool IsTimerActive ()
 Method to determine if timer is now running. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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) More...
 
StateManagerGetStateManager ()
 Method for getting used ECore. More...
 
virtual void FillStorageList (const StorageList &storageList)
 Copy all items from storageList and copy to member in this class. More...
 
virtual StorageListGetStorageList ()
 Gets storage list saved in this class. More...
 

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::~State ( )
virtual

Destructor

Note
stops 1 sec. timer
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
virtual State::~State ( )
virtual

Destructor

Note
stops 1 sec. timer
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

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:

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
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.

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:

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.
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.
void State::FillStorageList ( const StorageList storageList)
protectedvirtual

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

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

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

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
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:

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:

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.

StateManager * State::GetStateManager ( )
protected

Method for getting used ECore.

Here is the caller graph for this function:

StateManager* State::GetStateManager ( )
protected

Method for getting used ECore.

QString State::GetStateName ( ) const

Function returns string representation of state.

Returns
state name
QString State::GetStateName ( ) const

Function returns string representation of state.

Returns
state name
StorageList & State::GetStorageList ( )
protectedvirtual

Gets storage list saved in this class.

virtual StorageList& State::GetStorageList ( )
protectedvirtual

Gets storage list saved in this class.

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)

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:

virtual bool State::IsTimerActive ( )
protectedvirtual

Method to determine if timer is now running.

Returns
true if timer is running false else
bool State::IsTimerActive ( )
protectedvirtual

Method to determine if timer is now running.

Returns
true if timer is running false else
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.
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.
virtual void State::OnEnter ( const int32_t  stateRequestCode)
virtual
void State::OnEnter ( const int32_t  stateRequestCode)
virtual
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.
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.
void State::OnMinuteTick ( )
virtual

Called on every minute change.

Note
Override this function if You want to use this feature.
virtual void State::OnMinuteTick ( )
virtual

Called on every minute change.

Note
Override this function if You want to use this feature.
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.
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.
void State::OnResume ( const int32_t  stateRequestCode,
const int32_t  stateResultCode,
StorageList storageList 
)
virtual
virtual void State::OnResume ( const int32_t  stateRequestCode,
const int32_t  stateResultCode,
StorageList storageList 
)
virtual
virtual void State::OnSecondTick ( )
virtual

Called every second.

Note
Override this function if You want to use this feature.
void State::OnSecondTick ( )
virtual

Called every second.

Note
Override this function if You want to use this feature.
void State::OnTimeOut ( )
virtual

Called when on show of timer is expired.

Note
Override this function if You want to use this feature.
virtual void State::OnTimeOut ( )
virtual

Called when on show of timer is expired.

Note
Override this function if You want to use this feature.
virtual void State::TimerStart ( unsigned long  timeout)
protectedvirtual
void State::TimerStart ( unsigned long  timeout)
protectedvirtual
void State::TimerStop ( )
protectedvirtual

Stop currently running timer.

virtual void State::TimerStop ( )
protectedvirtual

Stop currently running timer.


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