Dex.StateMachine.new
Description: Reference for Dex.StateMachine.new

### Constructor

# Dex StateMachinenew

#### Declaration [src]

    DexStateMachine*
    dex_state_machine_new (
      GType state_enum_type,
      guint initial_state,
      const DexStateTransition* transitions,
      guint n_transitions,
      DexScheduler* scheduler,
      gsize stack_size,
      gpointer user_data,
      GDestroyNotify user_data_destroy
    )

#### Description [src]

Creates a new `DexStateMachine`.

The transition table is copied and validated before the state machine is returned. Each transition must have a valid `from` state, valid `to` state, and non-`NULL` callback. Duplicate edges are rejected.

This constructor is not directly available to language bindings.

#### Parameters

`state_enum_type`

  Type: `GType`

  A `GType` for a `GEnum`.

`initial_state`

  Type: `guint`

  The initial state value.

`transitions`

  Type: An array of `DexStateTransition`

  Transition entries.

  The length of the array is specified in the `n_transitions` argument.
  The data is owned by the caller of the function.

`n_transitions`

  Type: `guint`

  The number of transition entries.

`scheduler`

  Type: `DexScheduler`

  Scheduler to spawn transition fibers on, or `NULL` for the thread default.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`stack_size`

  Type: `gsize`

  Stack size for transition fibers, or zero to use the default.

`user_data`

  Type: `gpointer`

  User data for transition callbacks.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`user_data_destroy`

  Type: `GDestroyNotify`

  Destroy notify for `user_data`.

  The argument can be `NULL`.

#### Return value

Type: `DexStateMachine`

A new `DexStateMachine`.

The caller of the function takes ownership of the data, and is responsible for freeing it.