Search Results for

    Show / Hide Table of Contents

    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.

    Inheritance
    object
    BinAttribute<T>
    BinAttributeEnum<T>
    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 Source

    BinAttributeEnum(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 Source

    bit_mask

    Declaration
    protected int bit_mask
    Field Value
    Type Description
    int

    Methods

    | Edit this page View Source

    GetCurrentValue()

    Returns the latest value.

    Declaration
    public override T GetCurrentValue()
    Returns
    Type Description
    T

    The value decoded from the int's latest value.

    Overrides
    BinAttribute<T>.GetCurrentValue()
    | Edit this page View Source

    GetValue()

    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
    BinAttribute<T>.GetValue()
    | Edit this page View Source

    SetValue(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.

    Overrides
    BinAttribute<T>.SetValue(T)
    • Edit this page
    • View Source
    In this article
    Back to top AmoebotSim 2.0 Documentation v1.11
    Copyright © 2025 AmoebotSim 2.0 Authors
    Generated by DocFX