G
gordon.is.a.moron
Hello,
I'm implementing a State Pattern in C++, based on the example in the
GoF book. However the example they give only shows a single transition
to another state. In my program I have a choice of states depending on
the input. So, I was going to give each concrete State a small Map of
inputs to States and then find out what transition to make.
However I was wondering if this is a sort of mix between State Table
and State Pattern, but surely you need some conditional code in the
concrete state to decide what state to go to? It just seems that the
State Pattern is designed to eliminate this, yet there is still a need
for it when deciding which state to change to when you have a choice
of multiple state transitions.
Regards,
Gordy
I'm implementing a State Pattern in C++, based on the example in the
GoF book. However the example they give only shows a single transition
to another state. In my program I have a choice of states depending on
the input. So, I was going to give each concrete State a small Map of
inputs to States and then find out what transition to make.
However I was wondering if this is a sort of mix between State Table
and State Pattern, but surely you need some conditional code in the
concrete state to decide what state to go to? It just seems that the
State Pattern is designed to eliminate this, yet there is still a need
for it when deciding which state to change to when you have a choice
of multiple state transitions.
Regards,
Gordy