I have a class contain multiple callbacks and a state variable s.
class foo
{
public:
void callback_1();
void callback_2();
...
private:
State m_s;
}
Each callback function is connected to an external event through something similar to the boost or Qt's signal-slot.
Whether a callback shall be executed depends on the current state m_s, and each callback function has the right to modify the m_s according to a state machine.
What is the best coding practice/pattern that can be adopted to write clean, modular code for this kind of state machine?
Aucun commentaire:
Enregistrer un commentaire