actions

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEval added in v0.6.0

func NewEval() *eval

Types

type ActionEntry added in v0.6.0

type ActionEntry map[string]core.KWArgs

ActionEntry represents an action in an operation or sequence.

type ActionHandler added in v0.6.0

type ActionHandler func(symbol string, args core.KWArgs, ctx core.KWArgs) (any, error)

type ActionListEntry added in v0.6.0

type ActionListEntry struct {
	Name        string        `json:"name" yaml:"name"`
	Description string        `json:"description" yaml:"description"`
	Actions     []ActionEntry `json:"actions" yaml:"actions"`
}

ActionListEntry represents a list of actions

type Engine

type Engine struct {
	core.Notifier
	// contains filtered or unexported fields
}

func NewEngine added in v0.6.0

func NewEngine() *Engine

func (*Engine) GetInterface added in v0.6.0

func (e *Engine) GetInterface(ifaceId string) *InterfaceEntry

func (*Engine) GetProperties added in v0.6.0

func (e *Engine) GetProperties(symbol string) (core.KWArgs, error)

FetchProperties returns a copy of the properties of the interface.

func (*Engine) HasInterface added in v0.6.0

func (e *Engine) HasInterface(ifaceId string) bool

func (*Engine) HasSequence added in v0.6.0

func (e *Engine) HasSequence(sequencerId string) bool

func (*Engine) InvokeOperation added in v0.6.0

func (e *Engine) InvokeOperation(symbol string, name string, args core.KWArgs) (any, error)

InvokeOperation invokes a operation of the interface.

func (*Engine) LoadScenario added in v0.6.0

func (e *Engine) LoadScenario(doc *ScenarioDoc) error

func (*Engine) PlaySequence added in v0.6.0

func (e *Engine) PlaySequence(sequencerId string)

func (*Engine) SetProperties added in v0.6.0

func (e *Engine) SetProperties(symbol string, props core.KWArgs) error

SetProperties sets the properties of the interface.

type InterfaceEntry added in v0.6.0

type InterfaceEntry struct {
	Name        string             `json:"name" yaml:"name"`
	Description string             `json:"description" yaml:"description"`
	Properties  map[string]any     `json:"properties" yaml:"properties"`
	Operations  []*ActionListEntry `json:"operations" yaml:"operations"`
}

InterfaceEntry represents an interface in a scenario.

func (InterfaceEntry) GetOperation added in v0.6.0

func (e InterfaceEntry) GetOperation(name string) *ActionListEntry

GetOperation returns the operation entry with the given name.

type ScenarioDoc added in v0.6.0

type ScenarioDoc struct {
	Schema      string            `json:"schema" yaml:"schema"`
	Name        string            `json:"name" yaml:"name"`
	Description string            `json:"description" yaml:"description"`
	Version     string            `json:"version" yaml:"version"`
	Interfaces  []*InterfaceEntry `json:"interfaces" yaml:"interfaces"`
	Sequences   []*SequenceEntry  `json:"sequences" yaml:"sequences"`
}

ScenarioDoc is a scenario document as part of a simulation.

func ReadScenario added in v0.6.0

func ReadScenario(fn string) (*ScenarioDoc, error)

ReadScenario reads a scenario from file.

func (*ScenarioDoc) GetInterface added in v0.6.0

func (s *ScenarioDoc) GetInterface(name string) *InterfaceEntry

GetInterface returns the interface entry with the given name.

func (*ScenarioDoc) GetSequence added in v0.6.0

func (s *ScenarioDoc) GetSequence(name string) *SequenceEntry

GetSequence returns the sequence entry with the given name.

type SequenceEntry added in v0.6.0

type SequenceEntry struct {
	Name             string             `json:"name" yaml:"name"`
	DefaultInterface string             `json:"interface" yaml:"interface"`
	Description      string             `json:"description" yaml:"description"`
	Interval         int                `json:"interval" yaml:"interval"`
	Repeat           int                `json:"repeat" yaml:"repeat"`
	Steps            []*ActionListEntry `json:"steps" yaml:"steps"`
}

SequenceEntry represents a sequence in a scenario.

Jump to

Keyboard shortcuts

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