org.jocl.struct
Class Struct

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

public abstract class Struct
extends java.lang.Object

This class is the base class for all Java classes that should represent a native 'struct'. A struct class may be created by creating a public class that extends this Struct class, and which contains public fields. All public non-volatile fields will be considered as fields that correspond to the element of native struct.

Example:

The class

 public class Particle extends Struct
 {
     public float mass;
     public cl_float4 position;
     public cl_float4 velocity;
 }
 
Corresponds to a native struct like
 typedef struct Particle
 {
     float mass;
     float4 position;
     float4 velocity;
 } Particle;
 

All fields of the derived class must either be primitive fields, one of the OpenCL vector types defined in CLTypes, other Structs or arrays of these types (except for boolean arrays). Structs containing instances of themself are not supported and will cause a CLException to be thrown during the initialization of the Struct.


Constructor Summary
protected Struct()
          Creates a new instance of a struct.
 
Method Summary
static void showLayout(java.lang.Class<? extends Struct> structClass)
          Debug function which prints the alignment layout of the given struct class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Struct

protected Struct()
Creates a new instance of a struct.

Method Detail

showLayout

public static void showLayout(java.lang.Class<? extends Struct> structClass)
Debug function which prints the alignment layout of the given struct class.

This function is for debugging purposes ONLY!

Parameters:
structClass - The class