Initial finite state machine support

Adding a basic StateMachine class to implement the routing and
transition logic for a simple finite state machine. The application can
implement states using a single function not tied to any class.