-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpacking_context_node.go
43 lines (34 loc) · 1.24 KB
/
packing_context_node.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
package zserio
type IDeltaContext interface {
ReadDescriptor(r Reader) error
WriteDescriptor(w Writer) error
BitSizeOfDescriptor() int
}
// PackingContextNode is a context for writing packed data.
type PackingContextNode struct {
children []*PackingContextNode
// the delta context used in a packed context.
Context IDeltaContext
}
// AddChild adds a new child to a PackingContextNode.
func (context *PackingContextNode) AddChild(child *PackingContextNode) {
context.children = append(context.children, child)
}
// GetChildren returns the child PackingContextNodes of a PackingContextNode.
func (context *PackingContextNode) GetChildren() []*PackingContextNode {
return context.children
}
// HasContext reurns true if the packing context has a delta context.
func (context *PackingContextNode) HasContext() bool {
return (context.Context != nil)
}
// ReadDescriptor returns the delta context of the packing context.
func (context *PackingContextNode) ReadDescriptor(r Reader) error {
return context.Context.ReadDescriptor(r)
}
func (context *PackingContextNode) WriteDescriptor(w Writer) error {
return context.Context.WriteDescriptor(w)
}
func (context *PackingContextNode) BitSizeOfDescriptor() int {
return context.Context.BitSizeOfDescriptor()
}