com.sun.jna.ptr.PointerByReference Java Examples

The following examples show how to use com.sun.jna.ptr.PointerByReference. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MockMxnetLibrary.java    From djl with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public int MXKVStorePullRowSparse(
        Pointer handle,
        int num,
        int[] keys,
        PointerByReference vals,
        PointerByReference row_ids,
        int priority) {
    if (functions.containsKey("MXKVStorePullRowSparse")) {
        return functions
                .get("MXKVStorePullRowSparse")
                .apply(new Object[] {handle, num, keys, vals, row_ids, priority});
    }
    return 0;
}
 
Example #2
Source File: LevelDBKeyIterator.java    From leveldb-jna with MIT License 6 votes vote down vote up
public byte[] next() {
    levelDB.checkDatabaseOpen();
    checkIteratorOpen();

    PointerByReference resultLengthPointer = new PointerByReference();
    PointerByReference resultPointer = LevelDBNative.leveldb_iter_key(iterator, resultLengthPointer);

    long resultLength;
    if (Native.POINTER_SIZE == 8) {
        resultLength = resultLengthPointer.getPointer().getLong(0);
    } else {
        resultLength = resultLengthPointer.getPointer().getInt(0);
    }

    byte[] key = resultPointer.getPointer().getByteArray(0, (int) resultLength);

    LevelDBNative.leveldb_iter_next(iterator);

    return key;
}
 
Example #3
Source File: MockMxnetLibrary.java    From djl with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public int MXNDArrayCreateEx(
        int[] shape,
        int ndim,
        int dev_type,
        int dev_id,
        int delay_alloc,
        int dtype,
        PointerByReference out) {
    if (functions.containsKey("MXNDArrayCreateEx")) {
        return functions
                .get("MXNDArrayCreateEx")
                .apply(new Object[] {shape, ndim, dev_type, dev_id, delay_alloc, dtype, out});
    }

    out.setValue(new PointerArray());
    return 0;
}
 
Example #4
Source File: RadeonService.java    From winthing with Apache License 2.0 6 votes vote down vote up
@Inject
public RadeonService(final AtiAdl atiAdl) {
    this.atiAdl = Objects.requireNonNull(atiAdl);
    {
        final PointerByReference contextReference = new PointerByReference();
        final int result = atiAdl.ADL2_Main_Control_Create(
            new MallocCallback(),
            1,
            contextReference
        );
        if (result != AtiAdl.ADL_OK) {
            throw new AdlException("ADL2_Main_Control_Create", result);
        }
        this.context = contextReference.getValue();
    }
}
 
Example #5
Source File: STMobileFaceDetection.java    From Fatigue-Detection with MIT License 5 votes vote down vote up
public STMobileFaceDetection(Context context, int config) {
      PointerByReference handlerPointer = new PointerByReference();
mContext = context;
synchronized(this.getClass())
{
   copyModelIfNeed(DETECTION_MODEL_NAME);
}
String modulePath = getModelPath(DETECTION_MODEL_NAME);
  	int rst = STMobileApiBridge.FACESDK_INSTANCE.st_mobile_face_detection_create(modulePath, config, handlerPointer);
  	if(rst != ResultCode.ST_OK.getResultCode())
  	{
  		return;
  	}
  	detectHandle = handlerPointer.getValue();
  }
 
Example #6
Source File: MockMxnetLibrary.java    From djl with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public int MXSymbolGetChildren(Pointer symbol, PointerByReference out) {
    if (functions.containsKey("MXSymbolGetChildren")) {
        return functions.get("MXSymbolGetChildren").apply(new Object[] {symbol, out});
    }
    return 0;
}
 
Example #7
Source File: MockMxnetLibrary.java    From djl with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public int MXNDArrayGetData(Pointer handle, PointerByReference out_pdata) {
    if (functions.containsKey("MXNDArrayGetData")) {
        return functions.get("MXNDArrayGetData").apply(new Object[] {handle, out_pdata});
    }
    return 0;
}
 
