public abstract class BaseNativeType
extends java.lang.Object
implements java.io.Externalizable
Modifier and Type | Field and Description |
---|---|
protected boolean |
copyIn
Flag to control whether this element should be copied TO the native function.
|
protected boolean |
copyOut
Flag to control whether this element should be copied BACK FROM the native function.
|
protected boolean |
passByPointer
Flag to control whether this element should be passed as a pointer.
|
protected memptr |
ptr
On the client side, this is used to render the data as a pointer.
|
protected memptr |
ref
On the client side, this is used to render the data into native memory.
|
protected int |
type
Data type of the instance (defined as a
LibraryManager constant). |
Constructor and Description |
---|
BaseNativeType()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isCopyIn()
Reports whether this element should be copied TO the native function.
|
boolean |
isCopyOut()
Reports whether this element should be copied BACK FROM the native function.
|
boolean |
isPassByPointer()
Reports whether the argument passed should be a pointer to the data element or whether the
data should be passed by value to the native function.
|
void |
readExternal(java.io.ObjectInput in)
Replacement for the default object reading method.
|
long |
render()
Allocate native memory and render the data into that memory.
|
abstract long |
render(long addr)
Render the data into native memory, which will be allocated if the address is not
given.
|
void |
restore()
Copy back (if necessary) data from the native memory and deallocate the memory.
|
abstract void |
restore(long addr)
Copy back (if necessary) data from the native memory and deallocate the memory.
|
void |
setCopyIn(boolean copyIn)
Assigns the flag for whether this element should be copied TO the native function.
|
void |
setCopyOut(boolean copyOut)
Assigns the flag for whether this element should be copied BACK FROM the native function.
|
void |
setPassByPointer(boolean passByPointer)
Assigns the flag for whether the argument passed should be a pointer to the data element or
whether the data should be passed by value to the native function.
|
void |
setType(int type)
Manually override the data type of the instance.
|
abstract int |
size()
Report the size (in bytes) of the native memory needed to store this instance.
|
int |
type()
Report the data type of the instance.
|
void |
writeExternal(java.io.ObjectOutput out)
Replacement for the default object writing method.
|
protected boolean copyIn
protected boolean copyOut
protected boolean passByPointer
protected int type
LibraryManager
constant).protected memptr ref
protected memptr ptr
public boolean isCopyIn()
true
for INPUT and INPUT-OUTPUT parameters, false
otherwise.public void setCopyIn(boolean copyIn)
copyIn
- true
for INPUT and INPUT-OUTPUT parameters, false
otherwise.public boolean isCopyOut()
true
for OUTPUT and RETURN parameters, false
otherwise.public void setCopyOut(boolean copyOut)
copyOut
- true
for OUTPUT and RETURN parameters, false
otherwise.public boolean isPassByPointer()
public void setPassByPointer(boolean passByPointer)
passByPointer
- The new value of the flag.public long render()
This should never be called on the server, only on the client side.
public void restore()
This should never be called on the server, only on the client side.
public void setType(int type)
type
- A LibraryManager
constant representing the data type.public int type()
LibraryManager
constant representing the data type.public abstract int size()
This should never be called on the server, only on the client side.
public abstract long render(long addr)
This should never be called on the server, only on the client side.
addr
- The memory address to which the data should be rendered, if the caller
is supplying a buffer or 0 if the buffer should be allocated.public abstract void restore(long addr)
This should never be called on the server, only on the client side.
addr
- The memory address from which the data should be restored, if the caller
is supplying a buffer or 0 if the buffer should already exist.public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
in
- The input source from which fields will be restored.java.io.IOException
- In case of I/O errors.java.lang.ClassNotFoundException
- If payload can't be instantiated.public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
out
- The output destination to which fields will be saved.java.io.IOException
- In case of I/O errors.