org.purejava.appindicator.random_data Maven / Gradle / Ivy
// Generated by jextract
package org.purejava.appindicator;
import java.lang.invoke.*;
import java.lang.foreign.*;
import java.nio.ByteOrder;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;
import static java.lang.foreign.ValueLayout.*;
import static java.lang.foreign.MemoryLayout.PathElement.*;
/**
* {@snippet lang=c :
* struct random_data {
* int32_t *fptr;
* int32_t *rptr;
* int32_t *state;
* int rand_type;
* int rand_deg;
* int rand_sep;
* int32_t *end_ptr;
* }
* }
*/
public class random_data {
random_data() {
// Should not be called directly
}
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
app_indicator_h.C_POINTER.withName("fptr"),
app_indicator_h.C_POINTER.withName("rptr"),
app_indicator_h.C_POINTER.withName("state"),
app_indicator_h.C_INT.withName("rand_type"),
app_indicator_h.C_INT.withName("rand_deg"),
app_indicator_h.C_INT.withName("rand_sep"),
MemoryLayout.paddingLayout(4),
app_indicator_h.C_POINTER.withName("end_ptr")
).withName("random_data");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final AddressLayout fptr$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("fptr"));
/**
* Layout for field:
* {@snippet lang=c :
* int32_t *fptr
* }
*/
public static final AddressLayout fptr$layout() {
return fptr$LAYOUT;
}
private static final long fptr$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* int32_t *fptr
* }
*/
public static final long fptr$offset() {
return fptr$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int32_t *fptr
* }
*/
public static MemorySegment fptr(MemorySegment struct) {
return struct.get(fptr$LAYOUT, fptr$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* int32_t *fptr
* }
*/
public static void fptr(MemorySegment struct, MemorySegment fieldValue) {
struct.set(fptr$LAYOUT, fptr$OFFSET, fieldValue);
}
private static final AddressLayout rptr$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("rptr"));
/**
* Layout for field:
* {@snippet lang=c :
* int32_t *rptr
* }
*/
public static final AddressLayout rptr$layout() {
return rptr$LAYOUT;
}
private static final long rptr$OFFSET = 8;
/**
* Offset for field:
* {@snippet lang=c :
* int32_t *rptr
* }
*/
public static final long rptr$offset() {
return rptr$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int32_t *rptr
* }
*/
public static MemorySegment rptr(MemorySegment struct) {
return struct.get(rptr$LAYOUT, rptr$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* int32_t *rptr
* }
*/
public static void rptr(MemorySegment struct, MemorySegment fieldValue) {
struct.set(rptr$LAYOUT, rptr$OFFSET, fieldValue);
}
private static final AddressLayout state$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("state"));
/**
* Layout for field:
* {@snippet lang=c :
* int32_t *state
* }
*/
public static final AddressLayout state$layout() {
return state$LAYOUT;
}
private static final long state$OFFSET = 16;
/**
* Offset for field:
* {@snippet lang=c :
* int32_t *state
* }
*/
public static final long state$offset() {
return state$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int32_t *state
* }
*/
public static MemorySegment state(MemorySegment struct) {
return struct.get(state$LAYOUT, state$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* int32_t *state
* }
*/
public static void state(MemorySegment struct, MemorySegment fieldValue) {
struct.set(state$LAYOUT, state$OFFSET, fieldValue);
}
private static final OfInt rand_type$LAYOUT = (OfInt)$LAYOUT.select(groupElement("rand_type"));
/**
* Layout for field:
* {@snippet lang=c :
* int rand_type
* }
*/
public static final OfInt rand_type$layout() {
return rand_type$LAYOUT;
}
private static final long rand_type$OFFSET = 24;
/**
* Offset for field:
* {@snippet lang=c :
* int rand_type
* }
*/
public static final long rand_type$offset() {
return rand_type$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int rand_type
* }
*/
public static int rand_type(MemorySegment struct) {
return struct.get(rand_type$LAYOUT, rand_type$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* int rand_type
* }
*/
public static void rand_type(MemorySegment struct, int fieldValue) {
struct.set(rand_type$LAYOUT, rand_type$OFFSET, fieldValue);
}
private static final OfInt rand_deg$LAYOUT = (OfInt)$LAYOUT.select(groupElement("rand_deg"));
/**
* Layout for field:
* {@snippet lang=c :
* int rand_deg
* }
*/
public static final OfInt rand_deg$layout() {
return rand_deg$LAYOUT;
}
private static final long rand_deg$OFFSET = 28;
/**
* Offset for field:
* {@snippet lang=c :
* int rand_deg
* }
*/
public static final long rand_deg$offset() {
return rand_deg$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int rand_deg
* }
*/
public static int rand_deg(MemorySegment struct) {
return struct.get(rand_deg$LAYOUT, rand_deg$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* int rand_deg
* }
*/
public static void rand_deg(MemorySegment struct, int fieldValue) {
struct.set(rand_deg$LAYOUT, rand_deg$OFFSET, fieldValue);
}
private static final OfInt rand_sep$LAYOUT = (OfInt)$LAYOUT.select(groupElement("rand_sep"));
/**
* Layout for field:
* {@snippet lang=c :
* int rand_sep
* }
*/
public static final OfInt rand_sep$layout() {
return rand_sep$LAYOUT;
}
private static final long rand_sep$OFFSET = 32;
/**
* Offset for field:
* {@snippet lang=c :
* int rand_sep
* }
*/
public static final long rand_sep$offset() {
return rand_sep$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int rand_sep
* }
*/
public static int rand_sep(MemorySegment struct) {
return struct.get(rand_sep$LAYOUT, rand_sep$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* int rand_sep
* }
*/
public static void rand_sep(MemorySegment struct, int fieldValue) {
struct.set(rand_sep$LAYOUT, rand_sep$OFFSET, fieldValue);
}
private static final AddressLayout end_ptr$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("end_ptr"));
/**
* Layout for field:
* {@snippet lang=c :
* int32_t *end_ptr
* }
*/
public static final AddressLayout end_ptr$layout() {
return end_ptr$LAYOUT;
}
private static final long end_ptr$OFFSET = 40;
/**
* Offset for field:
* {@snippet lang=c :
* int32_t *end_ptr
* }
*/
public static final long end_ptr$offset() {
return end_ptr$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int32_t *end_ptr
* }
*/
public static MemorySegment end_ptr(MemorySegment struct) {
return struct.get(end_ptr$LAYOUT, end_ptr$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* int32_t *end_ptr
* }
*/
public static void end_ptr(MemorySegment struct, MemorySegment fieldValue) {
struct.set(end_ptr$LAYOUT, end_ptr$OFFSET, fieldValue);
}
/**
* Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
* The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
*/
public static MemorySegment asSlice(MemorySegment array, long index) {
return array.asSlice(layout().byteSize() * index);
}
/**
* The size (in bytes) of this struct
*/
public static long sizeof() { return layout().byteSize(); }
/**
* Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
*/
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate(layout());
}
/**
* Allocate an array of size {@code elementCount} using {@code allocator}.
* The returned segment has size {@code elementCount * layout().byteSize()}.
*/
public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction) (if any).
* The returned segment has size {@code layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) {
return reinterpret(addr, 1, arena, cleanup);
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction) (if any).
* The returned segment has size {@code elementCount * layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) {
return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy