/** * Allocates enough memory for the array and copies it. * * @param array the array to copy * @see #put(int[]) */ public IntPointer(int ... array) { this(array.length); put(array); } /**
/** @return {@code put(array, 0, array.length)} */ public IntPointer put(int ... array) { return put(array, 0, array.length); } /**
/** @return {@code put(0, j)} */ public IntPointer put(int j) { return put(0, j); } /**
/** * Copies the String code points into native memory, including a terminating null int. * Sets the limit to just before the terminating null code point. * * @param s the String to copy * @return this * @see String#codePointAt(int) * @see #put(int[]) */ public IntPointer putString(String s) { int[] codePoints = new int[s.length()]; for (int i = 0; i < codePoints.length; i++) { codePoints[i] = s.codePointAt(i); } return put(codePoints).put(codePoints.length, (int)0).limit(codePoints.length); }
@Override public void release() { pointer.position(position).put(array); super.release(); } };
/** * For direct buffers, calls {@link Pointer#Pointer(Buffer)}, while for buffers * backed with an array, allocates enough memory for the array and copies it. * * @param buffer the Buffer to reference or copy * @see #put(int[]) */ public IntPointer(IntBuffer buffer) { super(buffer); if (buffer != null && !buffer.isDirect() && buffer.hasArray()) { int[] array = buffer.array(); allocateArray(array.length - buffer.arrayOffset()); put(array, buffer.arrayOffset(), array.length - buffer.arrayOffset()); position(buffer.position()); limit(buffer.limit()); } } /**
public BaseDataBuffer(int[] data, boolean copy, MemoryWorkspace workspace) { allocationMode = AllocUtil.getAllocationModeFromContext(); length = data.length; underlyingLength = data.length; attached = true; parentWorkspace = workspace; initTypeAndSize(); //log.info("Allocating FloatPointer from array of {} elements", data.length); pointer = workspace.alloc(data.length * getElementSize(), dataType(), false).asIntPointer().put(data); workspaceGenerationId = workspace.getGenerationId(); indexer = IntIndexer.create((IntPointer) pointer); //wrappedBuffer = pointer.asByteBuffer(); }
number = lockCounter.incrementAndGet(); new IntPointer(mutex).put(0, number); lockArray.put(number, new ReentrantLock()); return 0;
number = lockCounter.incrementAndGet(); new IntPointer(mutex).put(0, number); lockArray.put(number, new ReentrantLock()); return 0;
pointer.put(idx, op.getArguments().size()); pointer.put(idx + 1, op.getShapes().size()); pointer.put(idx + 2, op.getIndexingArguments().size()); pointer.put(idx + 3, op.getRealArguments().size()); pointer.put(idx + 4, op.getIntArrayArguments().size()); pointer.put(idx + e, op.getIndexingArguments().get(e)); for (int x = 0; x < op.getIntArrayArguments().get(e).length; x++) { idx = intArraysPos + step + x; pointer.put(idx, op.getIntArrayArguments().get(e)[x]);
public IplImage getResultImage() { if (imageUpdateNeeded) { cvSetZero(binaryImage); cvFillPoly(binaryImage, contourPoints, intPointer.put(contourPointsSize), 1, CvScalar.WHITE, 8, 0); pt1.put((byte)16, edgeX, edgeY); cvCircle(binaryImage, pt1, 5<<16, CvScalar.GRAY, 2, 8, 16); pt1.put((byte)16, centerX-5, centerY-5); pt2.put((byte)16, centerX+5, centerY+5); cvRectangle(binaryImage, pt1, pt2, CvScalar.GRAY, 2, 8, 16); pt1.put((byte)16, imageTipX-5, imageTipY-5); pt2.put((byte)16, imageTipX+5, imageTipY+5); cvLine(binaryImage, pt1, pt2, CvScalar.GRAY, 2, 8, 16); pt1.put((byte)16, imageTipX-5, imageTipY+5); pt2.put((byte)16, imageTipX+5, imageTipY-5); cvLine(binaryImage, pt1, pt2, CvScalar.GRAY, 2, 8, 16); cvResetImageROI(binaryImage); imageUpdateNeeded = false; } return binaryImage; }
pointer.put(idx, op.getArguments().size()); pointer.put(idx + 1, op.getShapes().size()); pointer.put(idx + 2, op.getIndexingArguments().size()); pointer.put(idx + 3, op.getRealArguments().size()); pointer.put(idx + 4, op.getIntArrayArguments().size()); pointer.put(idx + e, op.getIndexingArguments().get(e)); for (int x = 0; x < op.getIntArrayArguments().get(e).length; x++) { idx = intArraysPos + step + x; pointer.put(idx, op.getIntArrayArguments().get(e)[x]);
IntBuffer b = (IntBuffer)samples[i]; if (samples_in[i] instanceof IntPointer && samples_in[i].capacity() >= inputSize && b.hasArray()) { ((IntPointer)samples_in[i]).position(0).put(b.array(), samples[i].position(), inputSize); } else { samples_in[i] = new IntPointer(b);
IntBuffer b = (IntBuffer)samples[i]; if (samples_in[i] instanceof IntPointer && samples_in[i].capacity() >= inputSize && b.hasArray()) { ((IntPointer)samples_in[i]).position(0).put(b.array(), samples[i].position(), inputSize); } else { samples_in[i] = new IntPointer(b);
ptrIndices.put(cnt, reverseMap.get(key));