Class SizeTPointer

java.lang.Object
org.bytedeco.javacpp.Pointer
org.bytedeco.javacpp.SizeTPointer
All Implemented Interfaces:
AutoCloseable

@Name("size_t") @Properties(inherit=javacpp.class) public class SizeTPointer extends Pointer
The peer class to native pointers and arrays of size_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.

  • Field Details

    • logger

      private static final Logger logger
  • Constructor Details

    • SizeTPointer

      public SizeTPointer(long... array)
      Allocates enough memory for the array and copies it.
      Parameters:
      array - the array to copy
      See Also:
    • SizeTPointer

      public SizeTPointer(long size)
      Allocates a native size_t array of the given size.
      Parameters:
      size - the number of size_t elements to allocate
    • SizeTPointer

      public SizeTPointer()
      See Also:
    • SizeTPointer

      public SizeTPointer(Pointer p)
      See Also:
  • Method Details

    • 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 the array.position(i) statement sort of equivalent to the array[i] statement in C++.
      Overrides:
      position in class Pointer
      Parameters:
      position - the new position
      Returns:
      this
      See Also:
    • 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 class Pointer
      Parameters:
      limit - the new limit
      Returns:
      this
      See Also:
    • 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 class Pointer
      Parameters:
      capacity - the new capacity
      Returns:
      this
      See Also:
    • getPointer

      public SizeTPointer getPointer(long i)
      Description copied from class: Pointer
      Returns getPointer(getClass(), i).
      Overrides:
      getPointer in class Pointer
    • 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 the size_t value to the i-th element of a native array.
      Parameters:
      i - the index into the array
      s - the size_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 to
      offset - the offset into the array where to start writing
      length - 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 from
      offset - the offset into the array where to start reading
      length - the length of data to read and write
      Returns:
      this