Commit c898360
committed
encode OcaRoot references as object numbers in dataset serialization
OcaRoot.encode(to:) now always encodes just the objectNumber, for all
encoder types. Deep serialization of object state is already handled by
OcaBlock.serialize() which calls serialize() on each action object
directly. This means any @OcaDeviceProperty that holds OcaRoot
references (e.g. OcaGroup.members) will automatically serialize as
OcaONos rather than attempting to encode full object state.
On the deserialization side, OcaDeviceProperty.set(object:jsonValue:)
now resolves [OcaONo] and OcaONo values back to objects via the device
object registry.
Note: deserialization assumes that the referenced objects have already
been instantiated (i.e. the containing block's action objects are
deserialized before any property referencing them). This ordering is
currently guaranteed by the block deserialization traversal but may
need explicit handling if that assumption changes.1 parent f804dec commit c898360
File tree
2 files changed
+24
-27
lines changed- Sources/SwiftOCADevice/OCC
- ControlClasses
- PropertyTypes
2 files changed
+24
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
155 | 150 | | |
156 | 151 | | |
157 | 152 | | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
| 153 | + | |
175 | 154 | | |
176 | 155 | | |
177 | 156 | | |
| |||
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
194 | 212 | | |
195 | 213 | | |
196 | 214 | | |
| |||
0 commit comments