(self, name: str)
| 92 | """ |
| 93 | |
| 94 | def __getattribute__(self, name: str) -> Any: |
| 95 | # accessing a structure field? |
| 96 | if name in _fields: |
| 97 | field = cls.__dict__[name] |
| 98 | ftype = _fields[name] |
| 99 | |
| 100 | if issubclass(ftype, BaseStruct): |
| 101 | fvalue = ftype.volatile_ref(mem, address + field.offset) |
| 102 | |
| 103 | else: |
| 104 | # load field's bytes from memory and tranform them into a value |
| 105 | data = mem.read(address + field.offset, field.size) |
| 106 | fvalue = ftype.from_buffer(data) |
| 107 | |
| 108 | if hasattr(fvalue, 'value'): |
| 109 | fvalue = fvalue.value |
| 110 | |
| 111 | # set the value to the structure in order to maintain consistency with ctypes.Structure |
| 112 | super().__setattr__(name, fvalue) |
| 113 | return fvalue |
| 114 | |
| 115 | # return attribute value |
| 116 | return super().__getattribute__(name) |
| 117 | |
| 118 | def __setattr__(self, name: str, value: Any) -> None: |
| 119 | # accessing a structure field? |
no test coverage detected