org.jouvieje.fmodex.utils
Class ObjectPointer

java.lang.Object
  extended byorg.jouvieje.fmodex.utils.Pointer
      extended byorg.jouvieje.fmodex.utils.ObjectPointer

public class ObjectPointer
extends Pointer

Container of a java object to be used by the underlaying native API.

ACCESSING VALUE
If you want to access the Object store in ObjectPointer, use:

  Object o;
  ObjectPointer objectPointer = new ObjectPointer(o);
  // And later
  Object o = (Object)objectPointer.getObject();
 

CLEANING
The Object stored is not deleted automatically by the Garbage Collector.
To delete it, you have to call release on ObjectPointer.


Constructor Summary
ObjectPointer()
          Create an object that holds a null ObjectPointer.
 
Method Summary
static ObjectPointer allocate(java.lang.Object obj)
          Create a new ObjectPointer.
static ObjectPointer asObjectPointer(Pointer pointer)
          Create a view of the Pointer as a ObjectPointer object.
 java.lang.Object getObject()
           
 java.lang.Object getValue()
           
 void release()
           
 void setObject(java.lang.Object obj)
           
 
Methods inherited from class org.jouvieje.fmodex.utils.Pointer
asByteBuffer, asDouble, asFloat, asInt, asLong, asPointer, asString, asString, equals, isNull, shareMemory
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectPointer

public ObjectPointer()
Create an object that holds a null ObjectPointer.
The call isNull() on the object created will returns true.
  ObjectPointer obj = new ObjectPointer();
  (obj == null) <=> false
  obj.isNull() <=> true
 
To creates a new ObjectPointer, use the static "constructor" :
  ObjectPointer obj = ObjectPointer.allocate();

See Also:
allocate(Object)
Method Detail

asObjectPointer

public static ObjectPointer asObjectPointer(Pointer pointer)
Create a view of the Pointer as a ObjectPointer object.
This view is valid only if the memory holded by the Pointer holds an Object.


allocate

public static ObjectPointer allocate(java.lang.Object obj)
Create a new ObjectPointer.
The call isNull() on the object created will return false.
  ObjectPointer obj = ObjectPointer.allocate();
  (obj == null) <=> obj.isNull() <=> false
 


release

public void release()

getValue

public java.lang.Object getValue()
Returns:
the object stored in the memory

getObject

public java.lang.Object getObject()
Returns:
the object stored in the memory

setObject

public void setObject(java.lang.Object obj)
Parameters:
obj - object to store in the memory.


NativeFmodEx Project - © Copyright 2005-2010 - Jérôme Jouvie (Jouvieje)
NativeFmodEx is an Open Source Project under GNU LGPL License
My sites : http://jerome.jouvie.free.fr/

(Documentation Copyright © Firelight Technologies - FMOD Ex - http://www.fmod.org)