public class NumberByReference extends AbstractNumberReference<Number>
For example, the following C code,
extern void get_size(ssize_t *sp);
ssize_t foo(void) {
ssize_t n;
// pass a reference to 'n' so get_size() can fill it out
get_size(&n);
return n;
}
Would be declared in java as
interface Lib {
void get_size(@Out NumberByReference ap);
}
and used like this
NumberByReference size = new NumberByReference(ssize_t);
lib.get_size(size);
System.out.printf("size from lib=%d\n", size.longValue());
Constructor and Description |
---|
NumberByReference(TypeAlias typeAlias) |
NumberByReference(TypeAlias typeAlias,
Number value) |
Modifier and Type | Method and Description |
---|---|
void |
fromNative(Runtime runtime,
Pointer memory,
long offset)
Copies the java value from native memory
|
int |
nativeSize(Runtime runtime)
Gets the size of the native buffer required to store the value
|
void |
toNative(Runtime runtime,
Pointer memory,
long offset)
Copies the java value to native memory
|
byteValue, checkNull, doubleValue, floatValue, getValue, intValue, longValue, shortValue
public NumberByReference(TypeAlias typeAlias)
public int nativeSize(Runtime runtime)
ByReference
runtime
- The current runtime.public void fromNative(Runtime runtime, Pointer memory, long offset)
ByReference
runtime
- The current runtime.memory
- the native memory buffer.offset
- The offset of the field.public void toNative(Runtime runtime, Pointer memory, long offset)
ByReference
runtime
- The current runtime.memory
- The native memory buffer.offset
- The offset of the field.Copyright © 2017. All rights reserved.