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

org.purejava.appindicator._GInputMessage Maven / Gradle / Ivy

There is a newer version: 1.4.1
Show newest version
// 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 _GInputMessage {
 *     GSocketAddress **address;
 *     GInputVector *vectors;
 *     guint num_vectors;
 *     gsize bytes_received;
 *     gint flags;
 *     GSocketControlMessage ***control_messages;
 *     guint *num_control_messages;
 * }
 * }
 */
public class _GInputMessage {

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

    private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
        app_indicator_h.C_POINTER.withName("address"),
        app_indicator_h.C_POINTER.withName("vectors"),
        app_indicator_h.C_INT.withName("num_vectors"),
        MemoryLayout.paddingLayout(4),
        app_indicator_h.C_LONG.withName("bytes_received"),
        app_indicator_h.C_INT.withName("flags"),
        MemoryLayout.paddingLayout(4),
        app_indicator_h.C_POINTER.withName("control_messages"),
        app_indicator_h.C_POINTER.withName("num_control_messages")
    ).withName("_GInputMessage");

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

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

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

    private static final long address$OFFSET = 0;

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

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

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

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

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

    private static final long vectors$OFFSET = 8;

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

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

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

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

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

    private static final long num_vectors$OFFSET = 16;

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

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

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

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

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

    private static final long bytes_received$OFFSET = 24;

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

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

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

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

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

    private static final long flags$OFFSET = 32;

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

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

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

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

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

    private static final long control_messages$OFFSET = 40;

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

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

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

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

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

    private static final long num_control_messages$OFFSET = 48;

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

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

    /**
     * Setter for field:
     * {@snippet lang=c :
     * guint *num_control_messages
     * }
     */
    public static void num_control_messages(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(num_control_messages$LAYOUT, num_control_messages$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