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

org.purejava.appindicator._GInterfaceInfo 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 _GInterfaceInfo {
 *     GInterfaceInitFunc interface_init;
 *     GInterfaceFinalizeFunc interface_finalize;
 *     gpointer interface_data;
 * }
 * }
 */
public class _GInterfaceInfo {

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

    private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
        app_indicator_h.C_POINTER.withName("interface_init"),
        app_indicator_h.C_POINTER.withName("interface_finalize"),
        app_indicator_h.C_POINTER.withName("interface_data")
    ).withName("_GInterfaceInfo");

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

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

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

    private static final long interface_init$OFFSET = 0;

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

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

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

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

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

    private static final long interface_finalize$OFFSET = 8;

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

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

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

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

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

    private static final long interface_data$OFFSET = 16;

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

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

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