Interface Union

  • All Superinterfaces:
    Composite, DataType
    All Known Subinterfaces:
    UnionInternal
    All Known Implementing Classes:
    UnionDataType

    public interface Union
    extends Composite
    The union interface.

    NOTE: The use of bitfields within all unions assumes a default packing where bit allocation always starts with byte-0 of the union. Bit allocation order is dictated by data organization endianess (byte-0 msb allocated first for big-endian, while byte-0 lsb allocated first for little-endian).

    • Method Detail

      • clone

        Union clone​(DataTypeManager dtm)
        Description copied from interface: DataType
        Returns an instance of this DataType with its universalID and SourceArchive identity retained.

        The current instanceof will be returned if this datatype's DataTypeManager matches the specified dtm. The recursion depth of a clone will stop on any datatype whose DataTypeManager matches the specified dtm and simply use the existing datatype instance.

        Specified by:
        clone in interface DataType
        Parameters:
        dtm - the data-type manager instance whose data-organization should apply.
        Returns:
        cloned instance which may be the same as this instance
      • insertBitField

        DataTypeComponent insertBitField​(int ordinal,
                                         DataType baseDataType,
                                         int bitSize,
                                         java.lang.String componentName,
                                         java.lang.String comment)
                                  throws InvalidDataTypeException,
                                         java.lang.IndexOutOfBoundsException
        Inserts a new bitfield at the specified ordinal position in this union. For all Unions, bitfield starts with bit-0 (lsb) of the first byte for little-endian, and with bit-7 (msb) of the first byte for big-endian. This is the default behavior for most compilers. Insertion behavior may not work as expected if packing rules differ from this.
        Parameters:
        ordinal - the ordinal where the new datatype is to be inserted.
        baseDataType - the bitfield base datatype (certain restrictions apply).
        bitSize - the declared bitfield size in bits. The effective bit size may be adjusted based upon the specified baseDataType.
        componentName - the field name to associate with this component.
        comment - the comment to associate with this component.
        Returns:
        the bitfield component created whose associated data type will be BitFieldDataType.
        Throws:
        InvalidDataTypeException - if the specified baseDataType is not a valid base type for bitfields.
        java.lang.IndexOutOfBoundsException - if ordinal is less than 0 or greater than the current number of components.