toggle(bool)

koadrobot/logics/toggle(bool)

No description
toggle(bool)
@/toggle(bool)
TGLboolean
Whether values should toggle and pass through. TGL? RT=F, RF=T : RT=T, RF=F
Tnumber
Value to be output if condition is true
Fnumber
Value to be output if condition is false
toggle(bool)
TGL
T
F
RT
RF
RFnumber
Outputs value of `T` if `TGL` is true, and `F` otherwise
RTnumber
Outputs value of `F` if `TGL` is true, and `T` otherwise
To use the node in your project you should have the koadrobot/logics 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

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx)
{
    auto trueVal = getValue<input_T>(ctx);
    auto falseVal = getValue<input_F>(ctx);
    if(getValue<input_TGL>(ctx))
    {
        emitValue<output_RT>(ctx, falseVal);
        emitValue<output_RF>(ctx, trueVal);
    }
    else
    {
        emitValue<output_RT>(ctx, trueVal);
        emitValue<output_RF>(ctx, falseVal);
    }
}

Tabular tests

CONDTFRTRF
false0.51.250.51.25
true10202010