I joined a new firm recently and I'm required to develop a framework architecture in C++11 from scratch. I have a design query. My machine has certain states say w,x,y,z,a,b and c. There are certain jobs that while execution can modify the current state of the machine. My current task is that a set of jobs execute in some y iterations. Say the initial state of the machine is 'S'. Before beginning any new iteration the system has to revert to the initial state 'S'. Is there any design pattern to save the initial state and reset it back after every iteration? I thought of creating a 'State' class and storing all the data as member of the class. After every iteration, I reset the state referring to the stored members. Is there any other approach? Thanks a lot in advance !
Aucun commentaire:
Enregistrer un commentaire