blob: 983ea393b6b568dbde58aef1dcdecfcbb3c6ec2f [file] [log] [blame]
/*
* Copyright (C) 2011-2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* This file is auto-generated. DO NOT MODIFY!
* The source Renderscript file: reduce_general_struct.rs
*/
package struct;
import android.renderscript.*;
import struct.reduce_general_structBitCode;
/**
* @hide
*/
public class ScriptC_reduce_general_struct extends ScriptC {
private static final String __rs_resource_name = "reduce_general_struct";
// Constructor
public ScriptC_reduce_general_struct(RenderScript rs) {
super(rs,
__rs_resource_name,
reduce_general_structBitCode.getBitCode32(),
reduce_general_structBitCode.getBitCode64());
mRSLocal = rs;
__I32 = Element.I32(rs);
__ScriptField_MyStruct = ScriptField_MyStruct.createElement(rs);
}
private Element __I32;
private Element __ScriptField_MyStruct;
private RenderScript mRSLocal;
// To obtain the result, invoke get(), which blocks
// until the asynchronously-launched operation has completed.
public static class result_int {
public int get() {
if (!mGotResult) {
int[] outArray = new int[1];
mOut.copyTo(outArray);
mResult = outArray[0];
mOut.destroy();
mOut = null; // make Java object eligible for garbage collection
if (mTempIns != null) {
for (Allocation tempIn : mTempIns) {
tempIn.destroy();
}
mTempIns = null; // make Java objects eligible for garbage collection
}
mGotResult = true;
}
return mResult;
}
private result_int(Allocation out) {
mTempIns = null;
mOut = out;
mGotResult = false;
}
private Allocation[] mTempIns;
private Allocation mOut;
private boolean mGotResult;
private int mResult;
}
private final static int mExportReduceIdx_inStruct = 0;
// ain1 = "/* struct <> */ val"
public result_int reduce_inStruct(Allocation ain1) {
return reduce_inStruct(ain1, null);
}
// ain1 = "/* struct <> */ val"
public result_int reduce_inStruct(Allocation ain1, Script.LaunchOptions sc) {
// check ain1
if (!ain1.getType().getElement().isCompatible(__ScriptField_MyStruct)) {
throw new RSRuntimeException("Type mismatch with ScriptField_MyStruct!");
}
Allocation aout = Allocation.createSized(mRSLocal, __I32, 1);
aout.setAutoPadding(true);
reduce(mExportReduceIdx_inStruct, new Allocation[]{ain1}, aout, sc);
return new result_int(aout);
}
}