[opensource-dev] State machine class
aleric.inglewood at gmail.com
Thu Feb 11 08:59:05 PST 2010
Hi, with the eye on supporting plugins, I'd like to add a 'tool' to the
A state machine.
I'd add a base class from which others can derive their own classes.
A new state machine would then be started by creating one or more objects
of those types.
It would be a class that supports a chain of asynchronous actions (and
The object would run in the main thread and be called under the "Idle"
The object will know an 'idle' state (when it's waiting for data) during
which it will
use no significant CPU.
The user (developer, you) would provide an enum with states for your object
and switch between states by calling a method (ie, set_state(new_state)).
If it is necessary to wait, you can call the idle() method, which will idle
until data is available (detected elsewhere) causing the state machine to
continue the current state.
As an example, consider a series of actions like walking to a certain place,
creating a prim there (or rezzing something) and then sitting on it. Or,
to do some calculation on a number of selected prims (for which you have to
wait till all data of the selected prims has arrived). Well... the
limitless of course; just what plugins need ;).
It won't be ALL that is needed for plugins, but it would be a good start,
this isn't wirrten/available before someone starts to write something for a
the wheel will be reinvented over and over again.
Any comments? :)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the opensource-dev