Methods Summary |
---|
private native boolean | allocate()
|
private native boolean | bindGetValueFunction(java.lang.String funcName)
|
private native boolean | bindInitFunction(java.lang.String funcName)
|
private native boolean | bindProcessFunction(java.lang.String funcName)
|
private native boolean | bindResetFunction(java.lang.String funcName)
|
private native boolean | bindSetValueFunction(java.lang.String funcName)
|
private native boolean | bindTeardownFunction(java.lang.String funcName)
|
private native java.lang.String | callNativeGetValue(java.lang.String key)
|
private native boolean | callNativeInit()
|
private native boolean | callNativeProcess(NativeFrame[] inputs, NativeFrame output)
|
private native boolean | callNativeReset()
|
private native boolean | callNativeSetValue(java.lang.String key, java.lang.String value)
|
private native boolean | callNativeTeardown()
|
private native boolean | deallocate()
|
protected void | finalize()
tearDown();
|
public java.lang.Object | getHostValue(java.lang.String variableName)
if (mTornDown) {
throw new RuntimeException("NativeProgram already torn down!");
}
if (!mHasGetValueFunction) {
throw new RuntimeException("Attempting to get native variable, but native code does not " +
"define native getvalue function!");
}
return callNativeGetValue(variableName);
|
private native boolean | nativeInit()
|
private native boolean | openNativeLibrary(java.lang.String libName)
|
public void | process(android.filterfw.core.Frame[] inputs, android.filterfw.core.Frame output)
if (mTornDown) {
throw new RuntimeException("NativeProgram already torn down!");
}
NativeFrame[] nativeInputs = new NativeFrame[inputs.length];
for (int i = 0; i < inputs.length; ++i) {
if (inputs[i] == null || inputs[i] instanceof NativeFrame) {
nativeInputs[i] = (NativeFrame)inputs[i];
} else {
throw new RuntimeException("NativeProgram got non-native frame as input "+ i +"!");
}
}
// Get the native output frame
NativeFrame nativeOutput = null;
if (output == null || output instanceof NativeFrame) {
nativeOutput = (NativeFrame)output;
} else {
throw new RuntimeException("NativeProgram got non-native output frame!");
}
// Process!
if (!callNativeProcess(nativeInputs, nativeOutput)) {
throw new RuntimeException("Calling native process() caused error!");
}
|
public void | reset()
if (mHasResetFunction && !callNativeReset()) {
throw new RuntimeException("Could not reset NativeProgram!");
}
|
public void | setHostValue(java.lang.String variableName, java.lang.Object value)
if (mTornDown) {
throw new RuntimeException("NativeProgram already torn down!");
}
if (!mHasSetValueFunction) {
throw new RuntimeException("Attempting to set native variable, but native code does not " +
"define native setvalue function!");
}
if (!callNativeSetValue(variableName, value.toString())) {
throw new RuntimeException("Error setting native value for variable '" + variableName + "'!");
}
|
public void | tearDown()
if (mTornDown) return;
if (mHasTeardownFunction && !callNativeTeardown()) {
throw new RuntimeException("Could not tear down NativeProgram!");
}
deallocate();
mTornDown = true;
|