Package org.javagi.gobject
Class BoxedUtil
java.lang.Object
org.javagi.gobject.BoxedUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends @Nullable Proxy>
@Nullable MemorySegmentMake a copy ofstruct.static <T extends @Nullable Proxy>
voidFreestruct.static booleanChecks iftypeis a boxed type.
-
Constructor Details
-
BoxedUtil
public BoxedUtil()
-
-
Method Details
-
isBoxed
-
copy
public static <T extends @Nullable Proxy> @Nullable MemorySegment copy(@Nullable Type type, T struct, long size) Make a copy ofstruct. Iftypeis a boxed type, useg_boxed_copy, or else,malloca new struct and copysizebytes fromstructto it.- Parameters:
type- the type, possibly a boxed typestruct- the struct to be copiedsize- the size of the struct (only used whentypeis not a boxed type)- Returns:
- the newly created copy of
struct. The caller has ownership and is responsible for freeing it.
-
free
public static <T extends @Nullable Proxy> void free(@Nullable Type type, T struct, @Nullable Consumer<T> freeFunc) Freestruct. Iftypeis a boxed type, useg_boxed_free, or else, applyfreeFunconstruct.- Parameters:
type- the type, possibly a boxed typestruct- the struct to be freedfreeFunc- a function that will freestruct(only used whentypeis not a boxed type)
-