本文整理汇总了Java中com.sun.jna.ptr.PointerByReference类的典型用法代码示例。如果您正苦于以下问题:Java PointerByReference类的具体用法?Java PointerByReference怎么用?Java PointerByReference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PointerByReference类属于com.sun.jna.ptr包,在下文中一共展示了PointerByReference类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: engiGetAggrElement
import com.sun.jna.ptr.PointerByReference; //导入依赖的package包/类
/**
* Returns a data field in the actual aggregate element.
*
* @param aggregate
* Existing aggregation
* @param elementIndex
* Position in the existing aggregation, first position is 0
* @param valueType
* Type of output value
* @return Value of the specific element in the aggregation
*/
public Object engiGetAggrElement(Pointer aggregate, int elementIndex, SdaiTypes valueType) {
Object returnValue = null;
switch (valueType) {
case INTEGER:
IntByReference intRef = new IntByReference();
engine.engiGetAggrElement(aggregate, elementIndex, valueType.ordinal(), intRef);
returnValue = new Integer(intRef.getValue());
break;
case REAL:
DoubleByReference dblRef = new DoubleByReference();
engine.engiGetAggrElement(aggregate, elementIndex, valueType.ordinal(), dblRef);
returnValue = new Double(dblRef.getValue());
break;
case STRING:
PointerByReference strRef = new PointerByReference();
engine.engiGetAggrElement(aggregate, elementIndex, valueType.ordinal(), strRef);
Pointer strPtr = strRef.getValue();
if (strPtr != null)
returnValue = strPtr.getString(0);
break;
default:
PointerByReference ptrRef = new PointerByReference();
engine.engiGetAggrElement(aggregate, elementIndex, valueType.ordinal(), ptrRef);
returnValue = ptrRef.getValue();
break;
}
return returnValue;
}
示例2: sdaiGetAggrByIterator
import com.sun.jna.ptr.PointerByReference; //导入依赖的package包/类
/**
* Implementation postponed till version 1.10
*
* @param iterator
* Existing iterator
* @param valueType
* Type of output value
* @return
*/
public Object sdaiGetAggrByIterator(Pointer iterator, SdaiTypes valueType) {
Object returnValue = null;
switch (valueType) {
case REAL:
DoubleByReference dVal = new DoubleByReference();
engine.sdaiGetAggrByIterator(iterator, valueType.ordinal(), dVal);
returnValue = new Double(dVal.getValue());
break;
case INTEGER:
case BOOLEAN:
case LOGICAL:
IntByReference iVal = new IntByReference();
engine.sdaiGetAggrByIterator(iterator, valueType.ordinal(), iVal);
returnValue = new Integer(iVal.getValue());
break;
case STRING:
PointerByReference sVal = new PointerByReference();
engine.sdaiGetAggrByIterator(iterator, valueType.ordinal(), sVal);
returnValue = (String) sVal.getValue().getString(0);
break;
default:
PointerByReference ptr = new PointerByReference();
engine.sdaiGetAggrByIterator(iterator, valueType.ordinal(), ptr);
returnValue = ptr.getValue();
break;
}
return returnValue;
}
示例3: macImpl
import com.sun.jna.ptr.PointerByReference; //导入依赖的package包/类
/** try to install our custom rule profile into sandbox_init() to block execution */
private static void macImpl(Path tmpFile) throws IOException {
// first be defensive: we can give nice errors this way, at the very least.
boolean supported = Constants.MAC_OS_X;
if (supported == false) {
throw new IllegalStateException("bug: should not be trying to initialize seatbelt for an unsupported OS");
}
// we couldn't link methods, could be some really ancient OS X (< Leopard) or some bug
if (libc_mac == null) {
throw new UnsupportedOperationException("seatbelt unavailable: could not link methods. requires Leopard or above.");
}
// write rules to a temporary file, which will be passed to sandbox_init()
Path rules = Files.createTempFile(tmpFile, "es", "sb");
Files.write(rules, Collections.singleton(SANDBOX_RULES), StandardCharsets.UTF_8);
boolean success = false;
try {
PointerByReference errorRef = new PointerByReference();
int ret = libc_mac.sandbox_init(rules.toAbsolutePath().toString(), SANDBOX_NAMED, errorRef);
// if sandbox_init() fails, add the message from the OS (e.g. syntax error) and free the buffer
if (ret != 0) {
Pointer errorBuf = errorRef.getValue();
RuntimeException e = new UnsupportedOperationException("sandbox_init(): " + errorBuf.getString(0));
libc_mac.sandbox_free_error(errorBuf);
throw e;
}
logger.debug("OS X seatbelt initialization successful");
success = true;
} finally {
if (success) {
Files.delete(rules);
} else {
IOUtils.deleteFilesIgnoringExceptions(rules);
}
}
}
示例4: st_mobile_face_attribute_detect
import com.sun.jna.ptr.PointerByReference; //导入依赖的package包/类
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
);
示例5: close
import com.sun.jna.ptr.PointerByReference; //导入依赖的package包/类
public void close() {
if (formatContext != null) {
PointerByReference ptr = new PointerByReference(formatContext.getPointer());
Avformat57Library.INSTANCE.avformat_close_input(ptr);
}
formatContext = null;
buffer = null;
}
示例6: getString
import com.sun.jna.ptr.PointerByReference; //导入依赖的package包/类
public String getString() {
final PointerByReference ref = new PointerByReference();
ChromaprintLibrary.INSTANCE.chromaprint_get_fingerprint(context, ref);
String fp = ref.getValue().getString(0);
ChromaprintLibrary.INSTANCE.chromaprint_dealloc(ref.getPointer());
return fp;
}
示例7: plan
import com.sun.jna.ptr.PointerByReference; //导入依赖的package包/类
public boolean plan() {
ArrayList<PoseSteering> finalPath = new ArrayList<PoseSteering>();
for (int i = 0; i < this.goal.length; i++) {
Pose start_ = null;
Pose goal_ = this.goal[i];
if (i == 0) start_ = this.start;
else start_ = this.goal[i-1];
path = new PointerByReference();
pathLength = new IntByReference();
if (collisionCircleCenters == null) {
if (!INSTANCE.plan(mapFilename, mapResolution, robotRadius, start_.getX(), start_.getY(), start_.getTheta(), goal_.getX(), goal_.getY(), goal_.getTheta(), path, pathLength, distanceBetweenPathPoints, turningRadius)) return false;
}
else {
double[] xCoords = new double[collisionCircleCenters.length];
double[] yCoords = new double[collisionCircleCenters.length];
int numCoords = collisionCircleCenters.length;
for (int j = 0; j < collisionCircleCenters.length; j++) {
xCoords[j] = collisionCircleCenters[j].x;
yCoords[j] = collisionCircleCenters[j].y;
}
System.out.println("Path planning with " + collisionCircleCenters.length + " circle positions");
if (this.mapFilename != null) {
if (!INSTANCE.plan_multiple_circles(mapFilename, mapResolution, robotRadius, xCoords, yCoords, numCoords, start_.getX(), start_.getY(), start_.getTheta(), goal_.getX(), goal_.getY(), goal_.getTheta(), path, pathLength, distanceBetweenPathPoints, turningRadius)) return false;
}
else {
if (!INSTANCE.plan_multiple_circles_nomap(xCoords, yCoords, numCoords, start_.getX(), start_.getY(), start_.getTheta(), goal_.getX(), goal_.getY(), goal_.getTheta(), path, pathLength, distanceBetweenPathPoints, turningRadius)) return false;
}
}
final Pointer pathVals = path.getValue();
final PathPose valsRef = new PathPose(pathVals);
valsRef.read();
int numVals = pathLength.getValue();
PathPose[] pathPoses = (PathPose[])valsRef.toArray(numVals);
if (i == 0) finalPath.add(new PoseSteering(pathPoses[0].x, pathPoses[0].y, pathPoses[0].theta, 0.0));
for (int j = 1; j < pathPoses.length; j++) finalPath.add(new PoseSteering(pathPoses[j].x, pathPoses[j].y, pathPoses[j].theta, 0.0));
INSTANCE.cleanupPath(pathVals);
}
this.pathPS = finalPath.toArray(new PoseSteering[finalPath.size()]);
return true;
}
示例8: init
import com.sun.jna.ptr.PointerByReference; //导入依赖的package包/类
/**
* Initializes Tesseract engine.
*/
protected void init() {
handle = TessBaseAPICreate();
StringArray sarray = new StringArray(configList.toArray(new String[0]));
PointerByReference configs = new PointerByReference();
configs.setPointer(sarray);
TessBaseAPIInit1(handle, datapath, language, ocrEngineMode, configs, configList.size());
if (psm > -1) {
TessBaseAPISetPageSegMode(handle, psm);
}
}
示例9: chromaprint_get_fingerprint
import com.sun.jna.ptr.PointerByReference; //导入依赖的package包/类
@Test
public void chromaprint_get_fingerprint() throws Exception {
ChromaprintLibrary.INSTANCE.chromaprint_start(context, 44100, 1);
short[] data = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
ChromaprintLibrary.INSTANCE.chromaprint_feed(context, data, data.length);
ChromaprintLibrary.INSTANCE.chromaprint_finish(context);
final PointerByReference ref = new PointerByReference();
ChromaprintLibrary.INSTANCE.chromaprint_get_fingerprint(context, ref);
System.out.println(ref.getValue().getString(0));
}
示例10: AVCodecDescriptor
import com.sun.jna.ptr.PointerByReference; //导入依赖的package包/类
/**
* @param id @see AVCodecID<br>
* C type : AVCodecID<br>
* @param type @see org.ffmpeg.avutil55.Avutil55Library#AVMediaType<br>
* C type : AVMediaType<br>
* @param name C type : const char*<br>
* @param long_name C type : const char*<br>
* @param mime_types C type : const char**<br>
* @param profiles C type : AVProfile*
*/
public AVCodecDescriptor(int id, int type, Pointer name, Pointer long_name, int props, PointerByReference mime_types, org.ffmpeg.avcodec57.AVProfile.ByReference profiles) {
super();
this.id = id;
this.type = type;
this.name = name;
this.long_name = long_name;
this.props = props;
this.mime_types = mime_types;
this.profiles = profiles;
}
示例11: GetQueuedCompletionStatus
import com.sun.jna.ptr.PointerByReference; //导入依赖的package包/类
boolean GetQueuedCompletionStatus(HANDLE CompletionPort,
IntByReference lpNumberOfBytes, ByReference lpCompletionKey,
PointerByReference lpOverlapped, int dwMilliseconds);
示例12: compile
import com.sun.jna.ptr.PointerByReference; //导入依赖的package包/类
/**
* compile an expression into a database to use for scanning
* @param expression Expression to compile
* @return Compiled database
* @throws Throwable CompileErrorException on errors concerning the pattern, otherwise different Throwable's
*/
public static Database compile(Expression expression) throws Throwable {
PointerByReference database = new PointerByReference();
PointerByReference error = new PointerByReference();
int hsError = HyperscanLibrary.INSTANCE.hs_compile(expression.getExpression(),
Util.bitEnumSetToInt(expression.getFlags()), HS_MODE_BLOCK, Pointer.NULL, database, error);
ArrayList<Expression> expressions = new ArrayList<Expression>(1);
expressions.add(expression);
handleErrors(hsError, error.getValue(), expressions);
return new Database(database.getValue(), expressions);
}
示例13: hs_compile_multi
import com.sun.jna.ptr.PointerByReference; //导入依赖的package包/类
int hs_compile_multi(String[] expressions, int[] flags, int[] ids, int elements, int mode, Pointer platform,
PointerByReference database, PointerByReference error);
示例14: st_mobile_face_attribute_create
import com.sun.jna.ptr.PointerByReference; //导入依赖的package包/类
int st_mobile_face_attribute_create(
String model_path,
PointerByReference handle
);
示例15: tryRead
import com.sun.jna.ptr.PointerByReference; //导入依赖的package包/类
@Nullable
public byte[] tryRead(byte[] buf) throws FFmpegException {
if (formatContext == null) throw new IllegalStateException("Decoder is already closed");
int retval;
while (true) {
retval = Avformat57Library.INSTANCE.av_read_frame(formatContext, packet);
if (retval < 0) return null;
packet.read();
if (packet.stream_index != audioStreamIndex) {
Avcodec57Library.INSTANCE.av_packet_unref(packet);
} else break;
}
retval = Avcodec57Library.INSTANCE.avcodec_send_packet(codecContext, packet.getPointer());
if (retval < 0 && retval != -11 && retval != AVERROR_EOF) {
throw new FFmpegException("Decode packet failed! avcodec_send_packet returned " + retval);
}
AVFrame frame = Avutil55Library.INSTANCE.av_frame_alloc();
retval = Avcodec57Library.INSTANCE.avcodec_receive_frame(codecContext, frame);
if (retval < 0 && retval != AVERROR_EOF) {
throw new FFmpegException("Decode packet failed! avcodec_receive_frame returned " + retval);
}
frame.read();
updatePosition(frame);
fixFrameArgs(frame);
long destNumSamplesPerChannel =
Avutil55Library.INSTANCE.av_rescale_rnd(
Swresample2Library.INSTANCE.swr_get_delay(swrContext, frame.sample_rate) + frame.nb_samples,
frame.sample_rate, frame.sample_rate, 0);
PointerByReference tempPtr = new PointerByReference(audioBuffer);
int numSamples = Swresample2Library.INSTANCE.swr_convert(swrContext, tempPtr,
(int) destNumSamplesPerChannel, frame.data, frame.nb_samples);
int dataSize = frame.channels * numSamples * Avutil55Library.INSTANCE.av_get_bytes_per_sample(sampleFormat);
Avutil55Library.INSTANCE.av_frame_free(new PointerByReference(frame.getPointer()));
audioBuffer = tempPtr.getValue();
if (buf != null && buf.length == dataSize) {
audioBuffer.read(0, buf, 0, dataSize);
return buf;
}
return audioBuffer.getByteArray(0, dataSize);
}