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

org.purejava.appindicator._GTlsInteractionClass 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 _GTlsInteractionClass {
 *     GObjectClass parent_class;
 *     GTlsInteractionResult (*ask_password)(GTlsInteraction *, GTlsPassword *, GCancellable *, GError **);
 *     void (*ask_password_async)(GTlsInteraction *, GTlsPassword *, GCancellable *, GAsyncReadyCallback, gpointer);
 *     GTlsInteractionResult (*ask_password_finish)(GTlsInteraction *, GAsyncResult *, GError **);
 *     GTlsInteractionResult (*request_certificate)(GTlsInteraction *, GTlsConnection *, GTlsCertificateRequestFlags, GCancellable *, GError **);
 *     void (*request_certificate_async)(GTlsInteraction *, GTlsConnection *, GTlsCertificateRequestFlags, GCancellable *, GAsyncReadyCallback, gpointer);
 *     GTlsInteractionResult (*request_certificate_finish)(GTlsInteraction *, GAsyncResult *, GError **);
 *     gpointer padding[21];
 * }
 * }
 */
public class _GTlsInteractionClass {

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

    private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
        _GObjectClass.layout().withName("parent_class"),
        app_indicator_h.C_POINTER.withName("ask_password"),
        app_indicator_h.C_POINTER.withName("ask_password_async"),
        app_indicator_h.C_POINTER.withName("ask_password_finish"),
        app_indicator_h.C_POINTER.withName("request_certificate"),
        app_indicator_h.C_POINTER.withName("request_certificate_async"),
        app_indicator_h.C_POINTER.withName("request_certificate_finish"),
        MemoryLayout.sequenceLayout(21, app_indicator_h.C_POINTER).withName("padding")
    ).withName("_GTlsInteractionClass");

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

    private static final GroupLayout parent_class$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("parent_class"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * GObjectClass parent_class
     * }
     */
    public static final GroupLayout parent_class$layout() {
        return parent_class$LAYOUT;
    }

    private static final long parent_class$OFFSET = 0;

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

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

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

    /**
     * {@snippet lang=c :
     * GTlsInteractionResult (*ask_password)(GTlsInteraction *, GTlsPassword *, GCancellable *, GError **)
     * }
     */
    public class ask_password {

        /**
         * The function pointer signature, expressed as a functional interface
         */
        public interface Function {
            int apply(MemorySegment _x0, MemorySegment _x1, MemorySegment _x2, MemorySegment _x3);
        }

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            app_indicator_h.C_INT,
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER
        );

        /**
         * The descriptor of this function pointer
         */
        public static FunctionDescriptor descriptor() {
            return $DESC;
        }

        private static final MethodHandle UP$MH = app_indicator_h.upcallHandle(ask_password.Function.class, "apply", $DESC);

        /**
         * Allocates a new upcall stub, whose implementation is defined by {@code fi}.
         * The lifetime of the returned segment is managed by {@code arena}
         */
        public static MemorySegment allocate(ask_password.Function fi, Arena arena) {
            return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
        }

        private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);

        /**
         * Invoke the upcall stub {@code funcPtr}, with given parameters
         */
        public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, MemorySegment _x2, MemorySegment _x3) {
            try {
                return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

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

    /**
     * Layout for field:
     * {@snippet lang=c :
     * GTlsInteractionResult (*ask_password)(GTlsInteraction *, GTlsPassword *, GCancellable *, GError **)
     * }
     */
    public static final AddressLayout ask_password$layout() {
        return ask_password$LAYOUT;
    }

    private static final long ask_password$OFFSET = 136;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * GTlsInteractionResult (*ask_password)(GTlsInteraction *, GTlsPassword *, GCancellable *, GError **)
     * }
     */
    public static final long ask_password$offset() {
        return ask_password$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * GTlsInteractionResult (*ask_password)(GTlsInteraction *, GTlsPassword *, GCancellable *, GError **)
     * }
     */
    public static MemorySegment ask_password(MemorySegment struct) {
        return struct.get(ask_password$LAYOUT, ask_password$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * GTlsInteractionResult (*ask_password)(GTlsInteraction *, GTlsPassword *, GCancellable *, GError **)
     * }
     */
    public static void ask_password(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(ask_password$LAYOUT, ask_password$OFFSET, fieldValue);
    }

    /**
     * {@snippet lang=c :
     * void (*ask_password_async)(GTlsInteraction *, GTlsPassword *, GCancellable *, GAsyncReadyCallback, gpointer)
     * }
     */
    public class ask_password_async {

        /**
         * The function pointer signature, expressed as a functional interface
         */
        public interface Function {
            void apply(MemorySegment _x0, MemorySegment _x1, MemorySegment _x2, MemorySegment _x3, MemorySegment _x4);
        }

        private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid(
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER
        );

        /**
         * The descriptor of this function pointer
         */
        public static FunctionDescriptor descriptor() {
            return $DESC;
        }

        private static final MethodHandle UP$MH = app_indicator_h.upcallHandle(ask_password_async.Function.class, "apply", $DESC);

        /**
         * Allocates a new upcall stub, whose implementation is defined by {@code fi}.
         * The lifetime of the returned segment is managed by {@code arena}
         */
        public static MemorySegment allocate(ask_password_async.Function fi, Arena arena) {
            return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
        }

        private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);

        /**
         * Invoke the upcall stub {@code funcPtr}, with given parameters
         */
        public static void invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, MemorySegment _x2, MemorySegment _x3, MemorySegment _x4) {
            try {
                 DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3, _x4);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

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

    /**
     * Layout for field:
     * {@snippet lang=c :
     * void (*ask_password_async)(GTlsInteraction *, GTlsPassword *, GCancellable *, GAsyncReadyCallback, gpointer)
     * }
     */
    public static final AddressLayout ask_password_async$layout() {
        return ask_password_async$LAYOUT;
    }

    private static final long ask_password_async$OFFSET = 144;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * void (*ask_password_async)(GTlsInteraction *, GTlsPassword *, GCancellable *, GAsyncReadyCallback, gpointer)
     * }
     */
    public static final long ask_password_async$offset() {
        return ask_password_async$OFFSET;
    }

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

    /**
     * Setter for field:
     * {@snippet lang=c :
     * void (*ask_password_async)(GTlsInteraction *, GTlsPassword *, GCancellable *, GAsyncReadyCallback, gpointer)
     * }
     */
    public static void ask_password_async(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(ask_password_async$LAYOUT, ask_password_async$OFFSET, fieldValue);
    }

    /**
     * {@snippet lang=c :
     * GTlsInteractionResult (*ask_password_finish)(GTlsInteraction *, GAsyncResult *, GError **)
     * }
     */
    public class ask_password_finish {

        /**
         * The function pointer signature, expressed as a functional interface
         */
        public interface Function {
            int apply(MemorySegment _x0, MemorySegment _x1, MemorySegment _x2);
        }

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            app_indicator_h.C_INT,
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER
        );

        /**
         * The descriptor of this function pointer
         */
        public static FunctionDescriptor descriptor() {
            return $DESC;
        }

        private static final MethodHandle UP$MH = app_indicator_h.upcallHandle(ask_password_finish.Function.class, "apply", $DESC);

        /**
         * Allocates a new upcall stub, whose implementation is defined by {@code fi}.
         * The lifetime of the returned segment is managed by {@code arena}
         */
        public static MemorySegment allocate(ask_password_finish.Function fi, Arena arena) {
            return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
        }

        private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);

        /**
         * Invoke the upcall stub {@code funcPtr}, with given parameters
         */
        public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, MemorySegment _x2) {
            try {
                return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

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

    /**
     * Layout for field:
     * {@snippet lang=c :
     * GTlsInteractionResult (*ask_password_finish)(GTlsInteraction *, GAsyncResult *, GError **)
     * }
     */
    public static final AddressLayout ask_password_finish$layout() {
        return ask_password_finish$LAYOUT;
    }

    private static final long ask_password_finish$OFFSET = 152;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * GTlsInteractionResult (*ask_password_finish)(GTlsInteraction *, GAsyncResult *, GError **)
     * }
     */
    public static final long ask_password_finish$offset() {
        return ask_password_finish$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * GTlsInteractionResult (*ask_password_finish)(GTlsInteraction *, GAsyncResult *, GError **)
     * }
     */
    public static MemorySegment ask_password_finish(MemorySegment struct) {
        return struct.get(ask_password_finish$LAYOUT, ask_password_finish$OFFSET);
    }

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

    /**
     * {@snippet lang=c :
     * GTlsInteractionResult (*request_certificate)(GTlsInteraction *, GTlsConnection *, GTlsCertificateRequestFlags, GCancellable *, GError **)
     * }
     */
    public class request_certificate {

        /**
         * The function pointer signature, expressed as a functional interface
         */
        public interface Function {
            int apply(MemorySegment _x0, MemorySegment _x1, int _x2, MemorySegment _x3, MemorySegment _x4);
        }

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            app_indicator_h.C_INT,
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER,
            app_indicator_h.C_INT,
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER
        );

        /**
         * The descriptor of this function pointer
         */
        public static FunctionDescriptor descriptor() {
            return $DESC;
        }

        private static final MethodHandle UP$MH = app_indicator_h.upcallHandle(request_certificate.Function.class, "apply", $DESC);

        /**
         * Allocates a new upcall stub, whose implementation is defined by {@code fi}.
         * The lifetime of the returned segment is managed by {@code arena}
         */
        public static MemorySegment allocate(request_certificate.Function fi, Arena arena) {
            return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
        }

        private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);

        /**
         * Invoke the upcall stub {@code funcPtr}, with given parameters
         */
        public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, int _x2, MemorySegment _x3, MemorySegment _x4) {
            try {
                return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3, _x4);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

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

    /**
     * Layout for field:
     * {@snippet lang=c :
     * GTlsInteractionResult (*request_certificate)(GTlsInteraction *, GTlsConnection *, GTlsCertificateRequestFlags, GCancellable *, GError **)
     * }
     */
    public static final AddressLayout request_certificate$layout() {
        return request_certificate$LAYOUT;
    }

    private static final long request_certificate$OFFSET = 160;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * GTlsInteractionResult (*request_certificate)(GTlsInteraction *, GTlsConnection *, GTlsCertificateRequestFlags, GCancellable *, GError **)
     * }
     */
    public static final long request_certificate$offset() {
        return request_certificate$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * GTlsInteractionResult (*request_certificate)(GTlsInteraction *, GTlsConnection *, GTlsCertificateRequestFlags, GCancellable *, GError **)
     * }
     */
    public static MemorySegment request_certificate(MemorySegment struct) {
        return struct.get(request_certificate$LAYOUT, request_certificate$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * GTlsInteractionResult (*request_certificate)(GTlsInteraction *, GTlsConnection *, GTlsCertificateRequestFlags, GCancellable *, GError **)
     * }
     */
    public static void request_certificate(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(request_certificate$LAYOUT, request_certificate$OFFSET, fieldValue);
    }

    /**
     * {@snippet lang=c :
     * void (*request_certificate_async)(GTlsInteraction *, GTlsConnection *, GTlsCertificateRequestFlags, GCancellable *, GAsyncReadyCallback, gpointer)
     * }
     */
    public class request_certificate_async {

        /**
         * The function pointer signature, expressed as a functional interface
         */
        public interface Function {
            void apply(MemorySegment _x0, MemorySegment _x1, int _x2, MemorySegment _x3, MemorySegment _x4, MemorySegment _x5);
        }

        private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid(
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER,
            app_indicator_h.C_INT,
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER
        );

        /**
         * The descriptor of this function pointer
         */
        public static FunctionDescriptor descriptor() {
            return $DESC;
        }

        private static final MethodHandle UP$MH = app_indicator_h.upcallHandle(request_certificate_async.Function.class, "apply", $DESC);

        /**
         * Allocates a new upcall stub, whose implementation is defined by {@code fi}.
         * The lifetime of the returned segment is managed by {@code arena}
         */
        public static MemorySegment allocate(request_certificate_async.Function fi, Arena arena) {
            return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
        }

        private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);

        /**
         * Invoke the upcall stub {@code funcPtr}, with given parameters
         */
        public static void invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, int _x2, MemorySegment _x3, MemorySegment _x4, MemorySegment _x5) {
            try {
                 DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3, _x4, _x5);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

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

    /**
     * Layout for field:
     * {@snippet lang=c :
     * void (*request_certificate_async)(GTlsInteraction *, GTlsConnection *, GTlsCertificateRequestFlags, GCancellable *, GAsyncReadyCallback, gpointer)
     * }
     */
    public static final AddressLayout request_certificate_async$layout() {
        return request_certificate_async$LAYOUT;
    }

    private static final long request_certificate_async$OFFSET = 168;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * void (*request_certificate_async)(GTlsInteraction *, GTlsConnection *, GTlsCertificateRequestFlags, GCancellable *, GAsyncReadyCallback, gpointer)
     * }
     */
    public static final long request_certificate_async$offset() {
        return request_certificate_async$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * void (*request_certificate_async)(GTlsInteraction *, GTlsConnection *, GTlsCertificateRequestFlags, GCancellable *, GAsyncReadyCallback, gpointer)
     * }
     */
    public static MemorySegment request_certificate_async(MemorySegment struct) {
        return struct.get(request_certificate_async$LAYOUT, request_certificate_async$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * void (*request_certificate_async)(GTlsInteraction *, GTlsConnection *, GTlsCertificateRequestFlags, GCancellable *, GAsyncReadyCallback, gpointer)
     * }
     */
    public static void request_certificate_async(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(request_certificate_async$LAYOUT, request_certificate_async$OFFSET, fieldValue);
    }

    /**
     * {@snippet lang=c :
     * GTlsInteractionResult (*request_certificate_finish)(GTlsInteraction *, GAsyncResult *, GError **)
     * }
     */
    public class request_certificate_finish {

        /**
         * The function pointer signature, expressed as a functional interface
         */
        public interface Function {
            int apply(MemorySegment _x0, MemorySegment _x1, MemorySegment _x2);
        }

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            app_indicator_h.C_INT,
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER
        );

        /**
         * The descriptor of this function pointer
         */
        public static FunctionDescriptor descriptor() {
            return $DESC;
        }

        private static final MethodHandle UP$MH = app_indicator_h.upcallHandle(request_certificate_finish.Function.class, "apply", $DESC);

        /**
         * Allocates a new upcall stub, whose implementation is defined by {@code fi}.
         * The lifetime of the returned segment is managed by {@code arena}
         */
        public static MemorySegment allocate(request_certificate_finish.Function fi, Arena arena) {
            return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
        }

        private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);

        /**
         * Invoke the upcall stub {@code funcPtr}, with given parameters
         */
        public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, MemorySegment _x2) {
            try {
                return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

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

    /**
     * Layout for field:
     * {@snippet lang=c :
     * GTlsInteractionResult (*request_certificate_finish)(GTlsInteraction *, GAsyncResult *, GError **)
     * }
     */
    public static final AddressLayout request_certificate_finish$layout() {
        return request_certificate_finish$LAYOUT;
    }

    private static final long request_certificate_finish$OFFSET = 176;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * GTlsInteractionResult (*request_certificate_finish)(GTlsInteraction *, GAsyncResult *, GError **)
     * }
     */
    public static final long request_certificate_finish$offset() {
        return request_certificate_finish$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * GTlsInteractionResult (*request_certificate_finish)(GTlsInteraction *, GAsyncResult *, GError **)
     * }
     */
    public static MemorySegment request_certificate_finish(MemorySegment struct) {
        return struct.get(request_certificate_finish$LAYOUT, request_certificate_finish$OFFSET);
    }

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

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

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

    private static final long padding$OFFSET = 184;

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

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

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

    private static long[] padding$DIMS = { 21 };

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

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

    /**
     * Indexed setter for field:
     * {@snippet lang=c :
     * gpointer padding[21]
     * }
     */
    public static void padding(MemorySegment struct, long index0, MemorySegment fieldValue) {
        padding$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