Class BinAttributeEnum<T>
A binary encoded attribute for arbitrary enums. Make sure to
provide enough bits to encode the enum as an integer. Note that
the enum value represented by 0
will be the default value.
Namespace: AS2.Subroutines.BinStateHelpers
Assembly: .dll
Syntax
public class BinAttributeEnum<T> : BinAttribute<T> where T : Enum
Type Parameters
Name | Description |
---|---|
T |
Constructors
| Edit this page View SourceBinAttributeEnum(ParticleAttribute<int>, int, int)
Creates a new attribute wrapper referencing the given state attribute int.
Declaration
public BinAttributeEnum(ParticleAttribute<int> attr, int idx, int width)
Parameters
Type | Name | Description |
---|---|---|
ParticleAttribute<int> | attr | The attribute storing the integer that contains this value as a subset of bits. |
int | idx | The bit index at which the encoding of this value starts. |
int | width | The number of bits required to encode the enum value. |
Fields
| Edit this page View Sourcebit_mask
Declaration
protected int bit_mask
Field Value
Type | Description |
---|---|
int |
Methods
| Edit this page View SourceGetCurrentValue()
Returns the latest value.
Declaration
public override T GetCurrentValue()
Returns
Type | Description |
---|---|
T | The value decoded from the int's latest value. |
Overrides
| Edit this page View SourceGetValue()
Returns the value from the beginning of the current round.
Declaration
public override T GetValue()
Returns
Type | Description |
---|---|
T | The value decoded from the int's snapshot value. |
Overrides
| Edit this page View SourceSetValue(T)
Writes a new value to the state integer.
Declaration
public override void SetValue(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value | The new value to be written. |