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

com.littlekt.wgpu.WGPUCompilationMessage Maven / Gradle / Ivy

// Generated by jextract

package com.littlekt.wgpu;

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 WGPUCompilationMessage {
 *     const WGPUChainedStruct *nextInChain;
 *     const char *message;
 *     WGPUCompilationMessageType type;
 *     uint64_t lineNum;
 *     uint64_t linePos;
 *     uint64_t offset;
 *     uint64_t length;
 *     uint64_t utf16LinePos;
 *     uint64_t utf16Offset;
 *     uint64_t utf16Length;
 * }
 * }
 */
public class WGPUCompilationMessage {

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

    private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
        WGPU.C_POINTER.withName("nextInChain"),
        WGPU.C_POINTER.withName("message"),
        WGPU.C_INT.withName("type"),
        MemoryLayout.paddingLayout(4),
        WGPU.C_LONG_LONG.withName("lineNum"),
        WGPU.C_LONG_LONG.withName("linePos"),
        WGPU.C_LONG_LONG.withName("offset"),
        WGPU.C_LONG_LONG.withName("length"),
        WGPU.C_LONG_LONG.withName("utf16LinePos"),
        WGPU.C_LONG_LONG.withName("utf16Offset"),
        WGPU.C_LONG_LONG.withName("utf16Length")
    ).withName("WGPUCompilationMessage");

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

    private static final AddressLayout nextInChain$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("nextInChain"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * const WGPUChainedStruct *nextInChain
     * }
     */
    public static final AddressLayout nextInChain$layout() {
        return nextInChain$LAYOUT;
    }

    private static final long nextInChain$OFFSET = 0;

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

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

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

    private static final AddressLayout message$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("message"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * const char *message
     * }
     */
    public static final AddressLayout message$layout() {
        return message$LAYOUT;
    }

    private static final long message$OFFSET = 8;

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

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

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

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

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

    private static final long type$OFFSET = 16;

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

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

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

    private static final OfLong lineNum$LAYOUT = (OfLong)$LAYOUT.select(groupElement("lineNum"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * uint64_t lineNum
     * }
     */
    public static final OfLong lineNum$layout() {
        return lineNum$LAYOUT;
    }

    private static final long lineNum$OFFSET = 24;

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

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

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

    private static final OfLong linePos$LAYOUT = (OfLong)$LAYOUT.select(groupElement("linePos"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * uint64_t linePos
     * }
     */
    public static final OfLong linePos$layout() {
        return linePos$LAYOUT;
    }

    private static final long linePos$OFFSET = 32;

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

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

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

    private static final OfLong offset$LAYOUT = (OfLong)$LAYOUT.select(groupElement("offset"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * uint64_t offset
     * }
     */
    public static final OfLong offset$layout() {
        return offset$LAYOUT;
    }

    private static final long offset$OFFSET = 40;

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

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

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

    private static final OfLong length$LAYOUT = (OfLong)$LAYOUT.select(groupElement("length"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * uint64_t length
     * }
     */
    public static final OfLong length$layout() {
        return length$LAYOUT;
    }

    private static final long length$OFFSET = 48;

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

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

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

    private static final OfLong utf16LinePos$LAYOUT = (OfLong)$LAYOUT.select(groupElement("utf16LinePos"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * uint64_t utf16LinePos
     * }
     */
    public static final OfLong utf16LinePos$layout() {
        return utf16LinePos$LAYOUT;
    }

    private static final long utf16LinePos$OFFSET = 56;

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

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

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

    private static final OfLong utf16Offset$LAYOUT = (OfLong)$LAYOUT.select(groupElement("utf16Offset"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * uint64_t utf16Offset
     * }
     */
    public static final OfLong utf16Offset$layout() {
        return utf16Offset$LAYOUT;
    }

    private static final long utf16Offset$OFFSET = 64;

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

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

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

    private static final OfLong utf16Length$LAYOUT = (OfLong)$LAYOUT.select(groupElement("utf16Length"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * uint64_t utf16Length
     * }
     */
    public static final OfLong utf16Length$layout() {
        return utf16Length$LAYOUT;
    }

    private static final long utf16Length$OFFSET = 72;

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

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

    /**
     * Setter for field:
     * {@snippet lang=c :
     * uint64_t utf16Length
     * }
     */
    public static void utf16Length(MemorySegment struct, long fieldValue) {
        struct.set(utf16Length$LAYOUT, utf16Length$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 - 2024 Weber Informatics LLC | Privacy Policy