Debian Codegraph @

dstream/memcopy_gen.go

raw symbols SCIP
1 // GENERATED CODE, DO NOT EDIT
2
3 package dstream
4
5 import (
6 "time"
7 )
8
9 // MemCopy returns a Dstream that copies the provided Dstream into
10 // in-memory storage. Pass reset as true to reset the source
11 // data before copying
12 func MemCopy(data Dstream, reset bool) Dstream {
13
14 nvar := data.NumVar()
15 bdata := make([][]interface{}, nvar)
16
17 if reset {
18 data.Reset()
19 }
20
21 for data.Next() {
22 for j := 0; j < nvar; j++ {
23 var y interface{}
24 v := data.GetPos(j)
25 switch v := v.(type) {
26 case []string:
27 z := make([]string, len(v))
28 copy(z, v)
29 y = z
30 case []time.Time:
31 z := make([]time.Time, len(v))
32 copy(z, v)
33 y = z
34 case []uint8:
35 z := make([]uint8, len(v))
36 copy(z, v)
37 y = z
38 case []uint16:
39 z := make([]uint16, len(v))
40 copy(z, v)
41 y = z
42 case []uint32:
43 z := make([]uint32, len(v))
44 copy(z, v)
45 y = z
46 case []uint64:
47 z := make([]uint64, len(v))
48 copy(z, v)
49 y = z
50 case []int8:
51 z := make([]int8, len(v))
52 copy(z, v)
53 y = z
54 case []int16:
55 z := make([]int16, len(v))
56 copy(z, v)
57 y = z
58 case []int32:
59 z := make([]int32, len(v))
60 copy(z, v)
61 y = z
62 case []int64:
63 z := make([]int64, len(v))
64 copy(z, v)
65 y = z
66 case []float32:
67 z := make([]float32, len(v))
68 copy(z, v)
69 y = z
70 case []float64:
71 z := make([]float64, len(v))
72 copy(z, v)
73 y = z
74 }
75 bdata[j] = append(bdata[j], y)
76 }
77 }
78
79 da := &DataFrame{
80 data: bdata,
81 xform: xform{
82 names: data.Names(),
83 },
84 }
85
86 da.init()
87
88 return da
89 }