]>
Commit | Line | Data |
---|---|---|
50a14534 EB |
1 | WARNING: OLD file format. Will be discarded. Read FF2 |
2 | ---------- | |
3 | Magic Number: | |
4 | 6c45e131 | |
5 | ||
6 | lE.. | |
7 | ||
8 | at beginning of file. I love magic numbers. | |
9 | ||
10 | For Serialization, we need to separate realizing a layer and adding it to a aggregate. An aggregate | |
11 | layer, when realized, should realize all of its children, and add all of its children to the treeview. | |
12 | An aggregate should realize a layer and add it to the treeview in add_layer only if it is already | |
13 | realized (we cannot assume that it is.) This will pave the road for serialization. | |
14 | ||
15 | Tree | |
16 | Child | |
17 | Child | |
18 | ||
19 | ||
20 | START | |
21 | (TopLayer) | |
22 | layer type ID | |
23 | layer name len + layer name | |
24 | Layer Data. Call Layer serialize-in func. | |
25 | ||
26 | (if type == aggregate, len = # of layers) | |
27 | ||
28 | Example: | |
29 | ||
30 | Top | |
31 | + Aggy | |
32 | + Aggy2 | |
33 | - TRW | |
34 | - MAP | |
35 | - COORD | |
36 | + Aggy1 | |
37 | - TRW | |
38 | - TRW | |
39 | - TRW | |
40 | ||
41 | File: | |
42 | ||
43 | 0 (Aggregate) | |
44 | 4 | |
45 | Aggy | |
46 | 2 (2 Sublayers) | |
47 | ||
48 | 0 (Aggregate) | |
49 | 5 | |
50 | Aggy2 | |
51 | 2 (2 Subs) | |
52 | ||
53 | 1 (TRW) | |
54 | 3 | |
55 | TRW | |
56 | (TRW DATA) | |
57 | ||
58 | 2 (MAP) | |
59 | 3 | |
60 | MAP | |
61 | (MAP DATA) | |
62 | ||
63 | 3 (COORD) | |
64 | 5 | |
65 | COORD | |
66 | (COORD DATA) | |
67 | ||
68 | 1 | |
69 | 5 | |
70 | Aggy1 | |
71 | 3 (3 subs) | |
72 | ||
73 | 1 | |
74 | 3 | |
75 | TRW | |
76 | 100 | |
77 | (TRW DATA) | |
78 | ||
79 | 1 | |
80 | 3 | |
81 | TRW | |
82 | 100 | |
83 | (TRW DATA) | |
84 | ||
85 | 1 | |
86 | 3 | |
87 | TRW | |
88 | 100 | |
89 | (TRW DATA) | |
90 | ||
91 | (END) | |
92 | ||
93 | Parsing | |
94 | Call agg parse function (top layer) with file format. | |
95 | agg parse function parses, calls appropriate function. | |
96 | repeats add infinitum. | |
97 | ||
98 | ---- | |
99 | ||
100 | Functions: | |
101 | ||
102 | Aggregate Read: | |
103 | for loop thru # of layers: | |
104 | read a byte, get id, create a layer of such type via the "serialize_read" func which | |
105 | returns a layer I can then read. | |
106 | repeat, enjoy. | |
107 | ||
108 | Ahhh, the joys of Recursion. | |
109 | ||
110 | Aggregate Write: | |
111 | write length of layers array. | |
112 | for each layer: | |
113 | write ID. | |
114 | run serialize_write. | |
115 | ||
116 | ||
117 | MAX # of layers: 2^16 | |
118 |