Interface UnionBinder<T>

All Superinterfaces:
GroupBinder<UnionLayout, T>

public non-sealed interface UnionBinder<T> extends GroupBinder<UnionLayout, T>
The binder class for union interfaces.

Union binder implementations can be created using the builder returned by ffmUnion.

  • Method Details

    • set

      default UnionBinder<T> set(MemorySegment segment, T value)
      Description copied from interface: GroupBinder
      Sets the contents of the specified memory segment to the specified group value.
      Specified by:
      set in interface GroupBinder<UnionLayout, T>
      Parameters:
      segment - the memory segment
      value - the group instance
      Returns:
      this binder
    • set

      default UnionBinder<T> set(MemorySegment segment, long offset, T value)
      Description copied from interface: GroupBinder
      Sets the contents of the specified memory segment at the specified offset to the specified group value.
      Specified by:
      set in interface GroupBinder<UnionLayout, T>
      Parameters:
      segment - the memory segment
      offset - the memory offset
      value - the group instance
      Returns:
      this binder
    • setAtIndex

      default UnionBinder<T> setAtIndex(MemorySegment segment, long index, T value)
      Description copied from interface: GroupBinder
      Sets the contents of the specified memory segment at the specified index to the specified group value.
      Specified by:
      setAtIndex in interface GroupBinder<UnionLayout, T>
      Parameters:
      segment - the memory segment
      index - the element index
      value - the group instance
      Returns:
      this binder
    • apply

      default UnionBinder<T> apply(MemorySegment array, long offset, Consumer<T> consumer)
      Description copied from interface: GroupBinder
      Applies the specified consumer to the group instance mapped to the specified memory segment and offset.
      Specified by:
      apply in interface GroupBinder<UnionLayout, T>
      Parameters:
      array - the memory segment
      offset - the offset of the group instance
      consumer - the consumer to apply
      Returns:
      this binder
    • applyAtIndex

      default UnionBinder<T> applyAtIndex(MemorySegment segment, long index, Consumer<T> consumer)
      Description copied from interface: GroupBinder
      Applies the specified consumer to the group instance mapped to the specified memory segment and index.
      Specified by:
      applyAtIndex in interface GroupBinder<UnionLayout, T>
      Parameters:
      segment - the memory segment
      index - the index of the group instance
      consumer - the consumer to apply
      Returns:
      this binder
    • array

      default UnionArray<T> array(MemorySegment segment)
      Description copied from interface: GroupBinder
      Returns a group array mapped to the specified memory segment.
      Specified by:
      array in interface GroupBinder<UnionLayout, T>
      Parameters:
      segment - the memory segment
      Returns:
      the group array
    • array

      default UnionArray<T> array(MemorySegment segment, long index)
      Description copied from interface: GroupBinder
      Returns a group array mapped to the specified memory segment and starting at the specified index.
      Specified by:
      array in interface GroupBinder<UnionLayout, T>
      Parameters:
      segment - the memory segment
      index - the starting index
      Returns:
      the group array
    • array

      default UnionArray<T> array(MemorySegment segment, long index, long elementCount)
      Description copied from interface: GroupBinder
      Returns a group array mapped to the specified memory segment and starting at the specified index, with the specified element count.
      Specified by:
      array in interface GroupBinder<UnionLayout, T>
      Parameters:
      segment - the memory segment
      index - the starting index
      elementCount - the number of elements
      Returns:
      the group array
    • malloc

      default UnionArray<T> malloc(SegmentStack stack, long elementCount)
      Description copied from interface: GroupBinder
      Allocates a memory segment, without zero-initialization, for the specified number of group instances on the specified segment stack.
      Specified by:
      malloc in interface GroupBinder<UnionLayout, T>
      Parameters:
      stack - the segment stack
      elementCount - the number of elements
      Returns:
      the group array
    • allocate

      default UnionArray<T> allocate(SegmentStack stack, long elementCount)
      Description copied from interface: GroupBinder
      Allocates a memory segment, with zero-initialization, for the specified number of group instances on the specified segment stack.
      Specified by:
      allocate in interface GroupBinder<UnionLayout, T>
      Parameters:
      stack - the segment stack
      elementCount - the number of elements
      Returns:
      the group array
    • allocate

      default UnionArray<T> allocate(SegmentAllocator allocator, long elementCount)
      Description copied from interface: GroupBinder
      Allocates a memory segment for the specified number of group instances using the specified segment allocator.
      Specified by:
      allocate in interface GroupBinder<UnionLayout, T>
      Parameters:
      allocator - the segment allocator
      elementCount - the number of elements
      Returns:
      the group array