A C++ framework that implements generalised finite state machines