Package org.bytedeco.javacpp
Class SizeTPointer
- java.lang.Object
-
- org.bytedeco.javacpp.Pointer
-
- org.bytedeco.javacpp.SizeTPointer
-
- All Implemented Interfaces:
java.lang.AutoCloseable
@Name("size_t") @Properties(inherit=javacpp.class) public class SizeTPointer extends Pointer
The peer class to native pointers and arrays ofsize_t
. All operations take into account the position and limit, when appropriate.We need this class because the size differs between 32-bit and 64-bit platforms.
-
-
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 SizeTPointer()
SizeTPointer(long size)
Allocates a nativesize_t
array of the given size.SizeTPointer(long... array)
Allocates enough memory for the array and copies it.SizeTPointer(Pointer p)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
allocateArray(long size)
SizeTPointer
capacity(long capacity)
Sets the capacity and returns this.long
get()
long
get(long i)
SizeTPointer
get(long[] array)
SizeTPointer
get(long[] array, int offset, int length)
Reads a portion of the native array into a Java array.SizeTPointer
getPointer(long i)
ReturnsgetPointer(getClass(), i)
.SizeTPointer
limit(long limit)
Sets the limit and returns this.SizeTPointer
position(long position)
Sets the position and returns this.SizeTPointer
put(long s)
SizeTPointer
put(long... array)
SizeTPointer
put(long[] array, int offset, int length)
Writes a portion of a Java array into the native array.SizeTPointer
put(long i, long s)
Copies thesize_t
value to the i-th element of a native array.-
Methods inherited from class org.bytedeco.javacpp.Pointer
address, asBuffer, 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, sizeof, toString, totalBytes, totalCount, totalPhysicalBytes, withDeallocator, zero
-
-
-
-
Field Detail
-
logger
private static final Logger logger
-
-
Constructor Detail
-
SizeTPointer
public SizeTPointer(long... array)
Allocates enough memory for the array and copies it.- Parameters:
array
- the array to copy- See Also:
put(long[])
-
SizeTPointer
public SizeTPointer(long size)
Allocates a nativesize_t
array of the given size.- Parameters:
size
- the number ofsize_t
elements to allocate
-
SizeTPointer
public SizeTPointer()
- See Also:
Pointer()
-
SizeTPointer
public SizeTPointer(Pointer p)
- See Also:
Pointer(Pointer)
-
-
Method Detail
-
allocateArray
private void allocateArray(long size)
-
position
public SizeTPointer 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 SizeTPointer 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 SizeTPointer 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)
-
getPointer
public SizeTPointer getPointer(long i)
Description copied from class:Pointer
ReturnsgetPointer(getClass(), i)
.- Overrides:
getPointer
in classPointer
-
get
public long get()
- Returns:
get(0)
-
get
@Cast("size_t") public long get(long i)
- Returns:
- the i-th
size_t
value of a native array
-
put
public SizeTPointer put(long s)
- Returns:
put(0, s)
-
put
public SizeTPointer put(long i, long s)
Copies thesize_t
value to the i-th element of a native array.- Parameters:
i
- the index into the arrays
- thesize_t
value to copy- Returns:
- this
-
get
public SizeTPointer get(long[] array)
- Returns:
get(array, 0, array.length)
-
put
public SizeTPointer put(long... array)
- Returns:
put(array, 0, array.length)
-
get
public SizeTPointer get(long[] 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 SizeTPointer put(long[] 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
-
-