org.lwjgl.system.rpmalloc.RPMemoryUnmapCallback Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lwjgl-rpmalloc Show documentation
Show all versions of lwjgl-rpmalloc Show documentation
A public domain cross platform lock free thread caching 16-byte aligned memory allocator implemented in C.
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
package org.lwjgl.system.rpmalloc;
import javax.annotation.*;
import org.lwjgl.system.*;
import static org.lwjgl.system.MemoryUtil.*;
/**
* Instances of this class may be set to the {@link RPMallocConfig} struct.
*
* Type
*
*
* void (*) (
* void *address,
* size_t size
* )
*/
public abstract class RPMemoryUnmapCallback extends Callback implements RPMemoryUnmapCallbackI {
/**
* Creates a {@code RPMemoryUnmapCallback} instance from the specified function pointer.
*
* @return the new {@code RPMemoryUnmapCallback}
*/
public static RPMemoryUnmapCallback create(long functionPointer) {
RPMemoryUnmapCallbackI instance = Callback.get(functionPointer);
return instance instanceof RPMemoryUnmapCallback
? (RPMemoryUnmapCallback)instance
: new Container(functionPointer, instance);
}
/** Like {@link #create(long) create}, but returns {@code null} if {@code functionPointer} is {@code NULL}. */
@Nullable
public static RPMemoryUnmapCallback createSafe(long functionPointer) {
return functionPointer == NULL ? null : create(functionPointer);
}
/** Creates a {@code RPMemoryUnmapCallback} instance that delegates to the specified {@code RPMemoryUnmapCallbackI} instance. */
public static RPMemoryUnmapCallback create(RPMemoryUnmapCallbackI instance) {
return instance instanceof RPMemoryUnmapCallback
? (RPMemoryUnmapCallback)instance
: new Container(instance.address(), instance);
}
protected RPMemoryUnmapCallback() {
super(SIGNATURE);
}
private RPMemoryUnmapCallback(long functionPointer) {
super(functionPointer);
}
private static final class Container extends RPMemoryUnmapCallback {
private final RPMemoryUnmapCallbackI delegate;
Container(long functionPointer, RPMemoryUnmapCallbackI delegate) {
super(functionPointer);
this.delegate = delegate;
}
@Override
public void invoke(long address, long size) {
delegate.invoke(address, size);
}
}
}