com.groovemanager.spi.asio
Class NativeClass

java.lang.Object
  extended by com.groovemanager.spi.asio.NativeClass
Direct Known Subclasses:
ASIOBufferInfo, ASIOChannelInfo, ASIOClockSource, ASIODriverInfo, AsioDrivers, ASIOSampleRate, ASIOSamples, ASIOTime, ASIOTimeCode, AsioTimeInfo, ASIOTimeStamp

abstract class NativeClass
extends Object

An abstract class that can be used for Wrapper classes of native classes or structs

Author:
Manu Robledo

Field Summary
private  long pointer
          The native address of the native instance
private  boolean selfCreated
          Indicates whether a new native instance was created with this class or not.
 
Constructor Summary
NativeClass()
          Create a new instance of this class and also a corresponding new native instance
NativeClass(long pointer)
          Create an instance of this class to an already existing native instance
 
Method Summary
protected abstract  void cleanUp()
          Delete the corresponding native instance to this class
protected abstract  long createClass()
          Create a new native instance and return its address
 void finalize()
          If the native instance was created by this class, then delete it now!
(package private)  long getPointer()
          Get the address of the native instance corresponding to this class
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pointer

private long pointer
The native address of the native instance


selfCreated

private boolean selfCreated
Indicates whether a new native instance was created with this class or not. Is needed for finalize()

Constructor Detail

NativeClass

NativeClass()
Create a new instance of this class and also a corresponding new native instance


NativeClass

NativeClass(long pointer)
Create an instance of this class to an already existing native instance

Parameters:
pointer - The address of the native instance
Method Detail

createClass

protected abstract long createClass()
Create a new native instance and return its address

Returns:
The address of the new created native instance

cleanUp

protected abstract void cleanUp()
Delete the corresponding native instance to this class


getPointer

long getPointer()
Get the address of the native instance corresponding to this class

Returns:
The address of the native instance

finalize

public void finalize()
If the native instance was created by this class, then delete it now!

Overrides:
finalize in class Object