org.jocl.struct
Class SizeofStruct

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

public class SizeofStruct
extends java.lang.Object

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


Constructor Summary
SizeofStruct()
           
 
Method Summary
static int sizeof(java.lang.Class<?> c)
          Returns the size of the given type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SizeofStruct

public SizeofStruct()
Method Detail

sizeof

public static int sizeof(java.lang.Class<?> c)
Returns the size of the given type. If the given type is a type from CLTypes, then this simply returns its size, e.g.
Sizeof.type(cl_short4) == Sizeof.cl_short4

If the given type is one of the ports of the other cl_* types (e.g. a cl_device_id or cl_command_queue) then the size of a native pointer will be returned.
If the given type extends the Struct class, then the size of the whole structure, including padding that is required for the alignment in OpenCL, is computed and returned.

Otherwise, an IllegalArgumentException is thrown

Parameters:
c - The class
Returns:
The size of the given class
Throws:
java.lang.IllegalArgumentException - If the given class is neither a type from CLTypes, nor a cl_* type, nor a Struct.