All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dds.DDSInfo Maven / Gradle / Ivy

The newest version!
// Generated by jextract

package dds;

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 DDSInfo {
 *     int major;
 *     int minor;
 *     int patch;
 *     char versionString[10];
 *     int system;
 *     int numBits;
 *     int compiler;
 *     int constructor;
 *     int numCores;
 *     int threading;
 *     int noOfThreads;
 *     char threadSizes[128];
 *     char systemString[1024];
 * }
 * }
 */
public class DDSInfo {

    DDSInfo() {
        // Should not be called directly
    }

    private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
        Dds.C_INT.withName("major"),
        Dds.C_INT.withName("minor"),
        Dds.C_INT.withName("patch"),
        MemoryLayout.sequenceLayout(10, Dds.C_CHAR).withName("versionString"),
        MemoryLayout.paddingLayout(2),
        Dds.C_INT.withName("system"),
        Dds.C_INT.withName("numBits"),
        Dds.C_INT.withName("compiler"),
        Dds.C_INT.withName("constructor"),
        Dds.C_INT.withName("numCores"),
        Dds.C_INT.withName("threading"),
        Dds.C_INT.withName("noOfThreads"),
        MemoryLayout.sequenceLayout(128, Dds.C_CHAR).withName("threadSizes"),
        MemoryLayout.sequenceLayout(1024, Dds.C_CHAR).withName("systemString")
    ).withName("DDSInfo");

    /**
     * The layout of this struct
     */
    public static final GroupLayout layout() {
        return $LAYOUT;
    }

    private static final OfInt major$LAYOUT = (OfInt)$LAYOUT.select(groupElement("major"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * int major
     * }
     */
    public static final OfInt major$layout() {
        return major$LAYOUT;
    }

    private static final long major$OFFSET = 0;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * int major
     * }
     */
    public static final long major$offset() {
        return major$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * int major
     * }
     */
    public static int major(MemorySegment struct) {
        return struct.get(major$LAYOUT, major$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * int major
     * }
     */
    public static void major(MemorySegment struct, int fieldValue) {
        struct.set(major$LAYOUT, major$OFFSET, fieldValue);
    }

    private static final OfInt minor$LAYOUT = (OfInt)$LAYOUT.select(groupElement("minor"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * int minor
     * }
     */
    public static final OfInt minor$layout() {
        return minor$LAYOUT;
    }

    private static final long minor$OFFSET = 4;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * int minor
     * }
     */
    public static final long minor$offset() {
        return minor$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * int minor
     * }
     */
    public static int minor(MemorySegment struct) {
        return struct.get(minor$LAYOUT, minor$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * int minor
     * }
     */
    public static void minor(MemorySegment struct, int fieldValue) {
        struct.set(minor$LAYOUT, minor$OFFSET, fieldValue);
    }

    private static final OfInt patch$LAYOUT = (OfInt)$LAYOUT.select(groupElement("patch"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * int patch
     * }
     */
    public static final OfInt patch$layout() {
        return patch$LAYOUT;
    }

    private static final long patch$OFFSET = 8;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * int patch
     * }
     */
    public static final long patch$offset() {
        return patch$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * int patch
     * }
     */
    public static int patch(MemorySegment struct) {
        return struct.get(patch$LAYOUT, patch$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * int patch
     * }
     */
    public static void patch(MemorySegment struct, int fieldValue) {
        struct.set(patch$LAYOUT, patch$OFFSET, fieldValue);
    }

    private static final SequenceLayout versionString$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("versionString"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * char versionString[10]
     * }
     */
    public static final SequenceLayout versionString$layout() {
        return versionString$LAYOUT;
    }

    private static final long versionString$OFFSET = 12;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * char versionString[10]
     * }
     */
    public static final long versionString$offset() {
        return versionString$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * char versionString[10]
     * }
     */
    public static MemorySegment versionString(MemorySegment struct) {
        return struct.asSlice(versionString$OFFSET, versionString$LAYOUT.byteSize());
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * char versionString[10]
     * }
     */
    public static void versionString(MemorySegment struct, MemorySegment fieldValue) {
        MemorySegment.copy(fieldValue, 0L, struct, versionString$OFFSET, versionString$LAYOUT.byteSize());
    }

    private static long[] versionString$DIMS = { 10 };

    /**
     * Dimensions for array field:
     * {@snippet lang=c :
     * char versionString[10]
     * }
     */
    public static long[] versionString$dimensions() {
        return versionString$DIMS;
    }
    private static final VarHandle versionString$ELEM_HANDLE = versionString$LAYOUT.varHandle(sequenceElement());

    /**
     * Indexed getter for field:
     * {@snippet lang=c :
     * char versionString[10]
     * }
     */
    public static byte versionString(MemorySegment struct, long index0) {
        return (byte)versionString$ELEM_HANDLE.get(struct, 0L, index0);
    }

    /**
     * Indexed setter for field:
     * {@snippet lang=c :
     * char versionString[10]
     * }
     */
    public static void versionString(MemorySegment struct, long index0, byte fieldValue) {
        versionString$ELEM_HANDLE.set(struct, 0L, index0, fieldValue);
    }

    private static final OfInt system$LAYOUT = (OfInt)$LAYOUT.select(groupElement("system"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * int system
     * }
     */
    public static final OfInt system$layout() {
        return system$LAYOUT;
    }

    private static final long system$OFFSET = 24;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * int system
     * }
     */
    public static final long system$offset() {
        return system$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * int system
     * }
     */
    public static int system(MemorySegment struct) {
        return struct.get(system$LAYOUT, system$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * int system
     * }
     */
    public static void system(MemorySegment struct, int fieldValue) {
        struct.set(system$LAYOUT, system$OFFSET, fieldValue);
    }

    private static final OfInt numBits$LAYOUT = (OfInt)$LAYOUT.select(groupElement("numBits"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * int numBits
     * }
     */
    public static final OfInt numBits$layout() {
        return numBits$LAYOUT;
    }

    private static final long numBits$OFFSET = 28;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * int numBits
     * }
     */
    public static final long numBits$offset() {
        return numBits$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * int numBits
     * }
     */
    public static int numBits(MemorySegment struct) {
        return struct.get(numBits$LAYOUT, numBits$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * int numBits
     * }
     */
    public static void numBits(MemorySegment struct, int fieldValue) {
        struct.set(numBits$LAYOUT, numBits$OFFSET, fieldValue);
    }

    private static final OfInt compiler$LAYOUT = (OfInt)$LAYOUT.select(groupElement("compiler"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * int compiler
     * }
     */
    public static final OfInt compiler$layout() {
        return compiler$LAYOUT;
    }

    private static final long compiler$OFFSET = 32;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * int compiler
     * }
     */
    public static final long compiler$offset() {
        return compiler$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * int compiler
     * }
     */
    public static int compiler(MemorySegment struct) {
        return struct.get(compiler$LAYOUT, compiler$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * int compiler
     * }
     */
    public static void compiler(MemorySegment struct, int fieldValue) {
        struct.set(compiler$LAYOUT, compiler$OFFSET, fieldValue);
    }

    private static final OfInt constructor$LAYOUT = (OfInt)$LAYOUT.select(groupElement("constructor"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * int constructor
     * }
     */
    public static final OfInt constructor$layout() {
        return constructor$LAYOUT;
    }

    private static final long constructor$OFFSET = 36;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * int constructor
     * }
     */
    public static final long constructor$offset() {
        return constructor$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * int constructor
     * }
     */
    public static int constructor(MemorySegment struct) {
        return struct.get(constructor$LAYOUT, constructor$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * int constructor
     * }
     */
    public static void constructor(MemorySegment struct, int fieldValue) {
        struct.set(constructor$LAYOUT, constructor$OFFSET, fieldValue);
    }

    private static final OfInt numCores$LAYOUT = (OfInt)$LAYOUT.select(groupElement("numCores"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * int numCores
     * }
     */
    public static final OfInt numCores$layout() {
        return numCores$LAYOUT;
    }

    private static final long numCores$OFFSET = 40;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * int numCores
     * }
     */
    public static final long numCores$offset() {
        return numCores$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * int numCores
     * }
     */
    public static int numCores(MemorySegment struct) {
        return struct.get(numCores$LAYOUT, numCores$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * int numCores
     * }
     */
    public static void numCores(MemorySegment struct, int fieldValue) {
        struct.set(numCores$LAYOUT, numCores$OFFSET, fieldValue);
    }

    private static final OfInt threading$LAYOUT = (OfInt)$LAYOUT.select(groupElement("threading"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * int threading
     * }
     */
    public static final OfInt threading$layout() {
        return threading$LAYOUT;
    }

    private static final long threading$OFFSET = 44;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * int threading
     * }
     */
    public static final long threading$offset() {
        return threading$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * int threading
     * }
     */
    public static int threading(MemorySegment struct) {
        return struct.get(threading$LAYOUT, threading$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * int threading
     * }
     */
    public static void threading(MemorySegment struct, int fieldValue) {
        struct.set(threading$LAYOUT, threading$OFFSET, fieldValue);
    }

    private static final OfInt noOfThreads$LAYOUT = (OfInt)$LAYOUT.select(groupElement("noOfThreads"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * int noOfThreads
     * }
     */
    public static final OfInt noOfThreads$layout() {
        return noOfThreads$LAYOUT;
    }

    private static final long noOfThreads$OFFSET = 48;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * int noOfThreads
     * }
     */
    public static final long noOfThreads$offset() {
        return noOfThreads$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * int noOfThreads
     * }
     */
    public static int noOfThreads(MemorySegment struct) {
        return struct.get(noOfThreads$LAYOUT, noOfThreads$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * int noOfThreads
     * }
     */
    public static void noOfThreads(MemorySegment struct, int fieldValue) {
        struct.set(noOfThreads$LAYOUT, noOfThreads$OFFSET, fieldValue);
    }

    private static final SequenceLayout threadSizes$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("threadSizes"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * char threadSizes[128]
     * }
     */
    public static final SequenceLayout threadSizes$layout() {
        return threadSizes$LAYOUT;
    }

    private static final long threadSizes$OFFSET = 52;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * char threadSizes[128]
     * }
     */
    public static final long threadSizes$offset() {
        return threadSizes$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * char threadSizes[128]
     * }
     */
    public static MemorySegment threadSizes(MemorySegment struct) {
        return struct.asSlice(threadSizes$OFFSET, threadSizes$LAYOUT.byteSize());
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * char threadSizes[128]
     * }
     */
    public static void threadSizes(MemorySegment struct, MemorySegment fieldValue) {
        MemorySegment.copy(fieldValue, 0L, struct, threadSizes$OFFSET, threadSizes$LAYOUT.byteSize());
    }

    private static long[] threadSizes$DIMS = { 128 };

    /**
     * Dimensions for array field:
     * {@snippet lang=c :
     * char threadSizes[128]
     * }
     */
    public static long[] threadSizes$dimensions() {
        return threadSizes$DIMS;
    }
    private static final VarHandle threadSizes$ELEM_HANDLE = threadSizes$LAYOUT.varHandle(sequenceElement());

    /**
     * Indexed getter for field:
     * {@snippet lang=c :
     * char threadSizes[128]
     * }
     */
    public static byte threadSizes(MemorySegment struct, long index0) {
        return (byte)threadSizes$ELEM_HANDLE.get(struct, 0L, index0);
    }

    /**
     * Indexed setter for field:
     * {@snippet lang=c :
     * char threadSizes[128]
     * }
     */
    public static void threadSizes(MemorySegment struct, long index0, byte fieldValue) {
        threadSizes$ELEM_HANDLE.set(struct, 0L, index0, fieldValue);
    }

    private static final SequenceLayout systemString$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("systemString"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * char systemString[1024]
     * }
     */
    public static final SequenceLayout systemString$layout() {
        return systemString$LAYOUT;
    }

    private static final long systemString$OFFSET = 180;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * char systemString[1024]
     * }
     */
    public static final long systemString$offset() {
        return systemString$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * char systemString[1024]
     * }
     */
    public static MemorySegment systemString(MemorySegment struct) {
        return struct.asSlice(systemString$OFFSET, systemString$LAYOUT.byteSize());
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * char systemString[1024]
     * }
     */
    public static void systemString(MemorySegment struct, MemorySegment fieldValue) {
        MemorySegment.copy(fieldValue, 0L, struct, systemString$OFFSET, systemString$LAYOUT.byteSize());
    }

    private static long[] systemString$DIMS = { 1024 };

    /**
     * Dimensions for array field:
     * {@snippet lang=c :
     * char systemString[1024]
     * }
     */
    public static long[] systemString$dimensions() {
        return systemString$DIMS;
    }
    private static final VarHandle systemString$ELEM_HANDLE = systemString$LAYOUT.varHandle(sequenceElement());

    /**
     * Indexed getter for field:
     * {@snippet lang=c :
     * char systemString[1024]
     * }
     */
    public static byte systemString(MemorySegment struct, long index0) {
        return (byte)systemString$ELEM_HANDLE.get(struct, 0L, index0);
    }

    /**
     * Indexed setter for field:
     * {@snippet lang=c :
     * char systemString[1024]
     * }
     */
    public static void systemString(MemorySegment struct, long index0, byte fieldValue) {
        systemString$ELEM_HANDLE.set(struct, 0L, index0, 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 - 2024 Weber Informatics LLC | Privacy Policy