dataselect

cesars/utils/dataselect

No description
dataselect
@/dataselect
Deprecated: Use cesars/utils/nth-input
IDXnumber
Index to select. All values below 1 are considered to be 0. Values of 1 and above are considered to be 1.
X0generic t1
X1generic t1 (variadic)
dataselect
OUT
IDX
X0
X1
-IDX
OUTgeneric t1
The selected value. Equals to one of `Xi` input.
-IDXnumber
Utility output needed for expanding node. Shoud be ignored by the end user.
To use the node in your project you should have the cesars/utils library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

#pragma XOD dirtieness disable

node {
    void evaluate(Context ctx) {
        auto x = getValue<input_IDX>(ctx);
        auto y = 1;
        if (x < y){
         cond = 1;
        }else{cond = 0;}

        auto trueVal = getValue<input_X0>(ctx);
        auto falseVal = getValue<input_X1>(ctx);
        emitValue<output_OUT>(ctx, cond ? trueVal : falseVal);
        emitValue<output__IDX>(ctx, x - 1);
    }
}

//cesars