Interface StructBinder<T>
- All Superinterfaces:
GroupBinder<StructLayout, T>
The binder class for struct interfaces.
Struct binder implementations can be created using the builder returned by ffmStruct.
-
Method Summary
Modifier and TypeMethodDescriptiondefault StructArray<T> allocate(SegmentAllocator allocator, long elementCount) Allocates a memory segment for the specified number of group instances using the specified segment allocator.default StructArray<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 StructBinder<T> apply(MemorySegment array, long offset, Consumer<T> consumer) Applies the specified consumer to the group instance mapped to the specified memory segment and offset.default StructBinder<T> applyAtIndex(MemorySegment segment, long index, Consumer<T> consumer) Applies the specified consumer to the group instance mapped to the specified memory segment and index.default StructArray<T> array(MemorySegment segment) Returns a group array mapped to the specified memory segment.default StructArray<T> array(MemorySegment segment, long index) Returns a group array mapped to the specified memory segment and starting at the specified index.default StructArray<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 StructArray<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 StructBinder<T> set(MemorySegment segment, long offset, T value) Sets the contents of the specified memory segment at the specified offset to the specified group value.default StructBinder<T> set(MemorySegment segment, T value) Sets the contents of the specified memory segment to the specified group value.default StructBinder<T> setAtIndex(MemorySegment segment, long index, T value) Sets the contents of the specified memory segment at the specified index to the specified group value.Methods inherited from interface GroupBinder
addressOf, addressOfSafe, alignof, allocate, allocate, allocateSegment, allocateSegment, allocateSegment, allocateSegment, asSegment, asSlice, asSlice, clear, copy, forEach, get, get, getAtIndex, iterable, iterator, layout, malloc, mallocSegment, mallocSegment, ofAddress, ofAddressSafe, parallelStream, reinterpret, reinterpret, reinterpret, reinterpret, sizeof, spliterator, stream
-
Method Details
-
set
Description copied from interface:GroupBinderSets the contents of the specified memory segment to the specified group value.- Specified by:
setin interfaceGroupBinder<StructLayout, T>- Parameters:
segment- the memory segmentvalue- the group instance- Returns:
- this binder
-
set
Description copied from interface:GroupBinderSets the contents of the specified memory segment at the specified offset to the specified group value.- Specified by:
setin interfaceGroupBinder<StructLayout, T>- Parameters:
segment- the memory segmentoffset- the memory offsetvalue- the group instance- Returns:
- this binder
-
setAtIndex
Description copied from interface:GroupBinderSets the contents of the specified memory segment at the specified index to the specified group value.- Specified by:
setAtIndexin interfaceGroupBinder<StructLayout, T>- Parameters:
segment- the memory segmentindex- the element indexvalue- the group instance- Returns:
- this binder
-
apply
Description copied from interface:GroupBinderApplies the specified consumer to the group instance mapped to the specified memory segment and offset.- Specified by:
applyin interfaceGroupBinder<StructLayout, T>- Parameters:
array- the memory segmentoffset- the offset of the group instanceconsumer- the consumer to apply- Returns:
- this binder
-
applyAtIndex
Description copied from interface:GroupBinderApplies the specified consumer to the group instance mapped to the specified memory segment and index.- Specified by:
applyAtIndexin interfaceGroupBinder<StructLayout, T>- Parameters:
segment- the memory segmentindex- the index of the group instanceconsumer- the consumer to apply- Returns:
- this binder
-
array
Description copied from interface:GroupBinderReturns a group array mapped to the specified memory segment.- Specified by:
arrayin interfaceGroupBinder<StructLayout, T>- Parameters:
segment- the memory segment- Returns:
- the group array
-
array
Description copied from interface:GroupBinderReturns a group array mapped to the specified memory segment and starting at the specified index.- Specified by:
arrayin interfaceGroupBinder<StructLayout, T>- Parameters:
segment- the memory segmentindex- the starting index- Returns:
- the group array
-
array
Description copied from interface:GroupBinderReturns a group array mapped to the specified memory segment and starting at the specified index, with the specified element count.- Specified by:
arrayin interfaceGroupBinder<StructLayout, T>- Parameters:
segment- the memory segmentindex- the starting indexelementCount- the number of elements- Returns:
- the group array
-
malloc
Description copied from interface:GroupBinderAllocates a memory segment, without zero-initialization, for the specified number of group instances on the specified segment stack.- Specified by:
mallocin interfaceGroupBinder<StructLayout, T>- Parameters:
stack- the segment stackelementCount- the number of elements- Returns:
- the group array
-
allocate
Description copied from interface:GroupBinderAllocates a memory segment, with zero-initialization, for the specified number of group instances on the specified segment stack.- Specified by:
allocatein interfaceGroupBinder<StructLayout, T>- Parameters:
stack- the segment stackelementCount- the number of elements- Returns:
- the group array
-
allocate
Description copied from interface:GroupBinderAllocates a memory segment for the specified number of group instances using the specified segment allocator.- Specified by:
allocatein interfaceGroupBinder<StructLayout, T>- Parameters:
allocator- the segment allocatorelementCount- the number of elements- Returns:
- the group array
-