Example #8
Source File: Sela.java    From lept4j with Apache License 2.0 5 votes vote down vote up
/**
	 * @param n number of sel actually stored<br>
	 * C type : l_int32<br>
	 * @param nalloc size of allocated ptr array<br>
	 * C type : l_int32<br>
	 * @param sel sel ptr array<br>
	 * C type : Sel**
	 */
	public Sela(int n, int nalloc, PointerByReference sel) {
		super();
		this.n = n;
		this.nalloc = nalloc;
//		if ((sel.length != this.sel.length)) 
//			throw new IllegalArgumentException("Wrong array size !");
		this.sel = sel;
	}
 
Example #9
Source File: MockMxnetLibrary.java    From djl with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public int MXCreateCachedOp(Pointer handle, PointerByReference out) {
    if (functions.containsKey("MXCreateCachedOp")) {
        return functions.get("MXCreateCachedOp").apply(new Object[] {handle, out});
    }
    return 0;
}
 
Example #10
Source File: Boxaa.java    From lept4j with Apache License 2.0 5 votes vote down vote up
/**
	 * @param n number of boxa in ptr array<br>
	 * C type : l_int32<br>
	 * @param nalloc number of boxa ptrs allocated<br>
	 * C type : l_int32<br>
	 * @param boxa boxa ptr array<br>
	 * C type : Boxa**
	 */
	public Boxaa(int n, int nalloc, PointerByReference boxa) {
		super();
		this.n = n;
		this.nalloc = nalloc;
//		if ((boxa.length != this.boxa.length)) 
//			throw new IllegalArgumentException("Wrong array size !");
		this.boxa = boxa;
	}
 
Example #11
Source File: MockMxnetLibrary.java    From djl with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public int NNSymbolCreateGroup(
        int num_symbols, PointerByReference symbols, PointerByReference out) {
    if (functions.containsKey("NNSymbolCreateGroup")) {
        return functions
                .get("NNSymbolCreateGroup")
                .apply(new Object[] {num_symbols, symbols, out});
    }
    return 0;
}
 
Example #12
Source File: MockMxnetLibrary.java    From djl with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public int MXSymbolCopy(Pointer symbol, PointerByReference out) {
    if (functions.containsKey("MXSymbolCopy")) {
        return functions.get("MXSymbolCopy").apply(new Object[] {symbol, out});
    }
    return 0;
}
 
Example #13
Source File: MockMxnetLibrary.java    From djl with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public int MXInvokeCachedOpEx(
        Pointer handle,
        int num_inputs,
        Pointer inputs,
        IntBuffer num_outputs,
        PointerByReference outputs,
        PointerByReference out_stypes) {
    if (functions.containsKey("MXInvokeCachedOpEx")) {
        return functions
                .get("MXInvokeCachedOpEx")
                .apply(
                        new Object[] {
                            handle, num_inputs, inputs, num_outputs, outputs, out_stypes
                        });
    }

    num_outputs.put(0, 3);
    PointerArray arr =
            new PointerArray(
                    TestHelper.toPointer("a"),
                    TestHelper.toPointer("b"),
                    TestHelper.toPointer("c"));
    outputs.setValue(arr);
    Pointer sTypes = TestHelper.toPointer(new int[] {0, 0, 1});
    out_stypes.setValue(sTypes);
    return 0;
}
 
Example #14
Source File: MockMxnetLibrary.java    From djl with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public int NNSymbolCreateAtomicSymbol(
        Pointer op, int num_param, String[] keys, String[] vals, PointerByReference out) {
    if (functions.containsKey("NNSymbolCreateAtomicSymbol")) {
        return functions
                .get("NNSymbolCreateAtomicSymbol")
                .apply(new Object[] {op, num_param, keys, vals, out});
    }
    return 0;
}
 
