org.lwjgl.glfw.GLFWDeallocateCallback Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lwjgl-glfw Show documentation
Show all versions of lwjgl-glfw Show documentation
A multi-platform library for OpenGL, OpenGL ES and Vulkan development on the desktop. It provides a simple API for creating windows, contexts and surfaces, receiving input and events.
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
package org.lwjgl.glfw;
import javax.annotation.*;
import org.lwjgl.system.*;
import static org.lwjgl.system.MemoryUtil.*;
/**
* The function pointer type for memory deallocation callbacks.
*
* This is the function pointer type for memory deallocation callbacks. A memory deallocation callback function has the following signature:
*
*
* void function_name(void* block, void* user)
*
* This function may deallocate the specified memory block. This memory block will have been allocated with the same allocator.
*
* This function may be called during {@link GLFW#glfwInit Init} but before the library is flagged as initialized, as well as during {@link GLFW#glfwTerminate Terminate} after the library is no
* longer flagged as initialized.
*
* The block address will never be {@code NULL}. Deallocations of {@code NULL} are filtered out before reaching the custom allocator.
*
* Note
*
*
* - The specified memory block will not be accessed by GLFW after this function is called.
* - This function should not call any GLFW function.
* - This function may be called from any thread that calls GLFW functions.
*
*
* Type
*
*
* void (*{@link #invoke}) (
* void *block,
* void *user
* )
*
* @since version 3.4
*/
public abstract class GLFWDeallocateCallback extends Callback implements GLFWDeallocateCallbackI {
/**
* Creates a {@code GLFWDeallocateCallback} instance from the specified function pointer.
*
* @return the new {@code GLFWDeallocateCallback}
*/
public static GLFWDeallocateCallback create(long functionPointer) {
GLFWDeallocateCallbackI instance = Callback.get(functionPointer);
return instance instanceof GLFWDeallocateCallback
? (GLFWDeallocateCallback)instance
: new Container(functionPointer, instance);
}
/** Like {@link #create(long) create}, but returns {@code null} if {@code functionPointer} is {@code NULL}. */
@Nullable
public static GLFWDeallocateCallback createSafe(long functionPointer) {
return functionPointer == NULL ? null : create(functionPointer);
}
/** Creates a {@code GLFWDeallocateCallback} instance that delegates to the specified {@code GLFWDeallocateCallbackI} instance. */
public static GLFWDeallocateCallback create(GLFWDeallocateCallbackI instance) {
return instance instanceof GLFWDeallocateCallback
? (GLFWDeallocateCallback)instance
: new Container(instance.address(), instance);
}
protected GLFWDeallocateCallback() {
super(CIF);
}
GLFWDeallocateCallback(long functionPointer) {
super(functionPointer);
}
private static final class Container extends GLFWDeallocateCallback {
private final GLFWDeallocateCallbackI delegate;
Container(long functionPointer, GLFWDeallocateCallbackI delegate) {
super(functionPointer);
this.delegate = delegate;
}
@Override
public void invoke(long block, long user) {
delegate.invoke(block, user);
}
}
}