crystalspace.jbind.impl
Class csNativeObject

java.lang.Object
  extended bycrystalspace.jbind.impl.csNativeObject
All Implemented Interfaces:
iPointer
Direct Known Subclasses:
csBase, csBitmapMetrics, csBox2, csBox3, csClipInfo, csColor, csCommandLineHelper, csDVector3, csDVector4, csEffectVector4, csEventCommandData, csEventJoystickData, csEventMouseData, csEventNetworkData, csFlags, csFog, csFogInfo, csFrustum, csFrustumContext, csGlyphMetrics, csGraphics3DCaps, csImageArea, csInitializer, csKeyEventData, csMatrix3, csMeshedPolygon, csMeshedPolygonArray, csNativeByteArray, csNativeIntArray, csPixelCoord, csPixelFormat, csPlane2, csPlane3, csPoly2D, csPolyTextureMapping, csQuaternion, csRect, csRefCount, csRenderContext, csRenderContextFrustum, csRenderMesh, csRenderMeshArray, csRenderMeshList, csRGBcolor, csRGBpixel, csSegment2, csSegment3, csSet_iMeshWrapper, csShaderVariableProxy, csShaderVariableProxyList, csSimpleRenderMesh, csSoundFormat, csSphere, csTextureLayer, csTransform, csTriangle, csTriangleArray, csVector2, csVector2Array, csVector3, csVector3Array, csVector4, csVertexArrayPool, csVertexStatus, G3DCam2TextureTransform, G3DFogInfo, G3DPolygonDFP, G3DPolygonDPFX, G3DPolygonMesh, G3DTriangleMesh

public abstract class csNativeObject
extends java.lang.Object
implements iPointer

All crystal space Java wrapper which wrap a native object, subclass this class.

Author:
Quentin Anciaux

Field Summary
protected static csNOM ImplFactory
          Get a reference to the Native Object Manager
protected  iPointer nPointer
          This variable store the value of the native pointer
 
Constructor Summary
csNativeObject(iPointer nPointer)
          Create a java object which points to the native object nPointer.
 
Method Summary
 void changePointer(long nPointer)
          This method permits to change the value of the pointer.
 boolean equals(java.lang.Object obj)
           
 void finalize()
          Finalize the java object, if memoryowner of the native pointer and the pointer is valid, delete the native object.
 long getPointer()
          Return the value of the native pointer.
static long getPointer(iPointer pointer)
          Return the value of the pointer given as parameter.
protected static long[] getPointerArray(iPointer[] pointerList)
           
 int hashCode()
           
 boolean isMemoryOwner()
          Return true if java is responsible for deleting the native object.
protected  void isNativePointerValid()
          Check if the native pointer is valid, if not it throws a NullPointerException.
protected abstract  boolean isNativePointerValidSafe(long pointer)
           
protected abstract  void nDelete(long pointer)
           
protected static iPointer newNativeObject(long nativePointer, iPointer caller, java.lang.Class cClass)
          This method create new native object or send back a reference of the caller.
 void setMemoryOwner(boolean owner)
          If set to true - java will delete the native object when the java object is finalized.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ImplFactory

protected static csNOM ImplFactory
Get a reference to the Native Object Manager


nPointer

protected iPointer nPointer
This variable store the value of the native pointer

Constructor Detail

csNativeObject

public csNativeObject(iPointer nPointer)
Create a java object which points to the native object nPointer.

Parameters:
nPointer -
Method Detail

setMemoryOwner

public final void setMemoryOwner(boolean owner)
If set to true - java will delete the native object when the java object is finalized.

Specified by:
setMemoryOwner in interface iPointer
Parameters:
owner -
See Also:
iPointer.setMemoryOwner(boolean)

isMemoryOwner

public final boolean isMemoryOwner()
Return true if java is responsible for deleting the native object.

Specified by:
isMemoryOwner in interface iPointer
Returns:
See Also:
iPointer.isMemoryOwner()

changePointer

public final void changePointer(long nPointer)
This method permits to change the value of the pointer.

Specified by:
changePointer in interface iPointer
Parameters:
nPointer -
See Also:
iPointer.changePointer(long)

getPointer

public final long getPointer()
Return the value of the native pointer.

Specified by:
getPointer in interface iPointer
Returns:
See Also:
iPointer.getPointer()

getPointer

public static final long getPointer(iPointer pointer)
Return the value of the pointer given as parameter.

Parameters:
pointer -
Returns:

finalize

public void finalize()
              throws java.lang.Throwable
Finalize the java object, if memoryowner of the native pointer and the pointer is valid, delete the native object.

Throws:
java.lang.Throwable
See Also:
Object.finalize()

nDelete

protected abstract void nDelete(long pointer)

newNativeObject

protected static iPointer newNativeObject(long nativePointer,
                                          iPointer caller,
                                          java.lang.Class cClass)
This method create new native object or send back a reference of the caller.

Parameters:
nativePointer -
caller -
cClass -
Returns:

isNativePointerValid

protected void isNativePointerValid()
Check if the native pointer is valid, if not it throws a NullPointerException.


isNativePointerValidSafe

protected abstract boolean isNativePointerValidSafe(long pointer)

hashCode

public int hashCode()
See Also:
Object.hashCode()

equals

public boolean equals(java.lang.Object obj)
See Also:
Object.equals(java.lang.Object)

toString

public java.lang.String toString()
See Also:
Object.toString()

getPointerArray

protected static long[] getPointerArray(iPointer[] pointerList)