NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
sStateMethod_c Class Referenceabstract

#include <dol/sLib/s_StateMethod.hpp>

Inheritance diagram for sStateMethod_c:
[legend]

Description

A class that handles state execution and transition.

[Presumably, sStateMethod_c actually means "methods for state interaction", or something like that].

Definition at line 7 of file s_StateMethod.hpp.

Public Member Functions

 sStateMethod_c (sStateIDChkIf_c &checker, sStateFctIf_c &factory, const sStateIDIf_c &initialState)
 Constructs a new sStateMethod_c instance.
 
virtual ~sStateMethod_c ()
 Destroys the sStateMethod_c instance.
 
virtual void initializeStateMethod ()
 Initializes the current state.
 
virtual void executeStateMethod ()
 Executes the current state.
 
virtual void finalizeStateMethod ()
 Prepares the current state for termination.
 
virtual void changeStateMethod (const sStateIDIf_c &newStateID)
 Transitions to a new state ID.
 
virtual void refreshStateMethod ()
 Marks the current state to be executed again.
 
virtual sStateIf_cgetState () const
 Gets the state holder.
 
virtual const sStateIDIf_cgetNewStateID () const
 Gets the next state ID.
 
virtual const sStateIDIf_cgetStateID () const
 Gets the current state ID.
 
virtual const sStateIDIf_cgetOldStateID () const
 Gets the previous state ID.
 
virtual int initializeStateLocalMethod ()=0
 Performs the actual state initialization.
 
virtual void executeStateLocalMethod ()=0
 Performs the actual state execution.
 
virtual void finalizeStateLocalMethod ()=0
 Performs the actual state termination.
 
virtual void changeStateLocalMethod (const sStateIDIf_c &newStateID)=0
 Performs the actual state transition.
 

Protected Attributes

sStateIDChkIf_cmpStateChk
 [Unused]. The state checker to use.
 
sStateFctIf_cmpStateFct
 The state factory which produces the state holder.
 
bool mInitFinalizeLock
 A lock to ensure initializeStateMethod and finalizeStateMethod are not called recursively.
 
bool mExecutionLock
 A lock to ensure executeStateMethod is not called recursively.
 
bool mIsValid
 If the state holder contains a valid state ID.
 
bool mStateChanged
 If the current state has changed during execution.
 
bool mRefreshStateMethod
 True, if after a state transition, the state should be executed again.
 
const sStateIDIf_cmpNewStateID
 The next state ID.
 
const sStateIDIf_cmpOldStateID
 The previous state ID.
 
const sStateIDIf_cmpStateID
 The current state ID.
 
sStateIf_cmpState
 The current state holder.
 

Constructor & Destructor Documentation

◆ sStateMethod_c()

sStateMethod_c::sStateMethod_c ( sStateIDChkIf_c checker,
sStateFctIf_c factory,
const sStateIDIf_c initialState 
)

Constructs a new sStateMethod_c instance.

Parameters
checkerThe state checker to use.
factoryThe state factory to use.
initialStateThe initial state ID of this instance.

Definition at line 6 of file s_StateMethod.cpp.

◆ ~sStateMethod_c()

sStateMethod_c::~sStateMethod_c ( )
virtual

Destroys the sStateMethod_c instance.

Definition at line 20 of file s_StateMethod.cpp.

Member Function Documentation

◆ initializeStateMethod()

void sStateMethod_c::initializeStateMethod ( )
virtual

Initializes the current state.

Definition at line 22 of file s_StateMethod.cpp.

◆ executeStateMethod()

void sStateMethod_c::executeStateMethod ( )
virtual

Executes the current state.

Definition at line 38 of file s_StateMethod.cpp.

◆ finalizeStateMethod()

void sStateMethod_c::finalizeStateMethod ( )
virtual

Prepares the current state for termination.

Definition at line 52 of file s_StateMethod.cpp.

◆ changeStateMethod()

void sStateMethod_c::changeStateMethod ( const sStateIDIf_c newStateID)
virtual

Transitions to a new state ID.

