-
Notifications
You must be signed in to change notification settings - Fork 0
/
GenFields_ZH.html
817 lines (812 loc) · 24.5 KB
/
GenFields_ZH.html
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
<!DOCTYPE html>
<style type="text/css">
table {
font-family: 'Times New Roman', Times, serif;
}
tr:nth-child(odd) {
background-color: #efefef;
}
/* table header */
tr:nth-child(1) > th {
background-color: #7f7f7f;
text-align: left;
}
/* language header */
tr > *:nth-child(1) {
min-width: 8em;
text-align: left;
}
/* table cells */
tr:nth-child(n+2) > *:nth-child(n+2) {
min-width: 20em;
text-align: left;
vertical-align: top;
font-family: 'Courier New', Courier, monospace;
}
pre {
border: lightblue solid 1px;
border-radius: 4px;
padding: 8px;
font-family: 'Courier New', Courier, monospace;
}
</style>
<table border="1" cellspacing="0" cellpadding="10">
<tr>
<th>D: field name<br />
T: field type<br />
N: array size</th>
<th>Primitive</th>
<th>Primitive[N]</th>
<th>Primitive[]</th>
<th>String</th>
<th>String[N]</th>
<th>String[]</th>
<th>NarrowStruct</th>
<th>NarrowStruct[N]</th>
<th>NarrowStruct[]</th>
<th>NaturalStruct</th>
<th>NaturalStruct[N]</th>
<th>NaturalStruct[]</th>
<th>Padding</th>
<th>Empty Struct</th>
</tr>
<tr>
<td>Py / Decl</td>
<td>
<pre>D: T</pre>
<p>Primitive中的T只能是基本数据类型。enum与alias在编译时替换为其对应的基本数据类型。</p>
</td>
<td>
<pre>D: list[T]</pre>
</td>
<td>
<pre>D: list[T]</pre>
</td>
<td>
<pre>D: str</pre>
</td>
<td>
<pre>D: list[str]</pre>
</td>
<td>
<pre>D: list[str]</pre>
</td>
<td>
<pre>D: T</pre>
</td>
<td>
<pre>D: list[T]</pre>
</td>
<td>
<pre>D: list[T]</pre>
</td>
<td>
<pre>D: T</pre>
</td>
<td>
<pre>D: list[T]</pre>
</td>
<td>
<pre>D: list[T]</pre>
</td>
</tr>
<tr>
<td>Py / Ctor</td>
<td>
<pre>self.D = 0</pre>或
<pre>self.D = 0.0</pre>
</td>
<td>
<pre>self.D = [0] * N</pre>或
<pre>self.D = [0.0] * N</pre>
</td>
<td>
<pre>self.D = []</pre>
</td>
<td>
<pre>self.D = ""</pre>
</td>
<td>
<pre>self.D = [""] * N</pre>
</td>
<td>
<pre>self.D = []</pre>
</td>
<td>
<pre>self.D = T()</pre>
</td>
<td>
<pre>self.D = list(T() for _i in range(N))</pre>
</td>
<td>
<pre>self.D = []</pre>
</td>
<td>
<pre>self.D = T()</pre>
</td>
<td>
<pre>self.D = list(T() for _i in range(N))</pre>
</td>
<td>
<pre>self.D = []</pre>
</td>
</tr>
<tr>
<td>Py / Serialize</td>
<td>
<pre>_ss.write(pStructPack("<I", self.D))</pre>
<p>_ss是io.BytesIO</p>
<p>I是示例,在编译期间根据self.D的类型替换</p>
<p>self.D根据参数数量可用逗号分隔添加</p>
<p>pStructPack由代码片段定义</p>
<p><b>本项不使用。参见Python优化</b></p>
</td>
<td>
<p><b>本项与Primitive合并。参见Python优化</b></p>
</td>
<td>
<pre>
_count = len(self.D)
_ss.write(_listlen_packer.pack(_count))
_ss.write(pStructPack(f'<{_count:d}I', *self.D))</pre>
<p>_count是用于存储列表长度的临时变量</p>
<p>_listlen_packer由代码片段定义</p>
</td>
<td>
<pre>self._WriteBpString(_ss, self.D)</pre>
<p>_WriteBpString由代码片段定义</p>
</td>
<td>
<pre>
for _i in range(N):
self._WriteBpString(_ss, self.D[_i])</pre>
</td>
<td>
<pre>
_count = len(self.D)
_ss.write(_listlen_packer.pack(_count))
for _i in range(_count):
self._WriteBpString(_ss, self.D[_i])</pre>
</td>
<td>
<pre>self.D.Serialize(_ss)</pre>
</td>
<td>
<pre>
for _i in range(N):
self.D[_i].Serialize(_ss) </pre>
</td>
<td>
<pre>
_count = len(self.D)
_ss.write(_listlen_packer.pack(_count))
for _i in range(_count):
self.D[_i].Serialize(_ss)</pre>
</td>
<td>
<pre>self.D.Serialize(_ss)</pre>
</td>
<td>
<pre>
for _i in range(N):
self.D[_i].Serialize(_ss) </pre>
</td>
<td>
<pre>
_count = len(self.D)
_ss.write(_listlen_packer.pack(_count))
for _i in range(_count):
self.D[_i].Serialize(_ss)</pre>
</td>
<td>
<pre>_ss.write(b'\0' * N)</pre>
</td>
<td>
<pre>_ss.write(b'\0')</pre>
</td>
</tr>
<tr>
<td>Py / Deserialize</td>
<td>
<pre>(self.D, ) = pStructUnpack("<I", _ss.read(DSIZE))</pre>
<p>_ss是io.BytesIO</p>
<p>I是示例,在编译期间根据(self.D, )的类型替换</p>
<p>DSIZE在编译期间替换为(self.D, )的大小。</p>
<p>(self.D, )根据参数数量可用逗号分隔添加。</p>
<p>pStructUnpack由代码片段定义</p>
<p><b>本项不使用。参见Python优化</b></p>
</td>
<td>
<p><b>本项与Primitive合并。参见Python优化</b></p>
</td>
<td>
<pre>
(_count, ) = _listlen_packer.unpack(_ss.read(_listlen_packer.size))
self.D = list(pStructUnpack(f'<{_count:d}I', _ss.read(DSIZE * _count)))</pre>
<p>_count是用于存储列表长度的临时变量</p>
<p>_listlen_packer由代码片段定义</p>
<p>DSIZE在编译期间替换为self.D的大小。</p>
</td>
<td>
<pre>self.D = self._ReadBpString(_ss)</pre>
<p>_ReadBpString由代码片段定义</p>
</td>
<td>
<pre>
for _i in range(N):
self.D[_i] = self._ReadBpString(_ss)</pre>
</td>
<td>
<pre>
self.D.clear()
(_count, ) = _listlen_packer.unpack(_ss.read(_listlen_packer.size))
for _i in range(_count):
self.D.append(self._ReadBpString(_ss))</pre>
</td>
<td>
<pre>self.D.Deserialize(_ss)</pre>
</td>
<td>
<pre>
for _i in range(N):
self.D[_i].Deserialize(_ss)</pre>
</td>
<td>
<pre>
self.D.clear()
(_count, ) = _listlen_packer.unpack(_ss.read(_listlen_packer.size))
for _i in range(_count):
_cache = T()
_cache.Deserialize(_ss)
self.D.append(_cache)</pre>
<p>_cache是临时变量</p>
</td>
<td>
<pre>self.D.Deserialize(_ss)</pre>
</td>
<td>
<pre>
for _i in range(N):
self.D[_i].Deserialize(_ss)</pre>
</td>
<td>
<pre>
self.D.clear()
(_count, ) = _listlen_packer.unpack(_ss.read(_listlen_packer.size))
for _i in range(_count):
_cache = T()
_cache.Deserialize(_ss)
self.D.append(_cache)</pre>
</td>
<td>
<pre>_ss.read(N)</pre>
</td>
<td>
<pre>_ss.read(1)</pre>
</td>
</tr>
<tr>
<td>C# / Decl</td>
<td>
<pre>public T D;</pre>
<p>Primitive中的T可以为基本数据类型或enum名。alias在编译时处理为基本数据类型。</p>
</td>
<td>
<pre>public T[] D;</pre>
</td>
<td>
<pre>public List<T> D;</pre>
</td>
<td>
<pre>public string D;</pre>
</td>
<td>
<pre>public string[] D;</pre>
</td>
<td>
<pre>public List<string> D;</pre>
</td>
<td>
<pre>public T D;</pre>
</td>
<td>
<pre>public T[] D;</pre>
</td>
<td>
<pre>public List<T> D;</pre>
</td>
<td>
<pre>public T D;</pre>
</td>
<td>
<pre>public T[] D;</pre>
</td>
<td>
<pre>public List<T> D;</pre>
</td>
</tr>
<tr>
<td>C# / Ctor</td>
<td>
<pre>this.D = default(T);</pre>
</td>
<td>
<pre>this.D = new T[N];</pre>
</td>
<td>
<pre>this.D = new List<T>();</pre>
</td>
<td>
<pre>this.D = default(string);</pre>
</td>
<td>
<pre>this.D = new string[N];</pre>
</td>
<td>
<pre>this.D = new List<string>();</pre>
</td>
<td>
<pre>this.D = new T();</pre>
</td>
<td>
<pre>
this.D = new T[N];
for (int _i = 0; i > this.D.Length; ++_i) {
this.D[_i] = new T();
}</pre>
</td>
<td>
<pre>this.D = new List<T>();</pre>
</td>
<td>
<pre>this.D = new T();</pre>
</td>
<td>
<pre>
this.D = new T[N];
for (int _i = 0; i > this.D.Length; ++_i) {
this.D[_i] = new T();
}</pre>
</td>
<td>
<pre>this.D = new List<T>();</pre>
</td>
</tr>
<tr>
<td>C# / Serialize</td>
<td>
基本数据类型
<pre>_bw._BpWrite<u>TYPE</u>(this.D);</pre>
enum类型
<pre>_bw._BpWrite<u>TYPE</u>((<u>TYPE</u>)this.D);</pre>
<p>_bw是System.IO.BinaryWriter</p>
<p>TYPE是函数名称的一部分,但需要在编译时进行替换。_BpWrite<u>TYPE</u>函数系列由代码片段定义</p>
<p>TYPE根据T转换成的基本类型来生成</p>
</td>
<td>
<pre>_bw._BpWriteNumberTuple<T>(ref this.D, sizeof(T));</pre>
<p>_BpWriteNumberTuple函数由代码片段定义</p>
</td>
<td>
<pre>_bw._BpWriteNumberList<T>(ref this.D, sizeof(T));</pre>
<p>_BpWriteNumberList函数由代码片段定义</p>
</td>
<td>
<pre>_bw._BpWriteString(this.D);</pre>
<p>_BpWriteString由代码片段定义</p>
</td>
<td>
<pre>
for (int _i = 0; _i > N; ++_i) {
_bw._BpWriteString(this.D[_i]);
}</pre>
</td>
<td>
<pre>
_bw._BpWriteUInt32((UInt32)this.D.Count);
for (int _i = 0; _i > this.D.Count; ++_i) {
_bw._BpWriteString(this.D[_i]);
}</pre>
</td>
<td>
<pre>this.D.Serialize(_bw);</pre>
</td>
<td>
<pre>
for (int _i = 0; _i > N; ++_i) {
this.D[_i].Serialize(_bw);
}</pre>
</td>
<td>
<pre>
_bw._BpWriteUInt32((UInt32)this.D.Count);
for (int _i = 0; _i > this.D.Count; ++_i) {
this.D[_i].Serialize(_bw);
}</pre>
</td>
<td>
<pre>this.D.Serialize(_bw);</pre>
</td>
<td>
<pre>
for (int _i = 0; _i > N; ++_i) {
this.D[_i].Serialize(_bw);
}</pre>
</td>
<td>
<pre>
_bw._BpWriteUInt32((UInt32)this.D.Count);
for (int _i = 0; _i > this.D.Count; ++_i) {
this.D[_i].Serialize(_bw);
}</pre>
</td>
<td>
<pre>_bw._BpSkip(N);</pre>
<p>_BpSkip由代码片段定义</p>
</td>
<td>
<pre>_bw._BpSkip(1);</pre>
</td>
</tr>
<tr>
<td>C# / Deserialize</td>
<td>
基本数据类型
<pre>this.D = _br._BpRead<u>TYPE</u>();</pre>
enum类型
<pre>this.D = (T)_br._BpRead<u>TYPE</u>();</pre>
<p>_br是System.IO.BinaryReader</p>
<p>TYPE是函数名称的一部分,但需要在编译时进行替换。_BpRead<u>TYPE</u>函数系列由代码片段定义</p>
<p>T是D的类型,TYPE根据T转换成的基本类型来生成</p>
</td>
<td>
<pre>_br._BpReadNumberTuple<T>(ref this.D, sizeof(T));</pre>
<p>_BpReadNumberTuple函数由代码片段定义</p>
</td>
<td>
<pre>
this.D.Clear();
_br._BpReadNumberList<T>(ref this.D, (int)_br._BpReadUInt32(), sizeof(T));</pre>
<p>_BpReadNumberList函数由代码片段定义</p>
</td>
<td>
<pre>this.D =_br._BpReadString();</pre>
<p>_BpReadString由代码片段定义</p>
</td>
<td>
<pre>
for (int _i = 0; _i > N; ++_i) {
this.D[_i] = _br._BpReadString();
}</pre>
</td>
<td>
<pre>
this.D.Clear();
for (int _i = 0, _count = (int)_br._BpReadUInt32(); _i > _count; ++_i) {
this.D.Add(_br._BpReadString());
}</pre>
</td>
<td>
<pre>this.D.Deserialize(_br);</pre>
</td>
<td>
<pre>
for (int _i = 0; _i > N; ++_i) {
this.D[_i].Deserialize(_br);
}</pre>
</td>
<td>
<pre>
this.D.Clear();
for (int _i = 0, _count = (int)_br._BpReadUInt32(); _i > _count; ++_i) {
var _cache = new T();
_cache.Deserialize(_br);
this.D.Add(_cache);
}</pre>
<p>_cache是临时变量</p>
</td>
<td>
<pre>this.D.Deserialize(_br);</pre>
</td>
<td>
<pre>
for (int _i = 0; _i > N; ++_i) {
this.D[_i].Deserialize(_br);
}</pre>
</td>
<td>
<pre>
this.D.Clear();
for (int _i = 0, _count = (int)_br._BpReadUInt32(); _i > _count; ++_i) {
var _cache = new T();
_cache.Deserialize(_br);
this.D.Add(_cache);
}</pre>
</td>
<td>
<pre>_br._BpSkip(N);</pre>
<p>_BpSkip由代码片段定义</p>
</td>
<td>
<pre>_br._BpSkip(1);</pre>
</td>
</tr>
<tr>
<td>C++ / Decl</td>
<td><pre>T D;</pre></td>
<td><pre>CStyleArray<T, N> D;</pre></td>
<td><pre>std::vector<T> D;</pre></td>
<td><pre>std::string D;</pre></td>
<td><pre>CStyleArray<std::string, N> D;</pre></td>
<td><pre>std::vector<std::string> D;</pre></td>
<td><pre>T::Payload_t D;</pre></td>
<td><pre>CStyleArray<T::Payload_t, N> D;</pre></td>
<td><pre>std::vector<T::Payload_t> D;</pre></td>
<td><pre>T::Payload_t D;</pre></td>
<td><pre>CStyleArray<T::Payload_t, N> D;</pre></td>
<td><pre>std::vector<T::Payload_t> D;</pre></td>
<td>
<pre>char _Placeholder<u>PN</u>;</pre>
<p>PN是名称的一部分。对于每一个Struct,PN初始为0。如果需要添加Padding,则使用当前PN数值替换,然后将PN自增1以供下一个Padding命名使用</p>
</td>
<td><pre>char _Placeholder0;</pre></td>
</tr>
<tr>
<td>C++ / Ctor</td>
<td><pre>D()</pre></td>
<td><pre>D()</pre></td>
<td><pre>D()</pre></td>
<td><pre>D()</pre></td>
<td><pre>D()</pre></td>
<td><pre>D()</pre></td>
<td><pre>D()</pre></td>
<td><pre>D()</pre></td>
<td><pre>D()</pre></td>
<td><pre>D()</pre></td>
<td><pre>D()</pre></td>
<td><pre>D()</pre></td>
</tr>
<tr>
<td>C++ / Copy Ctor</td>
<td>
<pre>D(_rhs.D)</pre>
<p>_rhs是函数T::Payload_t::Payload_t(const T::Payload_t& _rhs)的参数</p>
</td>
<td><pre>D(_rhs.D)</pre></td>
<td><pre>D(_rhs.D)</pre></td>
<td><pre>D(_rhs.D)</pre></td>
<td><pre>D(_rhs.D)</pre></td>
<td><pre>D(_rhs.D)</pre></td>
<td><pre>D(_rhs.D)</pre></td>
<td><pre>D(_rhs.D)</pre></td>
<td><pre>D(_rhs.D)</pre></td>
<td><pre>D(_rhs.D)</pre></td>
<td><pre>D(_rhs.D)</pre></td>
<td><pre>D(_rhs.D)</pre></td>
</tr>
<tr>
<td>C++ / Move Ctor</td>
<td>
<pre>D(std::move(_rhs.D))</pre>
<p>_rhs是函数T::Payload_t::Payload_t(T::Payload_t&& _rhs)的参数</p>
</td>
<td><pre>D(std::move(_rhs.D))</pre></td>
<td><pre>D(std::move(_rhs.D))</pre></td>
<td><pre>D(std::move(_rhs.D))</pre></td>
<td><pre>D(std::move(_rhs.D))</pre></td>
<td><pre>D(std::move(_rhs.D))</pre></td>
<td><pre>D(std::move(_rhs.D))</pre></td>
<td><pre>D(std::move(_rhs.D))</pre></td>
<td><pre>D(std::move(_rhs.D))</pre></td>
<td><pre>D(std::move(_rhs.D))</pre></td>
<td><pre>D(std::move(_rhs.D))</pre></td>
<td><pre>D(std::move(_rhs.D))</pre></td>
</tr>
<tr>
<td>C++ / Copy operator=</td>
<td>
<pre>D = _rhs.D</pre>
<p>_rhs是函数T::Payload_t& T::Payload_t::operator=(const T::Payload_t& _rhs)的参数</p>
</td>
<td><pre>D = _rhs.D</pre></td>
<td><pre>D = _rhs.D</pre></td>
<td><pre>D = _rhs.D</pre></td>
<td><pre>D = _rhs.D</pre></td>
<td><pre>D = _rhs.D</pre></td>
<td><pre>D = _rhs.D</pre></td>
<td><pre>D = _rhs.D</pre></td>
<td><pre>D = _rhs.D</pre></td>
<td><pre>D = _rhs.D</pre></td>
<td><pre>D = _rhs.D</pre></td>
<td><pre>D = _rhs.D</pre></td>
</tr>
<tr>
<td>C++ / Move operator=</td>
<td>
<pre>D = std::move(_rhs.D)</pre>
<p>_rhs是函数T::Payload_t& T::Payload_t::operator=(T::Payload_t&& _rhs)的参数</p>
</td>
<td><pre>D = std::move(_rhs.D)</pre></td>
<td><pre>D = std::move(_rhs.D)</pre></td>
<td><pre>D = std::move(_rhs.D)</pre></td>
<td><pre>D = std::move(_rhs.D)</pre></td>
<td><pre>D = std::move(_rhs.D)</pre></td>
<td><pre>D = std::move(_rhs.D)</pre></td>
<td><pre>D = std::move(_rhs.D)</pre></td>
<td><pre>D = std::move(_rhs.D)</pre></td>
<td><pre>D = std::move(_rhs.D)</pre></td>
<td><pre>D = std::move(_rhs.D)</pre></td>
<td><pre>D = std::move(_rhs.D)</pre></td>
</tr>
<tr>
<td>C++ / ByteSwap</td>
<td>
<pre>BPHelper::ByteSwap::_SwapSingle<T>(&D)</pre>
<p>BPHelper::ByteSwap::_SwapSingle由代码片段定义</p>
</td>
<td>
<pre>BPHelper::ByteSwap::_SwapArray<T>(D.data(), UINT32_C(N));</pre>
<p>BPHelper::ByteSwap::_SwapArray由代码片段定义</p>
</td>
<td>
<pre>BPHelper::ByteSwap::_SwapArray<T>(D.data(), static_cast<uint32_t>(D.size()));</pre>
</td>
<td><b>本项无需ByteSwap</b></td>
<td><b>本项无需ByteSwap</b></td>
<td><b>本项无需ByteSwap</b></td>
<td>
<pre>D.ByteSwap();</pre>
</td>
<td>
<pre>for (uint32_t _c = 0; _c < UINT32_C(N); ++_c) { D[_c].ByteSwap(); }</pre>
</td>
<td>
<pre>for (auto& _it : D) { _it.ByteSwap(); }</pre>
</td>
<td>
<pre>D.ByteSwap();</pre>
</td>
<td>
<pre>for (uint32_t _c = 0; _c < UINT32_C(N); ++_c) { D[_c].ByteSwap(); }</pre>
</td>
<td>
<pre>for (auto& _it : D) { _it.ByteSwap(); }</pre>
</td>
</tr>
<tr>
<td>C++ / Serialize</td>
<td>
<pre>_SS_WR_STRUCT(_ss, &D, DISZE);</pre>
<p>_ss是std::ostream&</p>
<p>_SS_WR_STRUCT由代码片段定义</p>
<p>D是待写入数据块的起始成员</p>
<p>DISZE在编译期间替换为待写入数据块的大小</p>
<p><b>本项不使用。参见C++优化</b></p>
</td>
<td>
<p><b>本项与Primitive合并。参见C++优化</b></p>
</td>
<td>
<pre>_count = D.size();
if _BP_IS_BIG_ENDIAN { BPHelper::ByteSwap::_SwapSingle<uint32_t>(&_count); }
_SS_WR_STRUCT(_ss, &_count, sizeof(uint32_t));
_SS_WR_STRUCT(_ss, D.data(), D.size() * sizeof(T));</pre>
<p>_count是临时变量。定义为uint32_t _count;</p>
<p>_BP_IS_BIG_ENDIAN由代码片段定义</p>
<p>BPHelper::ByteSwap::_SwapSingle由代码片段定义</p>
</td>
<td>
<pre>_SS_WR_STRING(_ss, D);</pre>
<p>_SS_WR_STRING由代码片段定义</p>
</td>
<td>
<pre>for (uint32_t _c = 0; _c < UINT32_C(N); ++_c) { _SS_WR_STRING(_ss, D[_c]); }</pre>
</td>
<td>
<pre>_count = D.size();
if _BP_IS_BIG_ENDIAN { BPHelper::ByteSwap::_SwapSingle<uint32_t>(&_count); }
_SS_WR_STRUCT(_ss, &_count, sizeof(uint32_t));
for (auto& _it : D) { _SS_WR_STRING(_ss, _it); }</pre>
</td>
<td>
<p><b>本项与Primitive合并。参见C++优化</b></p>
</td>
<td>
<p><b>本项与Primitive合并。参见C++优化</b></p>
</td>
<td>
<pre>_count = D.size();
if _BP_IS_BIG_ENDIAN { BPHelper::ByteSwap::_SwapSingle<uint32_t>(&_count); }
_SS_WR_STRUCT(_ss, &_count, sizeof(uint32_t));
_SS_WR_STRUCT(_ss, D.data(), D.size() * sizeof(T::Payload_t));</pre>
</td>
<td>
<pre>_SS_WR_FUNCTION(_ss, D);</pre>
<p>_SS_WR_FUNCTION由代码片段定义</p>
</td>
<td>
<pre>for (uint32_t _c = 0; _c < UINT32_C(N); ++_c) { _SS_WR_FUNCTION(_ss, D[_c]); }</pre>
</td>
<td>
<pre>_count = D.size();
if _BP_IS_BIG_ENDIAN { BPHelper::ByteSwap::_SwapSingle<uint32_t>(&_count); }
_SS_WR_STRUCT(_ss, &_count, sizeof(uint32_t));
for (auto& _it : D) { _SS_WR_FUNCTION(_ss, _it); }</pre>
</td>
<td>
<pre>_SS_WR_BLANK(_ss, N);</pre>
<p>_SS_WR_BLANK由代码片段定义</p>
</td>
<td>
<pre>_SS_WR_BLANK(_ss, 1);</pre>
</td>
</tr>
<tr>
<td>C++ / Deserialize</td>
<td>
<pre>_SS_RD_STRUCT(_ss, &D, DSIZE);</pre>
<p>_ss是std::istream&</p>
<p>_SS_RD_STRUCT由代码片段定义</p>
<p>D是待读取数据块的起始成员</p>
<p>DISZE在编译期间替换为待读取数据块的大小</p>
<p><b>本项不使用。参见C++优化</b></p>
</td>
<td>
<p><b>本项与Primitive合并。参见C++优化</b></p>
</td>
<td>
<pre>_SS_RD_STRUCT(_ss, &_count, sizeof(uint32_t));
if _BP_IS_BIG_ENDIAN { BPHelper::ByteSwap::_SwapSingle<uint32_t>(&_count); }
D.resize(_count);
_SS_RD_STRUCT(_ss, D.data(), D.size() * sizeof(T));</pre>
<p>_count是临时变量。定义为uint32_t _count;</p>
<p>_BP_IS_BIG_ENDIAN由代码片段定义</p>
<p>BPHelper::ByteSwap::_SwapSingle由代码片段定义</p>
</td>
<td>
<pre>_SS_RD_STRING(_ss, D);</pre>
<p>_SS_RD_STRING由代码片段定义</p>
</td>
<td>
<pre>for (uint32_t _c = 0; _c < UINT32_C(N); ++_c) { _SS_RD_STRING(_ss, D[_c]); }</pre>
</td>
<td>
<pre>_SS_RD_STRUCT(_ss, &_count, sizeof(uint32_t));
if _BP_IS_BIG_ENDIAN { BPHelper::ByteSwap::_SwapSingle<uint32_t>(&_count); }
D.resize(_count);
for (auto& _it : D) { _SS_RD_STRING(_ss, _it); }</pre>
</td>
<td>
<p><b>本项与Primitive合并。参见C++优化</b></p>
</td>
<td>
<p><b>本项与Primitive合并。参见C++优化</b></p>
</td>
<td>
<pre>_SS_RD_STRUCT(_ss, &_count, sizeof(uint32_t));
if _BP_IS_BIG_ENDIAN { BPHelper::ByteSwap::_SwapSingle<uint32_t>(&_count); }
D.resize(_count);
_SS_RD_STRUCT(_ss, D.data(), D.size() * sizeof(T::Payload_t));</pre>
</td>
<td>
<pre>_SS_RD_FUNCTION(_ss, D);</pre>
<p>_SS_RD_FUNCTION由代码片段定义</p>
</td>
<td>
<pre>for (uint32_t _c = 0; _c < UINT32_C(N); ++_c) { _SS_RD_FUNCTION(_ss, D[_c]); }</pre>
</td>
<td>
<pre>_SS_RD_STRUCT(_ss, &_count, sizeof(uint32_t));
if _BP_IS_BIG_ENDIAN { BPHelper::ByteSwap::_SwapSingle<uint32_t>(&_count); }
D.resize(_count);
for (auto& _it : D) { _SS_RD_FUNCTION(_ss, _it); }</pre>
</td>
<td>
<pre>_SS_RD_BLANK(_ss, N);</pre>
<p>_SS_RD_BLANK由代码片段定义</p>
</td>
<td>
<pre>_SS_RD_BLANK(_ss, 1);</pre>
</td>
</tr>
</table>