io

package
v0.0.0-...-76daeef Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FunctionalSensor

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

A FunctionalSensor produces phenomenal experience as direct sensory observations. A FunctionalSensor component processes incoming raw-data into distributed signals that the system can begin to work with. Unlike other evocation a FunctionalSensor component doesn't have any QualitativeSignal inputs, instead Sensors produces a QualitativeSignal based on the output of an externally implemented function. This function can be set using SetProcessor and should be set before any calls to Evoke. Otherwise, Evoke will return an empty signal.

func NewFunctionalSensor

func NewFunctionalSensor(name string, processor func() gracious.QualitativeSignal) *FunctionalSensor

NewFunctionalSensor creates a new FunctionalSensor

func (*FunctionalSensor) Evoke

Evoke returns the result of the specified processor function. If no processor is defined, then an empty slice of QualitativeSignal values will be returned.

func (*FunctionalSensor) GetId

func (n *FunctionalSensor) GetId() string

GetId returns the id of this Sensor

func (*FunctionalSensor) SetProcessor

func (n *FunctionalSensor) SetProcessor(processor func() gracious.QualitativeSignal)

SetProcessor sets the function that should be run when this FunctionalSensor component is evoked.

type JsonSignal

type JsonSignal struct {
	Id       string        `json:"id"`
	Features []jsonFeature `json:"features"`
}

JsonSignal represents a specific QualitativeSignal encoded in Json.

func JsonFromDistributedSignal

func JsonFromDistributedSignal(signal gracious.QualitativeSignal) JsonSignal

JsonFromDistributedSignal formats a base.QualitativeSignal into a JsonSignal

func (JsonSignal) ToDistributedSignal

func (js JsonSignal) ToDistributedSignal() gracious.QualitativeSignal

ToDistributedSignal converts a JsonSignal into a QualitativeSignal

type JsonSignalArray

type JsonSignalArray struct {
	Id      string       `json:"id"`
	Signals []JsonSignal `json:"signals"`
}

JsonSignalArray encodes for a sequence (or set) of JsonSignal values. A JsonSignalArray can be directly converted to a slice of base.QualitativeSignal values via ToDistributedSignals. A JsonSignalArray can also be constructed from a slice of QualitativeSignal values. This allows for communication of sequences across the network via Json encoding.

func JsonFromDistributedSignals

func JsonFromDistributedSignals(signals []gracious.QualitativeSignal) JsonSignalArray

JsonFromDistributedSignals takes a slice of base.QualitativeSignal values and formats them into JsonSignalArray.

func JsonFromFileName

func JsonFromFileName(filename string) JsonSignalArray

func (*JsonSignalArray) GetJsonSignalById

func (jsa *JsonSignalArray) GetJsonSignalById(id string) JsonSignal

GetJsonSignalById returns a JsonSignal from the array that matches the id. If there is no JsonSignal that matches, an empty JsonSignal will be returned.

func (*JsonSignalArray) ToDistributedSignals

func (jsa *JsonSignalArray) ToDistributedSignals() []gracious.QualitativeSignal

ToDistributedSignals converts a JsonSignalArray into a slice of base.QualitativeSignal values

type Sensor

type Sensor interface {
	GetId() string
	Evoke() gracious.QualitativeSignal
}

A Sensor is any structure which can produce a slice of base.QualitativeSignal values. The Sensor interface is implemented by the FunctionalSensor

type Translation

type Translation interface {
	ToDistributedSignals() []gracious.QualitativeSignal
}

Translation offers an interface for creating structures capable of conversion into QualitativeSignal values. By default, Json encoding is included via JsonSignalArray and JsonSignal.

Jump to

Keyboard shortcuts

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