Interface GroupBinder<L extends GroupLayout, T>
- All Known Subinterfaces:
StructBinder<T>, UnionBinder<T>
public sealed interface GroupBinder<L extends GroupLayout, T>
permits StructBinder<T>, UnionBinder<T>
The base binder class for struct and union interfaces.
Group binder implementations can be created using the builders returned by ffmStruct and ffmUnion.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionlongReturns the memory address of the specified group instance.default longaddressOfSafe(@Nullable T value) Returns the memory address of the specified group instance, orNULLif the instance isnull.default longalignof()Returns the alignment of the group type, in bytes.default Tallocate(SegmentAllocator allocator) Allocates a memory segment for a single group instance using the specified segment allocator.GroupArray<L, T> allocate(SegmentAllocator allocator, long elementCount) Allocates a memory segment for the specified number of group instances using the specified segment allocator.default Tallocate(SegmentStack stack) Allocates a memory segment, without zero-initialization, for a single group instance using the specified segment allocator.GroupArray<L, T> allocate(SegmentStack stack, long elementCount) Allocates a memory segment, with zero-initialization, for the specified number of group instances on the specified segment stack.default MemorySegmentallocateSegment(SegmentAllocator allocator) Allocates a memory segment for a single group instance using the specified segment allocator.default MemorySegmentallocateSegment(SegmentAllocator allocator, long elementCount) Allocates a memory segment for the specified number of group instances using the specified segment allocator.default MemorySegmentallocateSegment(SegmentStack stack) Allocates a memory segment, with zero-initialization, for a single group instance on the specified segment stack.default MemorySegmentallocateSegment(SegmentStack stack, long elementCount) Allocates a memory segment, with zero-initialization, for the specified number of group instances on the specified segment stack.apply(MemorySegment array, long offset, Consumer<T> consumer) Applies the specified consumer to the group instance mapped to the specified memory segment and offset.applyAtIndex(MemorySegment segment, long index, Consumer<T> consumer) Applies the specified consumer to the group instance mapped to the specified memory segment and index.GroupArray<L, T> array(MemorySegment segment) Returns a group array mapped to the specified memory segment.GroupArray<L, T> array(MemorySegment segment, long index) Returns a group array mapped to the specified memory segment and starting at the specified index.GroupArray<L, T> array(MemorySegment segment, long index, long elementCount) Returns a group array mapped to the specified memory segment and starting at the specified index, with the specified element count.default MemorySegmentReturns a memory segment view of the specified group instance.default MemorySegmentasSlice(MemorySegment segment, long index) Returns a slice of the specified memory segment at the specified index.default MemorySegmentasSlice(MemorySegment segment, long index, long elementCount) Returns a slice of the specified memory segment at the specified index and element count.static ObjectbootstrapRecord(MethodHandles.Lookup lookup, String methodName, TypeDescriptor type, String names, String... getterNames) Bootstrap method to generate theObject.equals(Object),Object.hashCode(), andObject.toString()methods in group types, with the same semantics as the corresponding methods inRecordtypes.Clears the contents of the specified group instance.Copies the contents of the source group to the destination group.default voidforEach(MemorySegment segment, Consumer<? super T> action) Performs the given action for each group instance in the specified memory segment.get(MemorySegment segment) Returns a group instance mapped to the specified memory segment.get(MemorySegment segment, long offset) Returns a group instance mapped to the specified memory segment and offset.getAtIndex(MemorySegment segment, long index) Returns a group instance mapped to the specified memory segment and index.iterable(MemorySegment segment) Returns anIterableover the group instances in the specified memory segment.iterator(MemorySegment segment) Returns anIteratorover the group instances in the specified memory segment.layout()Returns the memory layout of the group type.default Tmalloc(SegmentStack stack) Allocates a memory segment, without zero-initialization, for a single group instance on the specified segment stack.GroupArray<L, T> malloc(SegmentStack stack, long elementCount) Allocates a memory segment, without zero-initialization, for the specified number of group instances on the specified segment stack.default MemorySegmentmallocSegment(SegmentStack stack) Allocates a memory segment, without zero-initialization, for a single group instance on the specified segment stack.default MemorySegmentmallocSegment(SegmentStack stack, long elementCount) Allocates a memory segment, without zero-initialization, for the specified number of group instances on the specified segment stack.ofAddress(long address) Creates a group instance at the specified memory address.default @Nullable TofAddressSafe(long address) Returns a group instance at the specified memory address, ornullif the address isNULL.parallelStream(MemorySegment segment) Returns a parallelStreamover the group instances in the specified memory segment.default MemorySegmentreinterpret(MemorySegment addr) Reinterprets the specified memory segment to the size of the group type.default MemorySegmentreinterpret(MemorySegment addr, long elementCount) Reinterprets the specified memory segment to the size of the group type multiplied by the specified element count.default MemorySegmentreinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer<MemorySegment> cleanup) Reinterprets the specified memory segment to the size of the group type multiplied by the specified element count, using the specified arena and cleanupdefault MemorySegmentreinterpret(MemorySegment addr, Arena arena, Consumer<MemorySegment> cleanup) Reinterprets the specified memory segment to the size of the group type, using the specified arena and cleanup action.set(MemorySegment segment, long offset, T value) Sets the contents of the specified memory segment at the specified offset to the specified group value.set(MemorySegment segment, T value) Sets the contents of the specified memory segment to the specified group value.setAtIndex(MemorySegment segment, long index, T value) Sets the contents of the specified memory segment at the specified index to the specified group value.default longsizeof()Returns the size of the group type, in bytes.default Spliterator<T> spliterator(MemorySegment segment) Returns aSpliteratorover the group instances in the specified memory segment.stream(MemorySegment segment) Returns a sequentialStreamover the group instances in the specified memory segment.
-
Method Details
-
layout
-
ofAddress
Creates a group instance at the specified memory address.- Parameters:
address- the memory address- Returns:
- the group instance
-
addressOf
Returns the memory address of the specified group instance.- Parameters:
value- the group instance- Returns:
- the memory address
-
copy
-
clear
-
get
Returns a group instance mapped to the specified memory segment.- Parameters:
segment- the memory segment- Returns:
- the group instance
-
get
Returns a group instance mapped to the specified memory segment and offset.- Parameters:
segment- the memory segmentoffset- the memory offset- Returns:
- the group instance
-
getAtIndex
Returns a group instance mapped to the specified memory segment and index.- Parameters:
segment- the memory segmentindex- the element index- Returns:
- the group instance
-
sizeof
default long sizeof()Returns the size of the group type, in bytes.- Returns:
- the size
-
alignof
default long alignof()Returns the alignment of the group type, in bytes.- Returns:
- the alignment
-
ofAddressSafe
Returns a group instance at the specified memory address, ornullif the address isNULL.- Parameters:
address- the memory address- Returns:
- the group instance, or
nullif the address isNULL
-
addressOfSafe
Returns the memory address of the specified group instance, orNULLif the instance isnull.- Parameters:
value- the group instance- Returns:
- the memory address, or
NULLif the instance isnull
-
set
Sets the contents of the specified memory segment to the specified group value.- Parameters:
segment- the memory segmentvalue- the group instance- Returns:
- this binder
-
set
Sets the contents of the specified memory segment at the specified offset to the specified group value.- Parameters:
segment- the memory segmentoffset- the memory offsetvalue- the group instance- Returns:
- this binder
-
setAtIndex
Sets the contents of the specified memory segment at the specified index to the specified group value.- Parameters:
segment- the memory segmentindex- the element indexvalue- the group instance- Returns:
- this binder
-
array
Returns a group array mapped to the specified memory segment.- Parameters:
segment- the memory segment- Returns:
- the group array
-
array
Returns a group array mapped to the specified memory segment and starting at the specified index.- Parameters:
segment- the memory segmentindex- the starting index- Returns:
- the group array
-
array
Returns a group array mapped to the specified memory segment and starting at the specified index, with the specified element count.- Parameters:
segment- the memory segmentindex- the starting indexelementCount- the number of elements- Returns:
- the group array
-
asSegment
Returns a memory segment view of the specified group instance.- Parameters:
value- the group instance- Returns:
- the memory segment
-
malloc
Allocates a memory segment, without zero-initialization, for a single group instance on the specified segment stack.- Parameters:
stack- the segment stack- Returns:
- the group instancen
-
malloc
Allocates a memory segment, without zero-initialization, for the specified number of group instances on the specified segment stack.- Parameters:
stack- the segment stackelementCount- the number of elements- Returns:
- the group array
-
allocate
Allocates a memory segment, without zero-initialization, for a single group instance using the specified segment allocator.- Parameters:
stack- the segment allocator- Returns:
- the group instance
-
allocate
Allocates a memory segment for a single group instance using the specified segment allocator.- Parameters:
allocator- the segment allocator- Returns:
- the group instance
-
allocate
Allocates a memory segment, with zero-initialization, for the specified number of group instances on the specified segment stack.- Parameters:
stack- the segment stackelementCount- the number of elements- Returns:
- the group array
-
allocate
Allocates a memory segment for the specified number of group instances using the specified segment allocator.- Parameters:
allocator- the segment allocatorelementCount- the number of elements- Returns:
- the group array
-
mallocSegment
Allocates a memory segment, without zero-initialization, for a single group instance on the specified segment stack.- Parameters:
stack- the segment stack- Returns:
- the memory segment
-
mallocSegment
Allocates a memory segment, without zero-initialization, for the specified number of group instances on the specified segment stack.- Parameters:
stack- the segment stackelementCount- the number of elements- Returns:
- the memory segment
-
allocateSegment
Allocates a memory segment, with zero-initialization, for a single group instance on the specified segment stack.- Parameters:
stack- the segment stack- Returns:
- the memory segment
-
allocateSegment
Allocates a memory segment for a single group instance using the specified segment allocator.- Parameters:
allocator- the segment allocator- Returns:
- the memory segment
-
allocateSegment
Allocates a memory segment, with zero-initialization, for the specified number of group instances on the specified segment stack.- Parameters:
stack- the segment stackelementCount- the number of elements- Returns:
- the memory segment
-
allocateSegment
Allocates a memory segment for the specified number of group instances using the specified segment allocator.- Parameters:
allocator- the segment allocatorelementCount- the number of elements- Returns:
- the memory segment
-
apply
Applies the specified consumer to the group instance mapped to the specified memory segment and offset.- Parameters:
array- the memory segmentoffset- the offset of the group instanceconsumer- the consumer to apply- Returns:
- this binder
-
applyAtIndex
Applies the specified consumer to the group instance mapped to the specified memory segment and index.- Parameters:
segment- the memory segmentindex- the index of the group instanceconsumer- the consumer to apply- Returns:
- this binder
-
forEach
Performs the given action for each group instance in the specified memory segment.- Parameters:
segment- the memory segmentaction- the action to perform
-
iterable
Returns anIterableover the group instances in the specified memory segment.- Parameters:
segment- the memory segment- Returns:
- an iterable over the group instances
-
iterator
Returns anIteratorover the group instances in the specified memory segment.- Parameters:
segment- the memory segment- Returns:
- an iterator over the group instances
-
spliterator
Returns aSpliteratorover the group instances in the specified memory segment.- Parameters:
segment- the memory segment- Returns:
- a spliterator over the group instances
-
stream
Returns a sequentialStreamover the group instances in the specified memory segment.- Parameters:
segment- the memory segment- Returns:
- a sequential stream over the group instances
-
parallelStream
Returns a parallelStreamover the group instances in the specified memory segment.- Parameters:
segment- the memory segment- Returns:
- a parallel stream over the group instances
-
asSlice
Returns a slice of the specified memory segment at the specified index.- Parameters:
segment- the memory segmentindex- the index of the group instance- Returns:
- a slice of the memory segment
-
asSlice
Returns a slice of the specified memory segment at the specified index and element count.- Parameters:
segment- the memory segmentindex- the index of the group instanceelementCount- the number of elements in the group- Returns:
- a slice of the memory segment
-
reinterpret
Reinterprets the specified memory segment to the size of the group type.- Parameters:
addr- the memory segment to reinterpret- Returns:
- a new memory segment with the reinterpreted size
-
reinterpret
Reinterprets the specified memory segment to the size of the group type multiplied by the specified element count.- Parameters:
addr- the memory segment to reinterpretelementCount- the number of elements in the group- Returns:
- a new memory segment with the reinterpreted size
-
reinterpret
Reinterprets the specified memory segment to the size of the group type, using the specified arena and cleanup action.- Parameters:
addr- the memory segment to reinterpretarena- the arena to usecleanup- the cleanup action- Returns:
- a new memory segment with the reinterpreted size
-
reinterpret
default MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer<MemorySegment> cleanup) Reinterprets the specified memory segment to the size of the group type multiplied by the specified element count, using the specified arena and cleanup- Parameters:
addr- the memory segment to reinterpretelementCount- the number of elements in the grouparena- the arena to usecleanup- the cleanup action- Returns:
- a new memory segment with the reinterpreted sizen
-
bootstrapRecord
static Object bootstrapRecord(MethodHandles.Lookup lookup, String methodName, TypeDescriptor type, String names, String... getterNames) throws Throwable Bootstrap method to generate theObject.equals(Object),Object.hashCode(), andObject.toString()methods in group types, with the same semantics as the corresponding methods inRecordtypes. [INTERNAL API]- Throws:
Throwable
-