collections

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Align

func Align(x int64, a int64) int64

Align returns the smallest y >= x such that y % a == 0. note: copied from `go/types/sizes.go`

func CopyField

func CopyField(f gopium.Field) gopium.Field

CopyField defines helper that deep copies provided field

func CopyStruct

func CopyStruct(s gopium.Struct) gopium.Struct

CopyStruct defines helper that deep copies provided struct

func PadField

func PadField(pad int64) gopium.Field

PadField defines helper that creates pad field with specified size

func SizeAlign

func SizeAlign(st gopium.Struct) (int64, int64)

SizeAlign calculates sturct aligned size and size by using walk struct helper

func WalkStruct

func WalkStruct(st gopium.Struct, sysalign int64, onpad OnPadFields)

WalkStruct iterates over structure fields with optional system align and calls on pad fields callback for all pads and fields

Types

type Boundaries

type Boundaries []Boundary

Boundaries defines ordered set of boundary

func (Boundaries) Inside

func (bs Boundaries) Inside(p token.Pos) bool

Inside checks if pos inside boundaries by using binary search to check boundaries

type Boundary

type Boundary struct {
	First token.Pos `gopium:"filter_pads,memory_pack,cache_rounding_cpu_l1_discrete,struct_annotate_comment,add_tag_group_force"`
	Last  token.Pos `gopium:"filter_pads,memory_pack,cache_rounding_cpu_l1_discrete,struct_annotate_comment,add_tag_group_force"`

} // struct size: 16 bytes; struct align: 8 bytes; struct aligned size: 16 bytes; - 🌺 gopium @1pkg

Boundary defines sorted pos pair type

func (Boundary) Greater

func (b Boundary) Greater(p token.Pos) bool

Greater checks if pos strictly greater then boundary

func (Boundary) Inside

func (b Boundary) Inside(p token.Pos) bool

Inside checks if pos inside boundary

func (Boundary) Less

func (b Boundary) Less(p token.Pos) bool

Less checks if pos strictly less then boundary

type Flat

type Flat map[string]gopium.Struct

Flat defines strucs flat collection which is categorized only by id

func (Flat) Sorted

func (f Flat) Sorted() []gopium.Struct

Sorted converts flat collection to sorted slice of structs note: it's possible due to next: generated ids are ordered inside same loc

type Hierarchic

type Hierarchic struct {
	// contains filtered or unexported fields

} // struct size: 32 bytes; struct align: 8 bytes; struct aligned size: 32 bytes; - 🌺 gopium @1pkg

Hierarchic defines strucs hierarchic collection which is categorized by pair of loc and id

func NewHierarchic

func NewHierarchic(rcat string) Hierarchic

NewHierarchic creates new hierarchic collection with root category

func (Hierarchic) Cat

func (h Hierarchic) Cat(cat string) (map[string]gopium.Struct, bool)

Cat returns hierarchic categoty flat collection if any exists

func (Hierarchic) Catflat

func (h Hierarchic) Catflat(cat string) (Flat, bool)

Catflat returns hierarchic categoty flat collection if any exists

func (Hierarchic) Flat

func (h Hierarchic) Flat() Flat

Flat converts hierarchic collection to flat collection

func (Hierarchic) Full

func (h Hierarchic) Full() map[string]gopium.Struct

Full converts hierarchic collection to flat collection

func (Hierarchic) Len

func (h Hierarchic) Len() int

Len calculates total len of hierarchic collection

func (Hierarchic) Push

func (h Hierarchic) Push(key string, cat string, sts ...gopium.Struct)

Push adds struct to hierarchic collection

func (Hierarchic) Rcat

func (h Hierarchic) Rcat() string

Rcat finds root category that all other category contain for collection

type OnPadFields

type OnPadFields func(int64, ...gopium.Field)

OnPadFields defines pad fields callback that accepts pad and optional list of following structure fields

type Reference

type Reference struct {
	// contains filtered or unexported fields

} // struct size: 32 bytes; struct align: 8 bytes; struct aligned size: 32 bytes; - 🌺 gopium @1pkg

Reference defines backreference helper that helps to set, and get wait for key value pairs

func NewReference

func NewReference(actual bool) *Reference

NewReference creates reference instance accordingly to passed nil flag

func (*Reference) Alloc

func (r *Reference) Alloc(key string)

Alloc preallocates slot in the reference for the given key

func (*Reference) Get

func (r *Reference) Get(key string) interface{}

Get retrieves value for given key from the reference, in case value hasn't been set yet it waits until value is set

func (*Reference) Prune

func (r *Reference) Prune()

Prune releases all value waiters

func (*Reference) Set

func (r *Reference) Set(key string, val interface{})

Set update value for given key, if slot for that value has been preallocated

Jump to

Keyboard shortcuts

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