org.jocl.cloth
Interface ResourceHandle<T>

Type Parameters:
T - The resource type
All Known Implementing Classes:
SharedMemHandle, SimpleFloatBufferHandle, SimpleMemHandle, VBOFloatBufferHandle

interface ResourceHandle<T>

Interface for classes that act as a handle to a resource that may have to be acquired before it can be used, and to be released after it has been used.
This interface is mainly intended to factor out the different usage of memory objects or buffers that have been created directly or by sharing OpenGL resources.


Method Summary
 void acquire()
          Has to be called before the resource may be obtained
 T get()
          Returns the resource from this handle.
 void release()
          Has to be called as soon as the resource is not used any more
 

Method Detail

get

T get()
Returns the resource from this handle. Note that this resource may only be valid between calls to acquire() and release(). Clients should preferably not store the returned object, but always access the resource by calling this method. This method may return null if the resource has not properly been acquired.

Returns:
The resource

acquire

void acquire()
Has to be called before the resource may be obtained


release

void release()
Has to be called as soon as the resource is not used any more