Class for representing state machine in C++