Class CLBufferRegion

  • All Implemented Interfaces:
    java.lang.AutoCloseable, NativeResource, Pointer

    public class CLBufferRegion
    extends Struct
    implements NativeResource
    Buffer region struct.

    Member documentation

    • origin – the region offset, in bytes
    • size – the region size, in bytes

    Layout

    
     struct cl_buffer_region {
         size_t origin;
         size_t size;
     }
    • Field Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.
      • ORIGIN, SIZE

        The struct member offsets.
    • Constructor Detail

      • CLBufferRegion

        public CLBufferRegion​(java.nio.ByteBuffer container)
        Creates a CLBufferRegion instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

        The created instance holds a strong reference to the container object.

    • Method Detail

      • sizeof

        public int sizeof()
        Description copied from class: Struct
        Returns sizeof(struct).
        Specified by:
        sizeof in class Struct
      • origin

        public long origin()
        Returns the value of the origin field.
      • size

        public long size()
        Returns the value of the size field.
      • origin

        public CLBufferRegion origin​(long value)
        Sets the specified value to the origin field.
      • size

        public CLBufferRegion size​(long value)
        Sets the specified value to the size field.
      • set

        public CLBufferRegion set​(long origin,
                                  long size)
        Initializes this struct with the specified values.
      • set

        public CLBufferRegion set​(CLBufferRegion src)
        Copies the specified struct data to this struct.
        Parameters:
        src - the source struct
        Returns:
        this struct
      • malloc

        public static CLBufferRegion malloc()
        Returns a new CLBufferRegion instance allocated with memAlloc. The instance must be explicitly freed.
      • calloc

        public static CLBufferRegion calloc()
        Returns a new CLBufferRegion instance allocated with memCalloc. The instance must be explicitly freed.
      • create

        public static CLBufferRegion create​(long address)
        Returns a new CLBufferRegion instance for the specified memory address.
      • createSafe

        @Nullable
        public static CLBufferRegion createSafe​(long address)
        Like create, but returns null if address is NULL.
      • create

        public static CLBufferRegion.Buffer create​(long address,
                                                   int capacity)
        Create a CLBufferRegion.Buffer instance at the specified memory.
        Parameters:
        address - the memory address
        capacity - the buffer capacity
      • createSafe

        @Nullable
        public static CLBufferRegion.Buffer createSafe​(long address,
                                                       int capacity)
        Like create, but returns null if address is NULL.
      • mallocStack

        public static CLBufferRegion mallocStack()
        Returns a new CLBufferRegion instance allocated on the thread-local MemoryStack.
      • callocStack

        public static CLBufferRegion callocStack()
        Returns a new CLBufferRegion instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
      • mallocStack

        public static CLBufferRegion mallocStack​(MemoryStack stack)
        Returns a new CLBufferRegion instance allocated on the specified MemoryStack.
        Parameters:
        stack - the stack from which to allocate
      • callocStack

        public static CLBufferRegion callocStack​(MemoryStack stack)
        Returns a new CLBufferRegion instance allocated on the specified MemoryStack and initializes all its bits to zero.
        Parameters:
        stack - the stack from which to allocate
      • norigin

        public static long norigin​(long struct)
        Unsafe version of origin().
      • nsize

        public static long nsize​(long struct)
        Unsafe version of size().
      • norigin

        public static void norigin​(long struct,
                                   long value)
        Unsafe version of origin.
      • nsize

        public static void nsize​(long struct,
                                 long value)
        Unsafe version of size.