count

xod/core/count

Stores a number which gets incremented on each `INC` pulse.
count
@/count
Stores a number which gets incremented on each `INC` pulse.
STEPnumber
Value to add on each increment. Use a negative value (e.g. -1) to make decrements.
INCpulse
Triggers a single increment.
RSTpulse
Resets the accumulated value to zero.
count
OUT
STEP
INC
RST
OUTnumber
The accumulated value.

C++ implementation

node {
    void evaluate(Context ctx) {
        Number count = getValue<output_OUT>(ctx);

        if (isInputDirty<input_RST>(ctx))
            count = 0;
        else if (isInputDirty<input_INC>(ctx))
            count += getValue<input_STEP>(ctx);

        emitValue<output_OUT>(ctx, count);
    }
}