WSF
WsfScriptStateMachine::Transition Class Reference

#include <WsfScriptStateMachine.hpp>

Public Member Functions

 Transition ()=default
 Transition (WsfStringId aNextStateName)
 Transition (const Transition &aSrc)
virtual ~Transition ()=default
virtual TransitionClone () const
virtual bool Evaluate (WsfScriptContext &aContext)
int GetNextStateIndex () const
void SetNextStateIndex (int aNextStateIndex)
WsfStringId GetNextStateName () const
virtual bool Initialize (double aSimTime, WsfScriptContext &aContext)
virtual bool ProcessInput (UtInput &aInput, WsfScriptContext &aContext, WsfStringId aNameSpace)

Protected Attributes

WsfStringId mNextStateName
 The name (ID) of next state.
int mNextStateIndex {0}
 The index of the next state in the state machine.
WsfStringId mScriptName
 The string ID of the name of the script that defines the transition rule.
UtScript * mScriptPtr {nullptr}

Detailed Description

A Transition represents a rule that can cause a transition into a new state. If the Evaluate() method returns true then the state machine should transition to the new state.

Constructor & Destructor Documentation

◆ Transition() [1/3]

WsfScriptStateMachine::Transition::Transition ( )
default

References Transition().

Referenced by Clone(), Transition(), Transition(), and ~Transition().

◆ Transition() [2/3]

WsfScriptStateMachine::Transition::Transition ( WsfStringId aNextStateName)
explicit

◆ Transition() [3/3]

WsfScriptStateMachine::Transition::Transition ( const Transition & aSrc)

◆ ~Transition()

virtual WsfScriptStateMachine::Transition::~Transition ( )
virtualdefault

References Clone(), Evaluate(), and Transition().

Member Function Documentation

◆ Clone()

WsfScriptStateMachine::Transition * WsfScriptStateMachine::Transition::Clone ( ) const
virtual

A virtual 'copy constructor'. This must be provided by derived classes if they extend Transition.

References Transition().

Referenced by ~Transition().

◆ Evaluate()

bool WsfScriptStateMachine::Transition::Evaluate ( WsfScriptContext & aContext)
virtual

Evaluate the rule to determine if a transition should occur.

Parameters
aContextThe context for script execution.
Returns
true if a transition should occur or false if no transition should occur.

References WsfScriptContext::ExecuteScript(), and mScriptPtr.

Referenced by ~Transition().

◆ GetNextStateIndex()

int WsfScriptStateMachine::Transition::GetNextStateIndex ( ) const
inline

References mNextStateIndex.

◆ GetNextStateName()

WsfStringId WsfScriptStateMachine::Transition::GetNextStateName ( ) const
inline

References mNextStateName.

◆ Initialize()

bool WsfScriptStateMachine::Transition::Initialize ( double aSimTime,
WsfScriptContext & aContext )
virtual

Initialize the transition rule.

Parameters
aSimTimeThe current simulation time.
aContextThe context for script execution.
Returns
true if successful or false if not.

References WsfScriptContext::FindScript(), mScriptName, mScriptPtr, and ok.

◆ ProcessInput()

bool WsfScriptStateMachine::Transition::ProcessInput ( UtInput & aInput,
WsfScriptContext & aContext,
WsfStringId aNameSpace )
virtual

Process input for the transition rule.

Parameters
aInputThe input stream.
aContextThe script context into which the scripts are to be entered.
aNameSpaceThe string ID of the current state name.
Returns
true if a command was recognized (and processed) or false if the command was not one recognized.

References WsfScriptContext::Compile(), mNextStateName, and mScriptName.

◆ SetNextStateIndex()

void WsfScriptStateMachine::Transition::SetNextStateIndex ( int aNextStateIndex)
inline

References mNextStateIndex.

Member Data Documentation

◆ mNextStateIndex

int WsfScriptStateMachine::Transition::mNextStateIndex {0}
protected

The index of the next state in the state machine.

Referenced by GetNextStateIndex(), SetNextStateIndex(), Transition(), and Transition().

◆ mNextStateName

WsfStringId WsfScriptStateMachine::Transition::mNextStateName
protected

The name (ID) of next state.

Referenced by GetNextStateName(), ProcessInput(), Transition(), and Transition().

◆ mScriptName

WsfStringId WsfScriptStateMachine::Transition::mScriptName
protected

The string ID of the name of the script that defines the transition rule.

Referenced by Initialize(), ProcessInput(), Transition(), and Transition().

◆ mScriptPtr

UtScript* WsfScriptStateMachine::Transition::mScriptPtr {nullptr}
protected

The script that defines the transition rule. Note that this script is 'owned' by the script context under which it was compiled.

Referenced by Evaluate(), Initialize(), Transition(), and Transition().


The documentation for this class was generated from the following files:
Copyrights Multiple, All Rights Reserved