Package org.bytedeco.javacpp
Class DoublePointer
- java.lang.Object
-
- org.bytedeco.javacpp.Pointer
-
- org.bytedeco.javacpp.DoublePointer
-
- All Implemented Interfaces:
java.lang.AutoCloseable
@Properties(inherit=javacpp.class) public class DoublePointer extends Pointer
The peer class to native pointers and arrays ofdouble
. All operations take into account the position and limit, when appropriate.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.bytedeco.javacpp.Pointer
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.DeallocatorReference, Pointer.DeallocatorThread, Pointer.NativeDeallocator, Pointer.ProxyDeallocator, Pointer.ReferenceCounter
-
-
Field Summary
Fields Modifier and Type Field Description private static Logger
logger
-
Fields inherited from class org.bytedeco.javacpp.Pointer
address, capacity, deallocatorThread, limit, maxBytes, maxPhysicalBytes, maxRetries, position
-
-
Constructor Summary
Constructors Constructor Description DoublePointer()
DoublePointer(double... array)
Allocates enough memory for the array and copies it.DoublePointer(long size)
Allocates a nativedouble
array of the given size.DoublePointer(java.nio.DoubleBuffer buffer)
For direct buffers, callsPointer(Buffer)
, while for buffers backed with an array, allocates enough memory for the array and copies it.DoublePointer(Pointer p)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
allocateArray(long size)
java.nio.DoubleBuffer
asBuffer()
Same asPointer.asByteBuffer()
, but can be overridden to return subclasses of Buffer.DoublePointer
capacity(long capacity)
Sets the capacity and returns this.double
get()
DoublePointer
get(double[] array)
DoublePointer
get(double[] array, int offset, int length)
Reads a portion of the native array into a Java array.double
get(long i)
DoublePointer
getPointer(long i)
ReturnsgetPointer(getClass(), i)
.DoublePointer
limit(long limit)
Sets the limit and returns this.DoublePointer
position(long position)
Sets the position and returns this.DoublePointer
put(double d)
DoublePointer
put(double... array)
DoublePointer
put(double[] array, int offset, int length)
Writes a portion of a Java array into the native array.DoublePointer
put(long i, double d)
Copies thedouble
value to the i-th element of a native array.int
sizeof()
Returns 1 for Pointer or BytePointer elseLoader.sizeof(getClass())
or -1 on error.-
Methods inherited from class org.bytedeco.javacpp.Pointer
address, asByteBuffer, availablePhysicalBytes, calloc, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, getDirectBufferAddress, getPointer, getPointer, getPointer, hashCode, init, interruptDeallocatorThread, isNull, isNull, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetAddress, offsetof, offsetof, parseBytes, physicalBytes, physicalBytesInaccurate, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, toString, totalBytes, totalCount, totalPhysicalBytes, withDeallocator, zero
-
-
-
-
Field Detail
-
logger
private static final Logger logger
-
-
Constructor Detail
-
DoublePointer
public DoublePointer(double... array)
Allocates enough memory for the array and copies it.- Parameters:
array
- the array to copy- See Also:
put(double[])
-
DoublePointer
public DoublePointer(java.nio.DoubleBuffer buffer)
For direct buffers, callsPointer(Buffer)
, while for buffers backed with an array, allocates enough memory for the array and copies it.- Parameters:
buffer
- the Buffer to reference or copy- See Also:
put(double[])
-
DoublePointer
public DoublePointer(long size)
Allocates a nativedouble
array of the given size.- Parameters:
size
- the number ofdouble
elements to allocate
-
DoublePointer
public DoublePointer()
- See Also:
Pointer()
-
DoublePointer
public DoublePointer(Pointer p)
- See Also:
Pointer(Pointer)
-
-
Method Detail
-
allocateArray
private void allocateArray(long size)
-
position
public DoublePointer position(long position)
Description copied from class:Pointer
Sets the position and returns this. That makes thearray.position(i)
statement sort of equivalent to thearray[i]
statement in C++.- Overrides:
position
in classPointer
- Parameters:
position
- the new position- Returns:
- this
- See Also:
Pointer.position(long)
-
limit
public DoublePointer limit(long limit)
Description copied from class:Pointer
Sets the limit and returns this. Used to limit the size of an operation on this object.- Overrides:
limit
in classPointer
- Parameters:
limit
- the new limit- Returns:
- this
- See Also:
Pointer.limit(long)
-
capacity
public DoublePointer capacity(long capacity)
Description copied from class:Pointer
Sets the capacity and returns this. Should not be called more than once after allocation.- Overrides:
capacity
in classPointer
- Parameters:
capacity
- the new capacity- Returns:
- this
- See Also:
Pointer.capacity(long)
-
sizeof
public int sizeof()
Description copied from class:Pointer
Returns 1 for Pointer or BytePointer elseLoader.sizeof(getClass())
or -1 on error.
-
getPointer
public DoublePointer getPointer(long i)
Description copied from class:Pointer
ReturnsgetPointer(getClass(), i)
.- Overrides:
getPointer
in classPointer
-
get
public double get()
- Returns:
get(0)
-
get
public double get(long i)
- Returns:
- the i-th
double
value of a native array
-
put
public DoublePointer put(double d)
- Returns:
put(0, d)
-
put
public DoublePointer put(long i, double d)
Copies thedouble
value to the i-th element of a native array.- Parameters:
i
- the index into the arrayd
- thedouble
value to copy- Returns:
- this
-
get
public DoublePointer get(double[] array)
- Returns:
get(array, 0, array.length)
-
put
public DoublePointer put(double... array)
- Returns:
put(array, 0, array.length)
-
get
public DoublePointer get(double[] array, int offset, int length)
Reads a portion of the native array into a Java array.- Parameters:
array
- the array to write tooffset
- the offset into the array where to start writinglength
- the length of data to read and write- Returns:
- this
-
put
public DoublePointer put(double[] array, int offset, int length)
Writes a portion of a Java array into the native array.- Parameters:
array
- the array to read fromoffset
- the offset into the array where to start readinglength
- the length of data to read and write- Returns:
- this
-
asBuffer
public final java.nio.DoubleBuffer asBuffer()
Description copied from class:Pointer
Same asPointer.asByteBuffer()
, but can be overridden to return subclasses of Buffer.- Overrides:
asBuffer
in classPointer
- Returns:
asByteBuffer().asDoubleBuffer()
- See Also:
BytePointer.asBuffer()
,ShortPointer.asBuffer()
,IntPointer.asBuffer()
,LongPointer.asBuffer()
,FloatPointer.asBuffer()
,asBuffer()
,CharPointer.asBuffer()
-
-