class ArrayInstance(_Generic[_ValueType]):
An array instance, the result of reading an array.
Access the elements of the array as a list with the ArrayInstance.list
method, or with a list conversion.
Method | __eq__ |
Compares the instance for equality with an object. |
Method | __getitem__ |
Returns an item of the array from its index, or a subslice of this instance. |
Method | __hash__ |
Returns the hash for this value. |
Method | __init__ |
Initializes a new array instance from its array type, its list of elements and the context it was read at. |
Method | __iter__ |
Iterates over the elements of the array. |
Method | __len__ |
Get the number of elements of the array. |
Method | __ne__ |
Compares the instance for equality with an object. |
Method | assert |
Asserts to the type system that this array produces array values. |
Method | assert |
Asserts to the type system that this array produces boolean values. |
Method | assert |
Asserts to the type system that this array produces enum values. |
Method | assert |
Asserts to the type system that this array produces float values. |
Method | assert |
Asserts to the type system that this array produces integer values. |
Method | assert |
Asserts to the type system that this array produces pointer values. |
Method | assert |
Asserts to the type system that this array produces struct values. |
Method | list |
Produces the values of this instance as a list, whose type of element is determined by the type of this instance. |
Method | list |
Produces the values of this instance as a list of byte buffers. |
Method | slice |
Returns a new instance that is a slice of the current instance. |
Method | slice |
Returns the value of this instance, interpreted as a null-terminated string. |
Method | to |
Returns the value of this instance, interpreted as the bytes it is composed of. |
Class Variable |
|
Undocumented |
Class Variable |
|
Undocumented |
Property | context |
The context where this instance was spawned at. |
Property | count |
The number of elements of the array. |
Property | type |
The type of the instance. |
Instance Variable | _array |
Undocumented |
Instance Variable | _ctx |
Undocumented |
Instance Variable | _elements |
Undocumented |
Compares the instance for equality with an object.
- if the object is of type
ArrayInstance
, it will be considered equal to this instance if it has the same array type (including the number of elements) and the same elements. - if the object can be converted to a list, it will be considered equal to this instance if it has the same elements.
- if the object is none of the types above, then it will never be considered equal.
Note
- The context where this enum was spawned at is never taken into consideration for the purpose of equality. This means that two
ArrayInstance
s at different contexts with the same type and values will be considered equal. - Similarly, the source from which the instance was read is never taken into consideration for the purpose of equality. This means that two
ArrayInstance
s coming from different addresses in memory or different registers can compare equal if they have the same type and values.
Returns | |
bool | Undocumented |
Returns an item of the array from its index, or a subslice of this instance.
Information
Parameters | |
item:_Union[ | the index of the item in the list, or a slice object indicating the bounds of the subslice. |
Returns | |
_Union[ | a value of the type produced by the inner type of the array, or a subslice of the same instance. |
Raises | |
IndexError | if the index is out of bounds. |
Initializes a new array instance from its array type, its list of elements and the context it was read at.
Warnings
At the moment, this object is not meant to be constructed directly. Use FieldInstance.read
instead.
Parameters | |
array:_Array | Undocumented |
elements:_List[ | Undocumented |
ctx:_trace.Context | Undocumented |
Iterates over the elements of the array.
Returns | |
_Iterator[ | Undocumented |
Compares the instance for equality with an object.
- if the object is of type
ArrayInstance
, it will be considered equal to this instance if it has the same array type (including the number of elements) and the same elements. - if the object can be converted to a list, it will be considered equal to this instance if it has the same elements.
- if the object is none of the types above, then it will never be considered equal.
Note
- The context where this enum was spawned at is never taken into consideration for the purpose of equality. This means that two
ArrayInstance
s at different contexts with the same type and values will be considered equal. - Similarly, the source from which the instance was read is never taken into consideration for the purpose of equality. This means that two
ArrayInstance
s coming from different addresses in memory or different registers can compare equal if they have the same type and values.
Returns | |
bool | Undocumented |
Asserts to the type system that this array produces array values.
Information
Returns | |
ArrayInstance[ | this instance, with the additional type information that it produces array values. |
Raises | |
ValueError | if this instance does not, in fact, produce array values, according to its runtime type. |
Asserts to the type system that this array produces boolean values.
Information
Returns | |
ArrayInstance[ | this instance, with the additional type information that it produces boolean values. |
Raises | |
ValueError | if this instance does not, in fact, produce boolean values, according to its runtime type. |
Asserts to the type system that this array produces enum values.
Information
Returns | |
ArrayInstance[ | this instance, with the additional type information that it produces enum values. |
Raises | |
ValueError | if this instance does not, in fact, produce enum values, according to its runtime type. |
Asserts to the type system that this array produces float values.
Information
Returns | |
ArrayInstance[ | this instance, with the additional type information that it produces float values. |
Raises | |
ValueError | if this instance does not, in fact, produce float values, according to its runtime type. |
Asserts to the type system that this array produces integer values.
Information
Returns | |
ArrayInstance[ | this instance, with the additional type information that it produces integer values. |
Raises | |
ValueError | if this instance does not, in fact, produce integer values, according to its runtime type. |
Asserts to the type system that this array produces pointer values.
Information
Returns | |
ArrayInstance[ | this instance, with the additional type information that it produces pointer values. |
Raises | |
ValueError | if this instance does not, in fact, produce pointer values, according to its runtime type. |
Asserts to the type system that this array produces struct values.
Information
Returns | |
ArrayInstance[ | this instance, with the additional type information that it produces struct values. |
Raises | |
ValueError | if this instance does not, in fact, produce struct values, according to its runtime type. |
Produces the values of this instance as a list, whose type of element is determined by the type of this instance.
Returns | |
_List[ | Undocumented |
Produces the values of this instance as a list of byte buffers.
Returns | |
_List[ | Undocumented |
Returns a new instance that is a slice of the current instance.
Information
Parameters | |
offset:int | the first element in the subslice. |
size:_Optional[ | the number of elements in the subslice. If None, then the maximum amount of elements. |
Returns | |
ArrayInstance[ | an instance containing the selected elements. |
Returns the value of this instance, interpreted as a null-terminated string.
Information
Parameters | |
cstring:_CString | allows to specify the encoding and maximum size of the string to read. |
Returns | |
str | the value pointed to by this field, as a string. |
Raises | |
ValueError | if, according to its runtime type, this field does not produce a pointer value. |
EncodingError | if the bytes pointed to by the field contain errors wrt to the specified encoding. |