stm2go

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGoSTMMap

func NewGoSTMMap(pkg *GoPkgSource, stms map[string]*StateMachine, states map[string]*State) ([]*GoSTMSource, map[*State][]*GoSTMSource, *State)

A function to make map between a parent state and a state machine

func Parse

func Parse(data []byte) (map[string]*StateMachine, map[string]*State)

Types

type Event

type Event struct {
	Name   string
	Cond   string
	Action string
}

type GoPkgSource

type GoPkgSource struct {
	Fullpkgname string `json: "fullpkgname"`
	Domain      string `json: "domain"`
	Pkgname     string `json: "pkgname"`
}

func NewGoPkgSource

func NewGoPkgSource(domain string, pkgname string) *GoPkgSource

A function to create GoSource

out: io.Writer (e.g. os.Stdout)
domain: domain name for package
pkgname: package name

func (*GoPkgSource) Common

func (g *GoPkgSource) Common(w *Writer)

A function to generate Common

func (*GoPkgSource) GenMain

func (g *GoPkgSource) GenMain(w *Writer, stms []*GoSTMSource, names map[string]string)

A function to generate an example of main

func (*GoPkgSource) TestGen

func (g *GoPkgSource) TestGen(w *Writer, stms []*GoSTMSource, names map[string]string)

A function to generate an example of test code

type GoSTMSource

type GoSTMSource struct {
	Id string
	// contains filtered or unexported fields
}

func NewGoSTMSource

func NewGoSTMSource(name string,
	ss []*State, ts []*Transition, ex []*Transition,
	initial *State, pkg *GoPkgSource, root bool) *GoSTMSource

A function to create GoSTMSource

out: io.Writer
name: name of STM
ss: Slice of States
states: Set for states
ts: Slice of Transitions
ex: Slice of ExTransitions
initial: Initial State
pkg: GoSource for Pkg
root: Indicator whether the stm is root or not

func (*GoSTMSource) BaseHeader

func (g *GoSTMSource) BaseHeader(w *Writer)

A function to generate the string of header

func (*GoSTMSource) BaseStateDefinition

func (g *GoSTMSource) BaseStateDefinition(w *Writer, names map[string]string)

A function to generate Enum for states

func (*GoSTMSource) BaseStateInitialize

func (g *GoSTMSource) BaseStateInitialize(w *Writer, names map[string]string)

A function to generate init function

func (*GoSTMSource) BaseTransDefinition

func (g *GoSTMSource) BaseTransDefinition(w *Writer, names map[string]string)

A function to generate base for a given STM

func (*GoSTMSource) BaseTransDefinitionWithExternal added in v0.4.0

func (g *GoSTMSource) BaseTransDefinitionWithExternal(w *Writer, names map[string]string)

A function to generate base for a given STM

func (*GoSTMSource) ImplFunctions

func (g *GoSTMSource) ImplFunctions(w *Writer, sttree map[*State][]*GoSTMSource, names map[string]string)

A function to generate template functions

func (*GoSTMSource) ImplFunctionsWithExternal added in v0.4.0

func (g *GoSTMSource) ImplFunctionsWithExternal(w *Writer, sttree map[*State][]*GoSTMSource, names map[string]string)

A function to generate template functions

func (*GoSTMSource) ImplHeader

func (g *GoSTMSource) ImplHeader(w *Writer)

A function to generate the string of header for impl

func (*GoSTMSource) UpdateDefinition added in v0.4.0

func (g *GoSTMSource) UpdateDefinition(w *Writer, sttree map[*State][]*GoSTMSource, names map[string]string)

A function to generate base for a given STM

type MxElement

type MxElement struct {
	Id         string
	Type       string
	Parent     string
	Value      string
	Properties map[string]string
	Geometry   mxGeometry
}

func GetGraphModel

func GetGraphModel(data []byte) ([]MxElement, error)

type State

type State struct {
	Name  string
	Stm   *StateMachine
	Entry string
	Do    string
	Exit  string
}

type StateMachine

type StateMachine struct {
	Parent        string
	States        []*State
	Events        []*Event
	Transitions   []*Transition
	ExTransitions []*Transition
	Initial       *State
}

func NewStateMachine

func NewStateMachine(parent string) *StateMachine

type Transition

type Transition struct {
	Src   *State
	Dest  *State
	Event *Event
}

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

func NewWriter

func NewWriter(out io.Writer) *Writer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL