class documentation

class EnumerationInstance:

View In Hierarchy

An enumeration instance, the result of reading an enumeration.

Access the value of this instance with the EnumerationInstance.value method, or check if it is exactly one member from the enumeration with the EnumerationInstance.is_exactly method.

For flag enumerations, check if a member of the enumeration is part of the value with the EnumerationInstance.is_also method.

Method __eq__ Compares the instance for equality with an object.
Method __hash__ Returns the hash for this value.
Method __init__ Initializes a new enumeration instance from its enum type and its value.
Method __ne__ Compares the instance for equality with an object.
Method __str__ Returns the nicely printable string representation of this instance.
Method is_also Whether or not the value corresponds to the passed member of the enumeration, possibly with other members also applied as bitwise-or.
Method is_exactly Whether or not the value corresponds exactly to the passed member of the enumeration.
Property type The type of this instance.
Property value The value of this instance.
Instance Variable _enumeration Undocumented
Instance Variable _value Undocumented
def __eq__(self, o):

Compares the instance for equality with an object.

  • if the object is of type str, int or Item, it will be considered equal to this instance if this instance self.is_exactly(o) is True.
  • two EnumerationInstances are considered equal if they have the same underlying Enumeration and value.
  • 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 EnumerationInstances at different contexts with the same type and value 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 EnumerationInstances coming from different addresses in memory or different registers can compare equal if they have the same type and value.
Parameters
o:objectUndocumented
Returns
boolUndocumented
def __hash__(self):

Returns the hash for this value.

Returns
intUndocumented
def __init__(self, enumeration, value):

Initializes a new enumeration instance from its enum type and its value.

Warnings

At the moment, this object is not meant to be constructed directly. Use FieldInstance.read instead.

Parameters
enumeration:_EnumerationUndocumented
value:intUndocumented
def __ne__(self, o):

Compares the instance for equality with an object.

  • if the object is of type str, int or Item, it will be considered equal to this instance if this instance self.is_exactly(o) is True.
  • two EnumerationInstances are considered equal if they have the same underlying Enumeration and value.
  • 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 EnumerationInstances at different contexts with the same type and value 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 EnumerationInstances coming from different addresses in memory or different registers can compare equal if they have the same type and value.
Parameters
o:objectUndocumented
Returns
boolUndocumented
def __str__(self):

Returns the nicely printable string representation of this instance.

Returns
strUndocumented
def is_also(self, item):

Whether or not the value corresponds to the passed member of the enumeration, possibly with other members also applied as bitwise-or.

Enumerations in C are often used as flags, this method allows to determine if a member of an enum flag is part of the value of this instance.

Parameters
item:_Union[str, int, _Item]Undocumented
Returns
boolUndocumented
def is_exactly(self, item):

Whether or not the value corresponds exactly to the passed member of the enumeration.

Parameters
item:_Union[str, int, _Item]Undocumented
Returns
boolUndocumented
@property
type: _Enumeration =

The type of this instance.

@property
value: int =

The value of this instance.

_enumeration =

Undocumented

_value =

Undocumented