tacview

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: MIT Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Header struct {
	FileType         string
	FileVersion      string
	ReferenceTime    time.Time
	InitialTimeFrame TimeFrame
}

Header describes a ACMI file header

func (*Header) Write

func (h *Header) Write(writer *bufio.Writer) error

type Object

type Object struct {
	Id         uint64
	Properties []*Property
	Deleted    bool
}

Object describes an ACMI object

func (*Object) Get

func (o *Object) Get(key string) *Property

Get returns a property (if one exists) for a given key

func (*Object) Set

func (o *Object) Set(key string, value string)

Set updates the given property

func (*Object) Write

func (o *Object) Write(writer *bufio.Writer) error

type Property

type Property struct {
	Key   string
	Value string
}

Property represents an object property

type Reader

type Reader struct {
	Header Header
	// contains filtered or unexported fields
}

Reader provides an interface for reading an ACMI file

func NewReader

func NewReader(reader io.Reader) (*Reader, error)

NewReader creates a new ACMI reader

func (*Reader) ProcessTimeFrames

func (r *Reader) ProcessTimeFrames(concurrency int, timeFrame chan<- *TimeFrame) error

ProcessTimeFrames concurrently processes time frames from within the ACMI file,

producing them to an output channel. If your use case requires strong ordering
and you do not wish to implement this guarantee on the consumer side, you must
set the concurrency to 1.

type TimeFrame

type TimeFrame struct {
	Offset  float64
	Objects []*Object
}

TimeFrame represents a single time frame from an ACMI file

func NewTimeFrame

func NewTimeFrame() *TimeFrame

NewTimeFrame creates an empty TimeFrame

func (*TimeFrame) Delete added in v0.0.3

func (tf *TimeFrame) Delete(id uint64)

Delete removes an object (if one exists) for a given object id

func (*TimeFrame) Get

func (tf *TimeFrame) Get(id uint64) *Object

Get returns an object (if one exists) for a given object id

func (*TimeFrame) Write

func (tf *TimeFrame) Write(writer *bufio.Writer, includeOffset bool) error

type Writer

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

Writer provides an interface for writing an ACMI file

func NewWriter

func NewWriter(writer io.WriteCloser, header *Header) (*Writer, error)

NewWriter creates a new ACMI writer

func (*Writer) Close

func (w *Writer) Close() error

Close closes the writer, flushing any remaining contents

func (*Writer) WriteTimeFrame

func (w *Writer) WriteTimeFrame(tf *TimeFrame) error

WriteTimeFrame writes a time frame

Jump to

Keyboard shortcuts

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