Debian Codegraph @

dstream/convert_gen.go

raw symbols SCIP
1 // GENERATED CODE, DO NOT EDIT
2
3 package dstream
4
5 import (
6 "fmt"
7 )
8
9 func (c *convert) Next() bool {
10
11 if !c.source.Next() {
12 return false
13 }
14
15 // The non-converted variables are just pointer assignments.
16 for j := 0; j < c.source.NumVar(); j++ {
17 if j != c.vpos {
18 c.bdata[j] = c.source.GetPos(j)
19 }
20 }
21
22 // Initialize the backing array if needed
23 to := c.bdata[c.vpos]
24 if to == nil {
25 switch c.dtype {
26 case Uint8:
27 to = make([]uint8, 0, 100)
28 case Uint16:
29 to = make([]uint16, 0, 100)
30 case Uint32:
31 to = make([]uint32, 0, 100)
32 case Uint64:
33 to = make([]uint64, 0, 100)
34 case Int8:
35 to = make([]int8, 0, 100)
36 case Int16:
37 to = make([]int16, 0, 100)
38 case Int32:
39 to = make([]int32, 0, 100)
40 case Int64:
41 to = make([]int64, 0, 100)
42 case Float32:
43 to = make([]float32, 0, 100)
44 case Float64:
45 to = make([]float64, 0, 100)
46 default:
47 msg := fmt.Sprintf("Convert: unknown type %v\n", c.dtype)
48 panic(msg)
49 }
50 }
51
52 // Need this to do nested switches.
53
54 // Unconverted data
55 from := c.source.GetPos(c.vpos)
56
57 switch to := to.(type) {
58 case []uint8:
59 switch from := from.(type) {
60 case []uint8:
61 // Same types, nothing to do
62 c.bdata[c.vpos] = from
63 case []uint16:
64 to = to[0:0]
65 for _, x := range from {
66 to = append(to, uint8(x))
67 }
68 c.bdata[c.vpos] = to
69 case []uint32:
70 to = to[0:0]
71 for _, x := range from {
72 to = append(to, uint8(x))
73 }
74 c.bdata[c.vpos] = to
75 case []uint64:
76 to = to[0:0]
77 for _, x := range from {
78 to = append(to, uint8(x))
79 }
80 c.bdata[c.vpos] = to
81 case []int8:
82 to = to[0:0]
83 for _, x := range from {
84 to = append(to, uint8(x))
85 }
86 c.bdata[c.vpos] = to
87 case []int16:
88 to = to[0:0]
89 for _, x := range from {
90 to = append(to, uint8(x))
91 }
92 c.bdata[c.vpos] = to
93 case []int32:
94 to = to[0:0]
95 for _, x := range from {
96 to = append(to, uint8(x))
97 }
98 c.bdata[c.vpos] = to
99 case []int64:
100 to = to[0:0]
101 for _, x := range from {
102 to = append(to, uint8(x))
103 }
104 c.bdata[c.vpos] = to
105 case []float32:
106 to = to[0:0]
107 for _, x := range from {
108 to = append(to, uint8(x))
109 }
110 c.bdata[c.vpos] = to
111 case []float64:
112 to = to[0:0]
113 for _, x := range from {
114 to = append(to, uint8(x))
115 }
116 c.bdata[c.vpos] = to
117 default:
118 msg := fmt.Sprintf("Convert: unknown origin type %T\n", from)
119 panic(msg)
120 }
121 case []uint16:
122 switch from := from.(type) {
123 case []uint8:
124 to = to[0:0]
125 for _, x := range from {
126 to = append(to, uint16(x))
127 }
128 c.bdata[c.vpos] = to
129 case []uint16:
130 // Same types, nothing to do
131 c.bdata[c.vpos] = from
132 case []uint32:
133 to = to[0:0]
134 for _, x := range from {
135 to = append(to, uint16(x))
136 }
137 c.bdata[c.vpos] = to
138 case []uint64:
139 to = to[0:0]
140 for _, x := range from {
141 to = append(to, uint16(x))
142 }
143 c.bdata[c.vpos] = to
144 case []int8:
145 to = to[0:0]
146 for _, x := range from {
147 to = append(to, uint16(x))
148 }
149 c.bdata[c.vpos] = to
150 case []int16:
151 to = to[0:0]
152 for _, x := range from {
153 to = append(to, uint16(x))
154 }
155 c.bdata[c.vpos] = to
156 case []int32:
157 to = to[0:0]
158 for _, x := range from {
159 to = append(to, uint16(x))
160 }
161 c.bdata[c.vpos] = to
162 case []int64:
163 to = to[0:0]
164 for _, x := range from {
165 to = append(to, uint16(x))
166 }
167 c.bdata[c.vpos] = to
168 case []float32:
169 to = to[0:0]
170 for _, x := range from {
171 to = append(to, uint16(x))
172 }
173 c.bdata[c.vpos] = to
174 case []float64:
175 to = to[0:0]
176 for _, x := range from {
177 to = append(to, uint16(x))
178 }
179 c.bdata[c.vpos] = to
180 default:
181 msg := fmt.Sprintf("Convert: unknown origin type %T\n", from)
182 panic(msg)
183 }
184 case []uint32:
185 switch from := from.(type) {
186 case []uint8:
187 to = to[0:0]
188 for _, x := range from {
189 to = append(to, uint32(x))
190 }
191 c.bdata[c.vpos] = to
192 case []uint16:
193 to = to[0:0]
194 for _, x := range from {
195 to = append(to, uint32(x))
196 }
197 c.bdata[c.vpos] = to
198 case []uint32:
199 // Same types, nothing to do
200 c.bdata[c.vpos] = from
201 case []uint64:
202 to = to[0:0]
203 for _, x := range from {
204 to = append(to, uint32(x))
205 }
206 c.bdata[c.vpos] = to
207 case []int8:
208 to = to[0:0]
209 for _, x := range from {
210 to = append(to, uint32(x))
211 }
212 c.bdata[c.vpos] = to
213 case []int16:
214 to = to[0:0]
215 for _, x := range from {
216 to = append(to, uint32(x))
217 }
218 c.bdata[c.vpos] = to
219 case []int32:
220 to = to[0:0]
221 for _, x := range from {
222 to = append(to, uint32(x))
223 }
224 c.bdata[c.vpos] = to
225 case []int64:
226 to = to[0:0]
227 for _, x := range from {
228 to = append(to, uint32(x))
229 }
230 c.bdata[c.vpos] = to
231 case []float32:
232 to = to[0:0]
233 for _, x := range from {
234 to = append(to, uint32(x))
235 }
236 c.bdata[c.vpos] = to
237 case []float64:
238 to = to[0:0]
239 for _, x := range from {
240 to = append(to, uint32(x))
241 }
242 c.bdata[c.vpos] = to
243 default:
244 msg := fmt.Sprintf("Convert: unknown origin type %T\n", from)
245 panic(msg)
246 }
247 case []uint64:
248 switch from := from.(type) {
249 case []uint8:
250 to = to[0:0]
251 for _, x := range from {
252 to = append(to, uint64(x))
253 }
254 c.bdata[c.vpos] = to
255 case []uint16:
256 to = to[0:0]
257 for _, x := range from {
258 to = append(to, uint64(x))
259 }
260 c.bdata[c.vpos] = to
261 case []uint32:
262 to = to[0:0]
263 for _, x := range from {
264 to = append(to, uint64(x))
265 }
266 c.bdata[c.vpos] = to
267 case []uint64:
268 // Same types, nothing to do
269 c.bdata[c.vpos] = from
270 case []int8:
271 to = to[0:0]
272 for _, x := range from {
273 to = append(to, uint64(x))
274 }
275 c.bdata[c.vpos] = to
276 case []int16:
277 to = to[0:0]
278 for _, x := range from {
279 to = append(to, uint64(x))
280 }
281 c.bdata[c.vpos] = to
282 case []int32:
283 to = to[0:0]
284 for _, x := range from {
285 to = append(to, uint64(x))
286 }
287 c.bdata[c.vpos] = to
288 case []int64:
289 to = to[0:0]
290 for _, x := range from {
291 to = append(to, uint64(x))
292 }
293 c.bdata[c.vpos] = to
294 case []float32:
295 to = to[0:0]
296 for _, x := range from {
297 to = append(to, uint64(x))
298 }
299 c.bdata[c.vpos] = to
300 case []float64:
301 to = to[0:0]
302 for _, x := range from {
303 to = append(to, uint64(x))
304 }
305 c.bdata[c.vpos] = to
306 default:
307 msg := fmt.Sprintf("Convert: unknown origin type %T\n", from)
308 panic(msg)
309 }
310 case []int8:
311 switch from := from.(type) {
312 case []uint8:
313 to = to[0:0]
314 for _, x := range from {
315 to = append(to, int8(x))
316 }
317 c.bdata[c.vpos] = to
318 case []uint16:
319 to = to[0:0]
320 for _, x := range from {
321 to = append(to, int8(x))
322 }
323 c.bdata[c.vpos] = to
324 case []uint32:
325 to = to[0:0]
326 for _, x := range from {
327 to = append(to, int8(x))
328 }
329 c.bdata[c.vpos] = to
330 case []uint64:
331 to = to[0:0]
332 for _, x := range from {
333 to = append(to, int8(x))
334 }
335 c.bdata[c.vpos] = to
336 case []int8:
337 // Same types, nothing to do
338 c.bdata[c.vpos] = from
339 case []int16:
340 to = to[0:0]
341 for _, x := range from {
342 to = append(to, int8(x))
343 }
344 c.bdata[c.vpos] = to
345 case []int32:
346 to = to[0:0]
347 for _, x := range from {
348 to = append(to, int8(x))
349 }
350 c.bdata[c.vpos] = to
351 case []int64:
352 to = to[0:0]
353 for _, x := range from {
354 to = append(to, int8(x))
355 }
356 c.bdata[c.vpos] = to
357 case []float32:
358 to = to[0:0]
359 for _, x := range from {
360 to = append(to, int8(x))
361 }
362 c.bdata[c.vpos] = to
363 case []float64:
364 to = to[0:0]
365 for _, x := range from {
366 to = append(to, int8(x))
367 }
368 c.bdata[c.vpos] = to
369 default:
370 msg := fmt.Sprintf("Convert: unknown origin type %T\n", from)
371 panic(msg)
372 }
373 case []int16:
374 switch from := from.(type) {
375 case []uint8:
376 to = to[0:0]
377 for _, x := range from {
378 to = append(to, int16(x))
379 }
380 c.bdata[c.vpos] = to
381 case []uint16:
382 to = to[0:0]
383 for _, x := range from {
384 to = append(to, int16(x))
385 }
386 c.bdata[c.vpos] = to
387 case []uint32:
388 to = to[0:0]
389 for _, x := range from {
390 to = append(to, int16(x))
391 }
392 c.bdata[c.vpos] = to
393 case []uint64:
394 to = to[0:0]
395 for _, x := range from {
396 to = append(to, int16(x))
397 }
398 c.bdata[c.vpos] = to
399 case []int8:
400 to = to[0:0]
401 for _, x := range from {
402 to = append(to, int16(x))
403 }
404 c.bdata[c.vpos] = to
405 case []int16:
406 // Same types, nothing to do
407 c.bdata[c.vpos] = from
408 case []int32:
409 to = to[0:0]
410 for _, x := range from {
411 to = append(to, int16(x))
412 }
413 c.bdata[c.vpos] = to
414 case []int64:
415 to = to[0:0]
416 for _, x := range from {
417 to = append(to, int16(x))
418 }
419 c.bdata[c.vpos] = to
420 case []float32:
421 to = to[0:0]
422 for _, x := range from {
423 to = append(to, int16(x))
424 }
425 c.bdata[c.vpos] = to
426 case []float64:
427 to = to[0:0]
428 for _, x := range from {
429 to = append(to, int16(x))
430 }
431 c.bdata[c.vpos] = to
432 default:
433 msg := fmt.Sprintf("Convert: unknown origin type %T\n", from)
434 panic(msg)
435 }
436 case []int32:
437 switch from := from.(type) {
438 case []uint8:
439 to = to[0:0]
440 for _, x := range from {
441 to = append(to, int32(x))
442 }
443 c.bdata[c.vpos] = to
444 case []uint16:
445 to = to[0:0]
446 for _, x := range from {
447 to = append(to, int32(x))
448 }
449 c.bdata[c.vpos] = to
450 case []uint32:
451 to = to[0:0]
452 for _, x := range from {
453 to = append(to, int32(x))
454 }
455 c.bdata[c.vpos] = to
456 case []uint64:
457 to = to[0:0]
458 for _, x := range from {
459 to = append(to, int32(x))
460 }
461 c.bdata[c.vpos] = to
462 case []int8:
463 to = to[0:0]
464 for _, x := range from {
465 to = append(to, int32(x))
466 }
467 c.bdata[c.vpos] = to
468 case []int16:
469 to = to[0:0]
470 for _, x := range from {
471 to = append(to, int32(x))
472 }
473 c.bdata[c.vpos] = to
474 case []int32:
475 // Same types, nothing to do
476 c.bdata[c.vpos] = from
477 case []int64:
478 to = to[0:0]
479 for _, x := range from {
480 to = append(to, int32(x))
481 }
482 c.bdata[c.vpos] = to
483 case []float32:
484 to = to[0:0]
485 for _, x := range from {
486 to = append(to, int32(x))
487 }
488 c.bdata[c.vpos] = to
489 case []float64:
490 to = to[0:0]
491 for _, x := range from {
492 to = append(to, int32(x))
493 }
494 c.bdata[c.vpos] = to
495 default:
496 msg := fmt.Sprintf("Convert: unknown origin type %T\n", from)
497 panic(msg)
498 }
499 case []int64:
500 switch from := from.(type) {
501 case []uint8:
502 to = to[0:0]
503 for _, x := range from {
504 to = append(to, int64(x))
505 }
506 c.bdata[c.vpos] = to
507 case []uint16:
508 to = to[0:0]
509 for _, x := range from {
510 to = append(to, int64(x))
511 }
512 c.bdata[c.vpos] = to
513 case []uint32:
514 to = to[0:0]
515 for _, x := range from {
516 to = append(to, int64(x))
517 }
518 c.bdata[c.vpos] = to
519 case []uint64:
520 to = to[0:0]
521 for _, x := range from {
522 to = append(to, int64(x))
523 }
524 c.bdata[c.vpos] = to
525 case []int8:
526 to = to[0:0]
527 for _, x := range from {
528 to = append(to, int64(x))
529 }
530 c.bdata[c.vpos] = to
531 case []int16:
532 to = to[0:0]
533 for _, x := range from {
534 to = append(to, int64(x))
535 }
536 c.bdata[c.vpos] = to
537 case []int32:
538 to = to[0:0]
539 for _, x := range from {
540 to = append(to, int64(x))
541 }
542 c.bdata[c.vpos] = to
543 case []int64:
544 // Same types, nothing to do
545 c.bdata[c.vpos] = from
546 case []float32:
547 to = to[0:0]
548 for _, x := range from {
549 to = append(to, int64(x))
550 }
551 c.bdata[c.vpos] = to
552 case []float64:
553 to = to[0:0]
554 for _, x := range from {
555 to = append(to, int64(x))
556 }
557 c.bdata[c.vpos] = to
558 default:
559 msg := fmt.Sprintf("Convert: unknown origin type %T\n", from)
560 panic(msg)
561 }
562 case []float32:
563 switch from := from.(type) {
564 case []uint8:
565 to = to[0:0]
566 for _, x := range from {
567 to = append(to, float32(x))
568 }
569 c.bdata[c.vpos] = to
570 case []uint16:
571 to = to[0:0]
572 for _, x := range from {
573 to = append(to, float32(x))
574 }
575 c.bdata[c.vpos] = to
576 case []uint32:
577 to = to[0:0]
578 for _, x := range from {
579 to = append(to, float32(x))
580 }
581 c.bdata[c.vpos] = to
582 case []uint64:
583 to = to[0:0]
584 for _, x := range from {
585 to = append(to, float32(x))
586 }
587 c.bdata[c.vpos] = to
588 case []int8:
589 to = to[0:0]
590 for _, x := range from {
591 to = append(to, float32(x))
592 }
593 c.bdata[c.vpos] = to
594 case []int16:
595 to = to[0:0]
596 for _, x := range from {
597 to = append(to, float32(x))
598 }
599 c.bdata[c.vpos] = to
600 case []int32:
601 to = to[0:0]
602 for _, x := range from {
603 to = append(to, float32(x))
604 }
605 c.bdata[c.vpos] = to
606 case []int64:
607 to = to[0:0]
608 for _, x := range from {
609 to = append(to, float32(x))
610 }
611 c.bdata[c.vpos] = to
612 case []float32:
613 // Same types, nothing to do
614 c.bdata[c.vpos] = from
615 case []float64:
616 to = to[0:0]
617 for _, x := range from {
618 to = append(to, float32(x))
619 }
620 c.bdata[c.vpos] = to
621 default:
622 msg := fmt.Sprintf("Convert: unknown origin type %T\n", from)
623 panic(msg)
624 }
625 case []float64:
626 switch from := from.(type) {
627 case []uint8:
628 to = to[0:0]
629 for _, x := range from {
630 to = append(to, float64(x))
631 }
632 c.bdata[c.vpos] = to
633 case []uint16:
634 to = to[0:0]
635 for _, x := range from {
636 to = append(to, float64(x))
637 }
638 c.bdata[c.vpos] = to
639 case []uint32:
640 to = to[0:0]
641 for _, x := range from {
642 to = append(to, float64(x))
643 }
644 c.bdata[c.vpos] = to
645 case []uint64:
646 to = to[0:0]
647 for _, x := range from {
648 to = append(to, float64(x))
649 }
650 c.bdata[c.vpos] = to
651 case []int8:
652 to = to[0:0]
653 for _, x := range from {
654 to = append(to, float64(x))
655 }
656 c.bdata[c.vpos] = to
657 case []int16:
658 to = to[0:0]
659 for _, x := range from {
660 to = append(to, float64(x))
661 }
662 c.bdata[c.vpos] = to
663 case []int32:
664 to = to[0:0]
665 for _, x := range from {
666 to = append(to, float64(x))
667 }
668 c.bdata[c.vpos] = to
669 case []int64:
670 to = to[0:0]
671 for _, x := range from {
672 to = append(to, float64(x))
673 }
674 c.bdata[c.vpos] = to
675 case []float32:
676 to = to[0:0]
677 for _, x := range from {
678 to = append(to, float64(x))
679 }
680 c.bdata[c.vpos] = to
681 case []float64:
682 // Same types, nothing to do
683 c.bdata[c.vpos] = from
684 default:
685 msg := fmt.Sprintf("Convert: unknown origin type %T\n", from)
686 panic(msg)
687 }
688 default:
689 msg := fmt.Sprintf("Convert: unkown destination type %T\n", to)
690 panic(msg)
691 }
692
693 return true
694 }