org.jocl.struct
Class PointerStruct

java.lang.Object
  extended by org.jocl.struct.PointerStruct

public class PointerStruct
extends java.lang.Object

A class that offers a functionality similar to the 'Pointer' class of JOCL for the experimental 'struct' support.


Constructor Summary
PointerStruct()
           
 
Method Summary
static org.jocl.Pointer to(Struct... structs)
          Creates a new Pointer to the given Structures.
static
<T extends org.jocl.struct.CLTypes.cl_vector_type>
org.jocl.Pointer
to(T... values)
          Creates a new Pointer to the given vector type values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PointerStruct

public PointerStruct()
Method Detail

to

public static <T extends org.jocl.struct.CLTypes.cl_vector_type> org.jocl.Pointer to(T... values)
Creates a new Pointer to the given vector type values. The given value may not be null, must at least contain one element, and may not contain null elements.

The data of this pointer may not be read on host side. To pass data to a kernel which may later be written into CL vector types, use the Buffers#allocateBuffer(cl_vector_type...) / Buffers#readFromBuffer(ByteBuffer, cl_vector_type...) / Buffers#writeToBuffer(ByteBuffer, cl_vector_type...) methods:

 ByteBuffer buffer = CLTypes.allocateBuffer(values);
 Buffers.writeToBuffer(buffer, values);
 passToKernel(Pointer.to(buffer));
 Buffers.readFromBuffer(buffer, values);
 

Parameters:
values - The vector type values
Returns:
A pointer to the vector
Throws:
java.lang.NullPointerException - If the given values array is null, has a length of 0, or contains null elements

to

public static org.jocl.Pointer to(Struct... structs)
Creates a new Pointer to the given Structures. The array of structures may not be null, must at least contain one element, and may not contain null elements.

The data of this pointer may not be read on host side. To pass data to a kernel which may later be written into Structs, use the Buffers.allocateBuffer(Struct...) / Buffers.readFromBuffer(ByteBuffer, Struct...) / Buffers.writeToBuffer(ByteBuffer, Struct...) methods:

 ByteBuffer buffer = Struct.allocateBuffer(structs);
 Buffers.writeToBuffer(buffer, values);
 passToKernel(Pointer.to(buffer));
 Buffers.readFromBuffer(buffer, structs);
 

Parameters:
structs - The structures that the pointer will point to
Returns:
The pointer
Throws:
java.lang.IllegalArgumentException - If the given array is null, has a length of 0 or contains null objects