
org.purejava.appindicator._GQueue Maven / Gradle / Ivy
// Generated by jextract
package org.purejava.appindicator;
import java.lang.foreign.*;
import java.util.function.Consumer;
import static java.lang.foreign.MemoryLayout.PathElement.groupElement;
import static java.lang.foreign.ValueLayout.OfInt;
/**
* {@snippet lang=c :
* struct _GQueue {
* GList *head;
* GList *tail;
* guint length;
* }
* }
*/
public class _GQueue {
_GQueue() {
// Should not be called directly
}
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
app_indicator_h.C_POINTER.withName("head"),
app_indicator_h.C_POINTER.withName("tail"),
app_indicator_h.C_INT.withName("length"),
MemoryLayout.paddingLayout(4)
).withName("_GQueue");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final AddressLayout head$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("head"));
/**
* Layout for field:
* {@snippet lang=c :
* GList *head
* }
*/
public static final AddressLayout head$layout() {
return head$LAYOUT;
}
private static final long head$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* GList *head
* }
*/
public static final long head$offset() {
return head$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* GList *head
* }
*/
public static MemorySegment head(MemorySegment struct) {
return struct.get(head$LAYOUT, head$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* GList *head
* }
*/
public static void head(MemorySegment struct, MemorySegment fieldValue) {
struct.set(head$LAYOUT, head$OFFSET, fieldValue);
}
private static final AddressLayout tail$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("tail"));
/**
* Layout for field:
* {@snippet lang=c :
* GList *tail
* }
*/
public static final AddressLayout tail$layout() {
return tail$LAYOUT;
}
private static final long tail$OFFSET = 8;
/**
* Offset for field:
* {@snippet lang=c :
* GList *tail
* }
*/
public static final long tail$offset() {
return tail$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* GList *tail
* }
*/
public static MemorySegment tail(MemorySegment struct) {
return struct.get(tail$LAYOUT, tail$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* GList *tail
* }
*/
public static void tail(MemorySegment struct, MemorySegment fieldValue) {
struct.set(tail$LAYOUT, tail$OFFSET, fieldValue);
}
private static final OfInt length$LAYOUT = (OfInt)$LAYOUT.select(groupElement("length"));
/**
* Layout for field:
* {@snippet lang=c :
* guint length
* }
*/
public static final OfInt length$layout() {
return length$LAYOUT;
}
private static final long length$OFFSET = 16;
/**
* Offset for field:
* {@snippet lang=c :
* guint length
* }
*/
public static final long length$offset() {
return length$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* guint length
* }
*/
public static int length(MemorySegment struct) {
return struct.get(length$LAYOUT, length$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* guint length
* }
*/
public static void length(MemorySegment struct, int fieldValue) {
struct.set(length$LAYOUT, length$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