[opensource-dev] State machine class

Aleric Inglewood 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
viewer:
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
queries).
The object would run in the main thread and be called under the "Idle"
header (fasttimers).
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,
wanting
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
applications are
limitless of course; just what plugins need ;).

It won't be ALL that is needed for plugins, but it would be a good start,
because
this isn't wirrten/available before someone starts to write something for a
plugin,
the wheel will be reinvented over and over again.

Any comments? :)

Aleric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.secondlife.com/pipermail/opensource-dev/attachments/20100211/449890cd/attachment.htm 


More information about the opensource-dev mailing list