| 11161 | |
| 11162 | @functools.total_ordering |
| 11163 | class StructList(object): |
| 11164 | __slots__ = "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "f10", |
| 11165 | |
| 11166 | def __init__(self, f1=None, f2=None, f3=None, f4=None, f5=None, f6=None, f7=None, f8=None, f9=None, f10=None): |
| 11167 | if f1 is None: |
| 11168 | f1 = list() |
| 11169 | if f2 is None: |
| 11170 | f2 = list() |
| 11171 | if f3 is None: |
| 11172 | f3 = list() |
| 11173 | if f4 is None: |
| 11174 | f4 = list() |
| 11175 | if f5 is None: |
| 11176 | f5 = list() |
| 11177 | if f6 is None: |
| 11178 | f6 = list() |
| 11179 | if f7 is None: |
| 11180 | f7 = list() |
| 11181 | if f8 is None: |
| 11182 | f8 = list() |
| 11183 | if f9 is None: |
| 11184 | f9 = list() |
| 11185 | if f10 is None: |
| 11186 | f10 = list() |
| 11187 | self.f1 = f1 |
| 11188 | self.f2 = f2 |
| 11189 | self.f3 = f3 |
| 11190 | self.f4 = f4 |
| 11191 | self.f5 = f5 |
| 11192 | self.f6 = f6 |
| 11193 | self.f7 = f7 |
| 11194 | self.f8 = f8 |
| 11195 | self.f9 = f9 |
| 11196 | self.f10 = f10 |
| 11197 | |
| 11198 | # Struct shallow copy |
| 11199 | def copy(self, other): |
| 11200 | self.f1 = other.f1 |
| 11201 | self.f2 = other.f2 |
| 11202 | self.f3 = other.f3 |
| 11203 | self.f4 = other.f4 |
| 11204 | self.f5 = other.f5 |
| 11205 | self.f6 = other.f6 |
| 11206 | self.f7 = other.f7 |
| 11207 | self.f8 = other.f8 |
| 11208 | self.f9 = other.f9 |
| 11209 | self.f10 = other.f10 |
| 11210 | return self |
| 11211 | |
| 11212 | # Struct deep clone |
| 11213 | def clone(self): |
| 11214 | # Serialize the struct to the FBE stream |
| 11215 | writer = StructListModel(fbe.WriteBuffer()) |
| 11216 | writer.serialize(self) |
| 11217 | |
| 11218 | # Deserialize the struct from the FBE stream |
| 11219 | reader = StructListModel(fbe.ReadBuffer()) |
| 11220 | reader.attach_buffer(writer.buffer) |
no outgoing calls