First we need to extend the vehicle class. An implementation is
{}
#include <deque>
...
/home/nagel/src/book/sim/book/Veh
The writeEvent method will be explained later.
Note how the route plan is implemented as a deque, which is a data structure which makes it easy to add and remove elements at both ends.