Finite state machines: a model of behavior for C++