tickingping

package
v4.0.0-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Example
engine := sim.NewSerialEngine()
agentA := MakeBuilder().
	WithEngine(engine).
	WithFreq(1 * sim.Hz).
	Build("AgentA")
agentB := MakeBuilder().
	WithEngine(engine).
	WithFreq(1 * sim.Hz).
	Build("AgentB")
conn := directconnection.
	MakeBuilder().
	WithEngine(engine).
	WithFreq(1 * sim.GHz).
	Build("Conn")

conn.PlugIn(agentA.OutPort, 1)
conn.PlugIn(agentB.OutPort, 1)

agentA.pingDst = agentB.OutPort
agentA.numPingNeedToSend = 2

agentA.TickLater()

err := engine.Run()
if err != nil {
	panic(err)
}
Output:

Ping 0, 5.00
Ping 1, 5.00

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

func MakeBuilder

func MakeBuilder() Builder

func (Builder) Build

func (b Builder) Build(name string) *Comp

func (Builder) WithEngine

func (b Builder) WithEngine(engine sim.Engine) Builder

func (Builder) WithFreq

func (b Builder) WithFreq(freq sim.Freq) Builder

type Comp

type Comp struct {
	*sim.TickingComponent
	sim.MiddlewareHolder

	OutPort sim.Port
	// contains filtered or unexported fields
}

func (*Comp) Tick

func (c *Comp) Tick() bool

type PingReq

type PingReq struct {
	sim.MsgMeta

	SeqID int
}

func (*PingReq) Clone

func (p *PingReq) Clone() sim.Msg

func (*PingReq) Meta

func (p *PingReq) Meta() *sim.MsgMeta

type PingRsp

type PingRsp struct {
	sim.MsgMeta

	RspTo string
	SeqID int
}

func (*PingRsp) Clone

func (p *PingRsp) Clone() sim.Msg

func (*PingRsp) GenerateRsp

func (p *PingRsp) GenerateRsp() sim.Rsp

func (*PingRsp) GetRspTo

func (p *PingRsp) GetRspTo() string

func (*PingRsp) Meta

func (p *PingRsp) Meta() *sim.MsgMeta

Jump to

Keyboard shortcuts

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