Definition at line 64 of file s_StateMethod.cpp.

◆ refreshStateMethod()

virtual void sStateMethod_c::refreshStateMethod ( )
inlinevirtual

Marks the current state to be executed again.

Definition at line 23 of file s_StateMethod.hpp.

◆ getState()

virtual sStateIf_c * sStateMethod_c::getState ( ) const
inlinevirtual

Gets the state holder.

Definition at line 24 of file s_StateMethod.hpp.

◆ getNewStateID()

virtual const sStateIDIf_c * sStateMethod_c::getNewStateID ( ) const
inlinevirtual

Gets the next state ID.

Definition at line 25 of file s_StateMethod.hpp.

◆ getStateID()

virtual const sStateIDIf_c * sStateMethod_c::getStateID ( ) const
inlinevirtual

Gets the current state ID.

Definition at line 26 of file s_StateMethod.hpp.

◆ getOldStateID()

virtual const sStateIDIf_c * sStateMethod_c::getOldStateID ( ) const
inlinevirtual

Gets the previous state ID.

Definition at line 27 of file s_StateMethod.hpp.

◆ initializeStateLocalMethod()

virtual int sStateMethod_c::initializeStateLocalMethod ( )
pure virtual

Performs the actual state initialization.

Implemented in sStateMethodUsr_FI_c.

◆ executeStateLocalMethod()

virtual void sStateMethod_c::executeStateLocalMethod ( )
pure virtual

Performs the actual state execution.

Implemented in sStateMethodUsr_FI_c.

◆ finalizeStateLocalMethod()

virtual void sStateMethod_c::finalizeStateLocalMethod ( )
pure virtual

Performs the actual state termination.

Implemented in sStateMethodUsr_FI_c.

◆ changeStateLocalMethod()

virtual void sStateMethod_c::changeStateLocalMethod ( const sStateIDIf_c newStateID)
pure virtual

Performs the actual state transition.

Implemented in sStateMethodUsr_FI_c.

Member Data Documentation

◆ mpStateChk

sStateIDChkIf_c& sStateMethod_c::mpStateChk
protected

[Unused]. The state checker to use.

Definition at line 35 of file s_StateMethod.hpp.

◆ mpStateFct

sStateFctIf_c& sStateMethod_c::mpStateFct
protected

The state factory which produces the state holder.

Definition at line 36 of file s_StateMethod.hpp.

◆ mInitFinalizeLock

bool sStateMethod_c::mInitFinalizeLock
protected

A lock to ensure initializeStateMethod and finalizeStateMethod are not called recursively.

Definition at line 38 of file s_StateMethod.hpp.

◆ mExecutionLock

bool sStateMethod_c::mExecutionLock
protected

A lock to ensure executeStateMethod is not called recursively.

Definition at line 39 of file s_StateMethod.hpp.

◆ mIsValid

bool sStateMethod_c::mIsValid
protected

If the state holder contains a valid state ID.

Definition at line 40 of file s_StateMethod.hpp.

◆ mStateChanged

bool sStateMethod_c::mStateChanged
protected

If the current state has changed during execution.

Definition at line 41 of file s_StateMethod.hpp.

◆ mRefreshStateMethod

bool sStateMethod_c::mRefreshStateMethod
protected

True, if after a state transition, the state should be executed again.

Definition at line 42 of file s_StateMethod.hpp.

◆ mpNewStateID

const sStateIDIf_c* sStateMethod_c::mpNewStateID
protected

The next state ID.

Definition at line 44 of file s_StateMethod.hpp.

◆ mpOldStateID

const sStateIDIf_c* sStateMethod_c::mpOldStateID
protected

The previous state ID.

Definition at line 45 of file s_StateMethod.hpp.

◆ mpStateID

const sStateIDIf_c* sStateMethod_c::mpStateID
protected

The current state ID.

Definition at line 46 of file s_StateMethod.hpp.

◆ mpState

sStateIf_c* sStateMethod_c::mpState
protected

The current state holder.

Definition at line 48 of file s_StateMethod.hpp.