util

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2018 License: BSD-3-Clause, BSD-3-Clause Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromBinaryCodedDecimal added in v0.6.0

func FromBinaryCodedDecimal(bcd uint16) (value uint16)

FromBinaryCodedDecimal converts given 4-digit BCD value into an integer.

func ToBinaryCodedDecimal added in v0.6.0

func ToBinaryCodedDecimal(value uint16) (bcd uint16)

ToBinaryCodedDecimal converts given integer value to a 4-digit BCD value.

Types

type ValueUnifier

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

ValueUnifier collects values from several sources. It can be queried whether all sources contained the same value - or return a default value.

func NewValueUnifier

func NewValueUnifier(defaultValue interface{}) *ValueUnifier

NewValueUnifier returns a new instance of a ValueUnifier for given default value.

func (*ValueUnifier) Add

func (unifier *ValueUnifier) Add(value interface{})

Add registers an additional value.

func (*ValueUnifier) Value

func (unifier *ValueUnifier) Value() (result interface{})

Value returns the unified value - or the default value, if either no value was added or the registered values are not equal.

Jump to

Keyboard shortcuts

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