Package org.jocl

Class NativePointerObject

java.lang.Object
org.jocl.NativePointerObject
Direct Known Subclasses:
cl_abstract_properties, cl_command_queue, cl_context, cl_device_id, cl_event, cl_kernel, cl_mem, cl_platform_id, cl_program, cl_sampler, Pointer

public class NativePointerObject extends Object
Base class for all classes that store a native pointer
  • Field Details

    • nativePointer

      private long nativePointer
      The native pointer, written by native methods
    • byteOffset

      private long byteOffset
      The offset from the nativePointer, in bytes
    • buffer

      private Buffer buffer
      The buffer the pointer points to
    • pointers

      private NativePointerObject[] pointers
      The array of pointers this pointer points to
  • Constructor Details

    • NativePointerObject

      protected NativePointerObject()
      Creates a new (null) Pointer
    • NativePointerObject

      NativePointerObject(Buffer buffer)
      Creates a Pointer to the given Buffer
      Parameters:
      buffer - The buffer to point to
    • NativePointerObject

      NativePointerObject(NativePointerObject[] pointers)
      Creates a Pointer to the given array of pointers
      Parameters:
      pointers - The array the pointer points to
    • NativePointerObject

      NativePointerObject(NativePointerObject other)
      Copy constructor
      Parameters:
      other - The other Pointer
    • NativePointerObject

      NativePointerObject(NativePointerObject other, long byteOffset)
      Creates a copy of the given pointer, with an additional byte offset
      Parameters:
      other - The other pointer
      byteOffset - The additional byte offset
  • Method Details

    • getNativePointer

      public long getNativePointer()
      Method to obtain the native pointer value. Clients should usually not use this pointer value directly. It is only intended for interoperability with other JNI based libraries.
      Returns:
      The native pointer value
    • getByteOffset

      long getByteOffset()
      Returns the byte offset
      Returns:
      The byte offset
    • setBuffer

      void setBuffer(Buffer buffer)
      Set the given buffer as the contents of this Pointer
      Parameters:
      buffer - The buffer to set
    • getBuffer

      Buffer getBuffer()
      Returns the Buffer of this Pointer
      Returns:
      The Buffer of this Pointer
    • withByteOffset

      NativePointerObject withByteOffset(long byteOffset)
      Returns a new pointer with an offset of the given number of bytes
      Parameters:
      byteOffset - The byte offset for the pointer
      Returns:
      The new pointer with the given byte offset
    • toString

      public String toString()
      Returns a String representation of this object.
      Overrides:
      toString in class Object
      Returns:
      A String representation of this object.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object