Example #15
Source File: MockMxnetLibrary.java    From djl with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public int MXSymbolGrad(Pointer sym, int num_wrt, String[] wrt, PointerByReference out) {
    if (functions.containsKey("MXSymbolGrad")) {
        return functions.get("MXSymbolGrad").apply(new Object[] {sym, num_wrt, wrt, out});
    }
    return 0;
}
 
Example #16
Source File: MockMxnetLibrary.java    From djl with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public int MXAutogradMarkVariables(
        int num_var,
        PointerByReference var_handles,
        IntBuffer reqs_array,
        PointerByReference grad_handles) {
    if (functions.containsKey("MXAutogradMarkVariables")) {
        return functions
                .get("MXAutogradMarkVariables")
                .apply(new Object[] {num_var, var_handles, reqs_array, grad_handles});
    }
    return 0;
}
 
Example #17
Source File: MockMxnetLibrary.java    From djl with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public int MXSymbolCreateGroup(
        int num_symbols, PointerByReference symbols, PointerByReference out) {
    if (functions.containsKey("MXSymbolCreateGroup")) {
        return functions
                .get("MXSymbolCreateGroup")
                .apply(new Object[] {num_symbols, symbols, out});
    }
    return 0;
}
 
Example #18
Source File: INotesNativeAPI64.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
public short OOOStartOperation(
Pointer pMailOwnerName,
Pointer pHomeMailServer,
int bHomeMailServer,
long hMailFile,
LongByReference hOOOContext,
PointerByReference pOOOOContext);
 
Example #19
Source File: TessAPITest.java    From tess4j with Apache License 2.0 5 votes vote down vote up
/**
 * Test of TessBaseAPIAnalyseLayout method, of class TessAPI.
 *
 * @throws java.lang.Exception
 */
@Test
public void testTessBaseAPIAnalyseLayout() throws Exception {
    logger.info("TessBaseAPIAnalyseLayout");
    File image = new File(testResourcesDataPath, "eurotext.png");
    int expResult = 12; // number of lines in the test image
    Leptonica leptInstance = Leptonica.INSTANCE;
    Pix pix = leptInstance.pixRead(image.getPath());
    api.TessBaseAPIInit3(handle, datapath, language);
    api.TessBaseAPISetImage2(handle, pix);
    int pageIteratorLevel = TessPageIteratorLevel.RIL_TEXTLINE;
    logger.info("PageIteratorLevel: " + Utils.getConstantName(pageIteratorLevel, TessPageIteratorLevel.class));
    int i = 0;
    TessPageIterator pi = api.TessBaseAPIAnalyseLayout(handle);

    do {
        IntBuffer leftB = IntBuffer.allocate(1);
        IntBuffer topB = IntBuffer.allocate(1);
        IntBuffer rightB = IntBuffer.allocate(1);
        IntBuffer bottomB = IntBuffer.allocate(1);
        api.TessPageIteratorBoundingBox(pi, pageIteratorLevel, leftB, topB, rightB, bottomB);
        int left = leftB.get();
        int top = topB.get();
        int right = rightB.get();
        int bottom = bottomB.get();
        logger.info(String.format("Box[%d]: x=%d, y=%d, w=%d, h=%d", i++, left, top, right - left, bottom - top));
    } while (api.TessPageIteratorNext(pi, pageIteratorLevel) == TRUE);
    api.TessPageIteratorDelete(pi);
    PointerByReference pRef = new PointerByReference();
    pRef.setValue(pix.getPointer());
    leptInstance.pixDestroy(pRef);
    assertEquals(expResult, i);
}
 
Example #20
Source File: MockMxnetLibrary.java    From djl with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public int MXProfileCreateCounter(Pointer domain, String counter_name, PointerByReference out) {
    if (functions.containsKey("MXProfileCreateCounter")) {
        return functions
                .get("MXProfileCreateCounter")
                .apply(new Object[] {domain, counter_name, out});
    }
    return 0;
}
 
