common

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Common defines a series of data types and functions used through the nds meta data server

Index

Constants

View Source
const (
	DataTypeUnknown   = 0xff
	DataTypeInt16     = 0x1
	DataTypeInt32     = 0x2
	DataTypeInt64     = 0x4
	DataTypeFloat32   = 0x8
	DataTypeFloat64   = 0x10
	DataTypeComplex32 = 0x20
	DataTypeUint32    = 0x40
)
View Source
const (
	ClassTypeUnknown = 0xff
	ClassTypeOnline  = 0x01
	ClassTypeRaw     = 0x02
	ClassTypeReduced = 0x04
	ClassTypeSTrend  = 0x08
	ClassTypeMTrend  = 0x10
	ClassTypeTestPt  = 0x20
	ClassTypeStatic  = 0x40
)
View Source
const UnassignedAuid = 0

Variables

This section is empty.

Functions

func FilterOutEmpty

func FilterOutEmpty(sequence []string) []string

func FindFramesUnderPath

func FindFramesUnderPath(path string) map[string][]FrameInfo

func FindRange

func FindRange(n int, lowerBoundPred RangePredicate, upperBoundPred RangePredicate) (int, int)

Find the indexes for a sub-range that is bounded by lowerBoundPred an upperBoundPred

n is the total number of elements in the range The lower bound of the returned indexes is the first entry where lowerBoundPred(i) == true The upper bound of the returned indexes is the first entry where upperBoundPred(i) == true

This is implemented as calls to sort.Search with controlled ranges of entries.

It may be helpful to think of identifying a range by passing in a gte(x) as a lower bound, to identify the first entry >= x, and gt(x) to identify the end of the sequence.

func LocalFrameServerUri

func LocalFrameServerUri(root string) string

func MaxInt

func MaxInt(a int, b int) int

func MaxInt32

func MaxInt32(a int32, b int32) int32

func MaxInt64

func MaxInt64(a int64, b int64) int64

func MinInt

func MinInt(a int, b int) int

func MinInt32

func MinInt32(a int32, b int32) int32

func MinInt64

func MinInt64(a int64, b int64) int64

func ProcessStreamWithComments

func ProcessStreamWithComments(reader io.Reader, callback ProcessStreamHandler)

func RegisterFrameServer

func RegisterFrameServer(name string, generator func(string) (FrameServer, error))

func TimeSpanAsRangeString

func TimeSpanAsRangeString(ts TimeSpan) string

func TimeSpansOverlap

func TimeSpansOverlap(t1 TimeSpan, t2 TimeSpan) bool

Check to see if t1 overlaps t2 at all

Types

type AUID

type AUID = uint64

type BasicChannel

type BasicChannel struct {
	Name  string    `json:"n"`
	Type  DataType  `json:"dt"`
	Class ClassType `json:"ct"`
	Rate  float64   `json:"r"`
}

A basic channel structure

type ClassType

type ClassType struct {
	Type byte
}

func CreateClassType

func CreateClassType(val byte) ClassType

func (ClassType) CompatibleWith

func (ct ClassType) CompatibleWith(other ClassType) bool

func (ClassType) MarshalJSON

func (ct ClassType) MarshalJSON() ([]byte, error)

func (*ClassType) Set

func (ct *ClassType) Set(val byte)

func (*ClassType) SetString

func (ct *ClassType) SetString(val string)

func (ClassType) String

func (ct ClassType) String() string

func (*ClassType) UnmarshalJSON

func (ct *ClassType) UnmarshalJSON(data []byte) error

type DataType

type DataType struct {
	Type byte
}

func CreateDataType

func CreateDataType(val byte) DataType

func (DataType) CompatibleWith

func (dt DataType) CompatibleWith(other DataType) bool

func (DataType) MarshalJSON

func (dt DataType) MarshalJSON() ([]byte, error)

func (*DataType) Set

func (dt *DataType) Set(val byte)

func (*DataType) SetString

func (dt *DataType) SetString(val string)

func (DataType) String

func (dt DataType) String() string

func (*DataType) UnmarshalJSON

func (dt *DataType) UnmarshalJSON(data []byte) error

type FrameInfo

type FrameInfo struct {
	Name, Path string
	FrameType  string
	TimeSpan   TimeSpan
	FTime      time.Time
}

type FrameServer

type FrameServer interface {
	FrameIntervals(frameType string, timeSpan TimeSpan) ([]TimeSpan, error)
	FrameFilePaths(frameType string, timeSpan TimeSpan) ([]string, error)
	ConnectionString() string
}

func GetFrameServer

func GetFrameServer(name string) (FrameServer, error)

func NewNullFrameServer

func NewNullFrameServer() FrameServer

type GpsSecond

type GpsSecond = int64
const GpsInf GpsSecond = 1999999999

type LocalFrameServer

type LocalFrameServer struct {
	Root string
	// contains filtered or unexported fields
}

func NewLocalFrameServer

func NewLocalFrameServer(path string) *LocalFrameServer

func (*LocalFrameServer) ConnectionString

func (lf *LocalFrameServer) ConnectionString() string

func (*LocalFrameServer) FrameFilePaths

func (lf *LocalFrameServer) FrameFilePaths(frameType string, timeSpan TimeSpan) ([]string, error)

func (*LocalFrameServer) FrameIntervals

func (lf *LocalFrameServer) FrameIntervals(frameType string, timeSpan TimeSpan) ([]TimeSpan, error)

type ProcessStreamHandler

type ProcessStreamHandler func(string)

type RangePredicate

type RangePredicate func(int) bool

type TimeSpan

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

func CombineTimeSpans

func CombineTimeSpans(t1 TimeSpan, t2 TimeSpan) TimeSpan

Return a timespan that is the combination of t1 + t2 the largest span possible taking the given endpoints.

func ConstrainTimeSpans

func ConstrainTimeSpans(t1 TimeSpan, t2 TimeSpan) TimeSpan

Return a TimeSpan that is the intersection of t1, t2 ie the overlapping portions

Undefined if t1 and t2 do not overlap

func CreateTimeSpan

func CreateTimeSpan(start GpsSecond, end GpsSecond) TimeSpan

func (TimeSpan) Contains

func (ts TimeSpan) Contains(second GpsSecond) bool

func (TimeSpan) End

func (ts TimeSpan) End() GpsSecond

func (*TimeSpan) Extend

func (ts *TimeSpan) Extend(new_end GpsSecond) GpsSecond

func (TimeSpan) MarshalJSON

func (ts TimeSpan) MarshalJSON() ([]byte, error)

func (TimeSpan) Start

func (ts TimeSpan) Start() GpsSecond

func (*TimeSpan) UnmarshalJSON

func (ts *TimeSpan) UnmarshalJSON(data []byte) error

func (TimeSpan) WideOpen

func (ts TimeSpan) WideOpen() bool

Jump to

Keyboard shortcuts

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