-
Notifications
You must be signed in to change notification settings - Fork 1
/
hostid.go
86 lines (69 loc) · 1.91 KB
/
hostid.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package id
//
// DO NOT EDIT. This file was machine genarted by boilerplateid for HostId
//
import (
protosupport "github.com/iansmith/parigot/g/protosupport/v1"
)
//
// Begin Boilerplate for Host
//
type DefHost struct{}
func (f DefHost) ShortString() string { return "host" }
func (f DefHost) Letter() byte { return 0x68 }
type HostId IdRoot[DefHost]
func NewHostId() HostId {
return HostId(NewIdRoot[DefHost]())
}
func (f HostId) Marshal() *protosupport.IdRaw {
raw:=&protosupport.IdRaw{}
raw.High = f.High()
raw.Low = f.Low()
return raw
}
func HostIdZeroValue() HostId {
return HostId(NewIdTyped[DefHost](0xffffffffffffff,0xffffffffffffffff))
}
func HostIdEmptyValue() HostId {
return HostId(NewIdTyped[DefHost](0,0))
}
func (f HostId) Equal(other HostId) bool{
return IdRoot[DefHost](f).Equal(IdRoot[DefHost](other))
}
func (f HostId) String() string{
return IdRoot[DefHost](f).String()
}
func (f HostId) Short() string{
return IdRoot[DefHost](f).Short()
}
func (f HostId) IsZeroValue() bool{
return IdRoot[DefHost](f).IsZeroValue()
}
func (f HostId) IsEmptyValue() bool{
return IdRoot[DefHost](f).IsEmptyValue()
}
func (f HostId) IsZeroOrEmptyValue() bool{
return IdRoot[DefHost](f).IsZeroOrEmptyValue()
}
func (f HostId) High() uint64{
return IdRoot[DefHost](f).High()
}
func (f HostId) Low() uint64{
return IdRoot[DefHost](f).Low()
}
func UnmarshalHostId(b *protosupport.IdRaw) HostId {
l:=b.GetLow()
h:=b.GetHigh()
return HostId(NewIdTyped[DefHost](h,l))
}
// FromPair is probably not something you want to use unless you
// are pulling values from external storage or files. If you pulling
// values from the network, use the Marshal() ad Unmarshal()
// functions to work with Ids. Absolutely no checking is done
// on the values provided, so much caution is advised.
func HostIdFromPair(high, low uint64) HostId {
return HostId(NewIdTyped[DefHost](high,low))
}
//
// End Boilerplate for Host
//