Class FSMState#

Inheritance Relationships#

Base Type#

Class Documentation#

class FSMState : public Karana::Core::Base#

Represents a state in an FSM.

This is a node in the graph that makes up an FSM.

Public Functions

FSMState(std::string_view name, const kc::ks_ptr<FSM> &fsm)#

FSMState constructor. The constructor is not meant to be called directly. Please use the create(…) method instead to create an instance.

Parameters:
  • name – The name of the FSMState. The names for states in an FSM must be unique.

  • fsm – The FSM that this FSMState will be a part of.

std::vector<kc::ks_ptr<FSMTransition>> getChildTransitions()#

Get all the transitions that connect this state to its children.

Returns:

All the transitions that connect this state to its children.

std::vector<kc::ks_ptr<FSMTransition>> getParentTransitions()#

Get all the transitions that connect this state to its parents.

Returns:

All the transitions that connect this state to its parents.

virtual std::string dumpString(std::string_view prefix = "", const Karana::Core::Base::DumpOptions *options = nullptr) const override#

Return information about the object.

Parameters:
  • prefix – A string to use as prefix for each output line

  • options – Struct with options to tailor the output

Returns:

String with the information about the object.

Public Members

Karana::Core::CallbackRegistry<void> on_enter_fns#

Functions that execute when entering the state.

Karana::Core::CallbackRegistry<void> on_exit_fns#

Functions that execute when exiting the state.

Karana::Core::CallbackRegistry<void> during_fns#

Functions that execute during the state.

Public Static Functions

static Karana::Core::ks_ptr<FSMState> create(std::string_view name, const kc::ks_ptr<FSM> &fsm)#

Create a new instance of FSMState.

Parameters:
  • name – The name of the FSMState. The names for states in an FSM must be unique.

  • fsm – The FSM that this FSMState will be a part of.

Returns:

A pointer to the newly created instance of FSMState.

Protected Functions

virtual void _discard(Karana::Core::ks_ptr<Karana::Core::Base> &base) override#

Discard the the object. Derived classes should implement this with the logic required to discard themselves if applicable.

Parameters:

base – - A pointer to the object to discard.