(self, memory, offset)
| 95 | self.size = ctypes.sizeof(self.ctype) |
| 96 | |
| 97 | def Read(self, memory, offset): |
| 98 | if self.is_flexible: |
| 99 | fields_copy = self.fields[:] |
| 100 | last = 0 |
| 101 | for name, type_or_func in fields_copy: |
| 102 | if isinstance(type_or_func, types.FunctionType): |
| 103 | partial_ctype = Descriptor._GetCtype(fields_copy[:last]) |
| 104 | partial_object = partial_ctype.from_buffer(memory, offset) |
| 105 | type = type_or_func(partial_object) |
| 106 | if type is not None: |
| 107 | fields_copy[last] = (name, type) |
| 108 | last += 1 |
| 109 | else: |
| 110 | last += 1 |
| 111 | complete_ctype = Descriptor._GetCtype(fields_copy[:last]) |
| 112 | else: |
| 113 | complete_ctype = self.ctype |
| 114 | return complete_ctype.from_buffer(memory, offset) |
| 115 | |
| 116 | @staticmethod |
| 117 | def _GetCtype(fields): |
no test coverage detected