Example #21
Source File: MockMxnetLibrary.java    From djl with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public int MXNDArrayGetGrad(Pointer handle, PointerByReference out) {
    if (functions.containsKey("MXNDArrayGetGrad")) {
        return functions.get("MXNDArrayGetGrad").apply(new Object[] {handle, out});
    }
    return 0;
}
 
Example #22
Source File: MockMxnetLibrary.java    From djl with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public int MXNDArrayGetDataNDArray(Pointer handle, PointerByReference out) {
    if (functions.containsKey("MXNDArrayGetDataNDArray")) {
        return functions.get("MXNDArrayGetDataNDArray").apply(new Object[] {handle, out});
    }
    return 0;
}
 
Example #23
Source File: MockMxnetLibrary.java    From djl with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public int MXNDArrayCreateSparseEx(
        int storage_type,
        int[] shape,
        int ndim,
        int dev_type,
        int dev_id,
        int delay_alloc,
        int dtype,
        int num_aux,
        IntBuffer aux_type,
        IntBuffer aux_ndims,
        int[] aux_shape,
        PointerByReference out) {
    if (functions.containsKey("MXNDArrayCreateSparseEx")) {
        return functions
                .get("MXNDArrayCreateSparseEx")
                .apply(
                        new Object[] {
                            storage_type,
                            shape,
                            ndim,
                            dev_type,
                            dev_id,
                            delay_alloc,
                            dtype,
                            num_aux,
                            aux_type,
                            aux_ndims,
                            aux_shape,
                            out
                        });
    }
    return 0;
}
 
Example #24
Source File: STMobileApiBridge.java    From TikTok with Apache License 2.0 4 votes vote down vote up
int st_mobile_face_attribute_detect(Pointer handle, byte[] image, int pixel_format, int image_width, int image_height, int image_stride, PointerByReference p_face,                 //检查这里是否和st_mobile_face_action_t **p_face_action_array用法类似
IntByReference p_attributes);
 
Example #25
Source File: OpenSslNativeJna.java    From commons-crypto with Apache License 2.0 4 votes vote down vote up
public static PointerByReference EVP_aes_192_cbc() {
    if (VERSION == VERSION_1_1_X) {
        return OpenSsl11XNativeJna.EVP_aes_192_cbc();
    }
    return OpenSsl10XNativeJna.EVP_aes_192_cbc();
}
 
Example #26
Source File: INotesNativeAPI32.java    From domino-jna with Apache License 2.0 4 votes vote down vote up
public short Schedule_GetFirstDetails(
int hCntnr,
int hSchedObj,
IntByReference rethDetailObj,
PointerByReference retpDetail);
 
Example #27
Source File: NotesNativeAPI32.java    From domino-jna with Apache License 2.0 4 votes vote down vote up
public native short MIMEGetRootEntity(
int  hMIMEDir,
PointerByReference retpMIMEEntity);
 
Example #28
Source File: INotesNativeAPI32.java    From domino-jna with Apache License 2.0 4 votes vote down vote up
public short MIMEGetNextSibling(
int hMIMEDir,
Pointer pMIMEEntity,
PointerByReference retpMIMEEntity);
 
Example #29
Source File: Cld2Library.java    From Babler with Apache License 2.0 4 votes vote down vote up
int _ZN4CLD224ExtDetectLanguageSummaryEPKcibPKNS_8CLDHintsEiPNS_8LanguageEPiPdPSt6vectorINS_11ResultChunkESaISA_EES7_Pb(
byte[] buffer, int bufferLength, boolean isPlainText, CLDHints cldHints, int flags,
int[] language3, int[] percent3, double[] normalizedScore3,
PointerByReference resultchunkvector, int[] textBytes, boolean[] isReliable);
 
Example #30
Source File: NotesNativeAPI64.java    From domino-jna with Apache License 2.0 4 votes vote down vote up
public native short MIMEIterateNext(
int  hMIMEDir,
Pointer pTopMIMEEntity,
Pointer pPrevMIMEEntity,
PointerByReference retpMIMEEntity);