nth-input

cesars/utils/nth-input

No description
nth-input
@/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)
nth-input
OUT
-
IDX
X0
X1
OUTgeneric t1
The selected value. Equals to one of `Xi` input.
-number
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 {
    int cond;

    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__>(ctx, x - 1);
    }
}
//cesars