au.com.swz.swttocom.swt.types.pointer
Class BooleanPointer

java.lang.Object
  extended by au.com.swz.swttocom.swt.types.pointer.BooleanPointer
All Implemented Interfaces:
IDisposeableResource, IPointer

public class BooleanPointer
extends java.lang.Object
implements IPointer, IDisposeableResource

A pointer for use with the boolean Java type.

Author:
Mark richter

Constructor Summary
BooleanPointer()
          Constructs a new pointer for which no memotry is allocated.
BooleanPointer(int address)
          Constructs a new pointer that will use the specified memory address to store data.
 
Method Summary
 void dispose()
          Releases the memory (if any) allocated by this pointer.
protected  void finalize()
           
 int getAddress()
          Returns the memory address for this pointer.
 boolean getValue()
          Returns the value of this pointer.
 void setAddress(int address)
          Sets the memory address for this pointer.
 void setValue(boolean data)
          Sets the value of this pointer.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BooleanPointer

public BooleanPointer()
Constructs a new pointer for which no memotry is allocated.


BooleanPointer

public BooleanPointer(int address)
Constructs a new pointer that will use the specified memory address to store data.

Parameters:
address - the memory address to use for storing data.
Method Detail

getValue

public boolean getValue()
Returns the value of this pointer. If memory is allocated for this pointer then the internal value is first retrieved from the memory address before it is returned. If no memory is yet allocated then the internal value is returned directly.

Returns:
the value for this pointer.

setValue

public void setValue(boolean data)
Sets the value of this pointer. If memory is allocated for this pointer then the value is placed in to the memory address as well as the internal value updated. If no memory is yet allocated then only the internal value is updated.

Parameters:
data - the new value for this pointer.

getAddress

public int getAddress()
Returns the memory address for this pointer. If no memory has yet been allocated then it is allocated before being returned. This method along with the release and setAddress methods are managed by SWTtoCOM and should not be used by clients since it may result in memory leaks.

Specified by:
getAddress in interface IPointer
Returns:
the memory address for this pointer.

setAddress

public void setAddress(int address)
Sets the memory address for this pointer. If the specified value is 0 (NULL) then the memory address is cleared (but not released). This method is used by SWTtoCOM to invalidate a memory address to ensure a reference to this class continues to function even after it has been passed through COM.

Specified by:
setAddress in interface IPointer
Parameters:
address - the new memory address for this pointer or 0 to clear the memory address of this pointer.

dispose

public void dispose()
Releases the memory (if any) allocated by this pointer. The internal value is first retrieved from the memory to ensure it is the most up to date value. This method along with the getAddress and setAddress methods are managed by SWTtoCOM and should not be used by clients since releasing memory that is not owned can have severe consequences.

Specified by:
dispose in interface IDisposeableResource
Specified by:
dispose in interface IPointer

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable