Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure once and create multiple instances... #6

Closed
djpable opened this issue Dec 11, 2015 · 4 comments
Closed

Configure once and create multiple instances... #6

djpable opened this issue Dec 11, 2015 · 4 comments
Assignees

Comments

@djpable
Copy link

djpable commented Dec 11, 2015

Is it possible to statically initialize a machine and reuse its definition in multiple instances ?

@ursenzler
Copy link
Member

You typically write a class that holds the definition and all actions. When you create multiple instances of this class you get what you asked for, without "cloning".

See https://github.com/appccelerate/sensorsample/blob/master/source/SensorSample/Sensors/DoorSensor.cs for an example: the DoorSensor uses an Appccelerate.StateMachine in this way.

The Appccelerate.StateMachine is just the driver, the class holding the instance and providing the action is the actual state machine.

Does this help?

@djpable
Copy link
Author

djpable commented Dec 11, 2015

Yes, i was implementing my class like that, but it could be interesting to configure the machine once and instantiate that multiple times in different threads.

Could this be a feature request ?

Anyway this is a GREAT framework. Nice job !!!

@djpable djpable changed the title Static instantiation and multiple instances... Configure once and create multiple instances... Dec 11, 2015
@ursenzler
Copy link
Member

It surely can be a feature request. This would solve the problem, that the setup is rather slow compared to other libraries (as I was told - didn't find the time to check for myself.

@ursenzler
Copy link
Member

Finally done in version 5.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants