Finite State Machine for C++