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

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

The 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 _PangoFontMapClass {
 *     GObjectClass parent_class;
 *     PangoFont *(*load_font)(PangoFontMap *, PangoContext *, const PangoFontDescription *);
 *     void (*list_families)(PangoFontMap *, PangoFontFamily ***, int *);
 *     PangoFontset *(*load_fontset)(PangoFontMap *, PangoContext *, const PangoFontDescription *, PangoLanguage *);
 *     const char *shape_engine_type;
 *     guint (*get_serial)(PangoFontMap *);
 *     void (*changed)(PangoFontMap *);
 *     PangoFontFamily *(*get_family)(PangoFontMap *, const char *);
 *     PangoFontFace *(*get_face)(PangoFontMap *, PangoFont *);
 * }
 * }
 */
public class _PangoFontMapClass {

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

    private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
        _GObjectClass.layout().withName("parent_class"),
        app_indicator_h.C_POINTER.withName("load_font"),
        app_indicator_h.C_POINTER.withName("list_families"),
        app_indicator_h.C_POINTER.withName("load_fontset"),
        app_indicator_h.C_POINTER.withName("shape_engine_type"),
        app_indicator_h.C_POINTER.withName("get_serial"),
        app_indicator_h.C_POINTER.withName("changed"),
        app_indicator_h.C_POINTER.withName("get_family"),
        app_indicator_h.C_POINTER.withName("get_face")
    ).withName("_PangoFontMapClass");

    /**
     * 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 :
     * PangoFont *(*load_font)(PangoFontMap *, PangoContext *, const PangoFontDescription *)
     * }
     */
    public class load_font {

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

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            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(load_font.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(load_font.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 MemorySegment invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, MemorySegment _x2) {
            try {
                return (MemorySegment) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

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

    /**
     * Layout for field:
     * {@snippet lang=c :
     * PangoFont *(*load_font)(PangoFontMap *, PangoContext *, const PangoFontDescription *)
     * }
     */
    public static final AddressLayout load_font$layout() {
        return load_font$LAYOUT;
    }

    private static final long load_font$OFFSET = 136;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * PangoFont *(*load_font)(PangoFontMap *, PangoContext *, const PangoFontDescription *)
     * }
     */
    public static final long load_font$offset() {
        return load_font$OFFSET;
    }

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

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

    /**
     * {@snippet lang=c :
     * void (*list_families)(PangoFontMap *, PangoFontFamily ***, int *)
     * }
     */
    public class list_families {

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

        private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid(
            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(list_families.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(list_families.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) {
            try {
                 DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

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

    /**
     * Layout for field:
     * {@snippet lang=c :
     * void (*list_families)(PangoFontMap *, PangoFontFamily ***, int *)
     * }
     */
    public static final AddressLayout list_families$layout() {
        return list_families$LAYOUT;
    }

    private static final long list_families$OFFSET = 144;

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

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

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

    /**
     * {@snippet lang=c :
     * PangoFontset *(*load_fontset)(PangoFontMap *, PangoContext *, const PangoFontDescription *, PangoLanguage *)
     * }
     */
    public class load_fontset {

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

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            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(load_fontset.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(load_fontset.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 MemorySegment invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, MemorySegment _x2, MemorySegment _x3) {
            try {
                return (MemorySegment) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

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

    /**
     * Layout for field:
     * {@snippet lang=c :
     * PangoFontset *(*load_fontset)(PangoFontMap *, PangoContext *, const PangoFontDescription *, PangoLanguage *)
     * }
     */
    public static final AddressLayout load_fontset$layout() {
        return load_fontset$LAYOUT;
    }

    private static final long load_fontset$OFFSET = 152;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * PangoFontset *(*load_fontset)(PangoFontMap *, PangoContext *, const PangoFontDescription *, PangoLanguage *)
     * }
     */
    public static final long load_fontset$offset() {
        return load_fontset$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * PangoFontset *(*load_fontset)(PangoFontMap *, PangoContext *, const PangoFontDescription *, PangoLanguage *)
     * }
     */
    public static MemorySegment load_fontset(MemorySegment struct) {
        return struct.get(load_fontset$LAYOUT, load_fontset$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * PangoFontset *(*load_fontset)(PangoFontMap *, PangoContext *, const PangoFontDescription *, PangoLanguage *)
     * }
     */
    public static void load_fontset(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(load_fontset$LAYOUT, load_fontset$OFFSET, fieldValue);
    }

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

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

    private static final long shape_engine_type$OFFSET = 160;

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

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

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

    /**
     * {@snippet lang=c :
     * guint (*get_serial)(PangoFontMap *)
     * }
     */
    public class get_serial {

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

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            app_indicator_h.C_INT,
            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(get_serial.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(get_serial.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) {
            try {
                return (int) DOWN$MH.invokeExact(funcPtr, _x0);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

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

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

    private static final long get_serial$OFFSET = 168;

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

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

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

    /**
     * {@snippet lang=c :
     * void (*changed)(PangoFontMap *)
     * }
     */
    public class changed {

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

        private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid(
            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(changed.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(changed.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) {
            try {
                 DOWN$MH.invokeExact(funcPtr, _x0);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

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

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

    private static final long changed$OFFSET = 176;

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

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

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

    /**
     * {@snippet lang=c :
     * PangoFontFamily *(*get_family)(PangoFontMap *, const char *)
     * }
     */
    public class get_family {

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

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            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(get_family.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(get_family.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 MemorySegment invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1) {
            try {
                return (MemorySegment) DOWN$MH.invokeExact(funcPtr, _x0, _x1);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

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

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

    private static final long get_family$OFFSET = 184;

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

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

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

    /**
     * {@snippet lang=c :
     * PangoFontFace *(*get_face)(PangoFontMap *, PangoFont *)
     * }
     */
    public class get_face {

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

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            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(get_face.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(get_face.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 MemorySegment invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1) {
            try {
                return (MemorySegment) DOWN$MH.invokeExact(funcPtr, _x0, _x1);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

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

    /**
     * Layout for field:
     * {@snippet lang=c :
     * PangoFontFace *(*get_face)(PangoFontMap *, PangoFont *)
     * }
     */
    public static final AddressLayout get_face$layout() {
        return get_face$LAYOUT;
    }

    private static final long get_face$OFFSET = 192;

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

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

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