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

org.nd4j.linalg.api.buffer.pointer.JavaCppIntPointer Maven / Gradle / Ivy

There is a newer version: 1.0.0-beta6
Show newest version
package org.nd4j.linalg.api.buffer.pointer;

import org.bytedeco.javacpp.IntPointer;
import org.bytedeco.javacpp.Pointer;
import org.bytedeco.javacpp.annotation.Platform;
import org.nd4j.linalg.api.buffer.util.LibUtils;


/**
 * Created by agibsonccc on 2/25/16.
 */
@Platform(include = "NativeBuffer.h", link = "buffer")
public class JavaCppIntPointer extends IntPointer {


    static {
        try {
            LibUtils.addLibraryPath(System.getProperty("java.io.tmpdir"));
            LibUtils.loadTempBinaryFile("buffer");
            LibUtils.loadTempBinaryFile("jniJavaCppIntPointer");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


    public JavaCppIntPointer(int... array) {
        super((Pointer) null);
        allocateArray(array.length);
        put(array);
    }

    public JavaCppIntPointer(int size) {
        super((Pointer) null);
        allocateArray(size);
    }



    public native void putInt(int i, int val);

    private native void allocate();

    private native void allocateArray(int size);

    public native int[] bufferRef();

    public native void create(int length);

    public native long bufferAddress();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy