Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / June 2004

Tip: Looking for answers? Try searching our database.

General design question relating to FSM.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Beeeeeves - 03 Jun 2004 20:34 GMT
Hi
I am looking for any articles anyone may know of on developing a finite
state machine in a gui application?
Basically what I have is a fairly complex gui which needs to go through
several (3 - 7?) states. Complex algorithms are running as their own
separate code blocks operating on class-level data structures, the
completion of the processing of one set of data takes the application from
one 'state' to another. Once the last operation is complete, some user
activity will probably have occurred  on the user interface that makes it
'dirty' and means the first operation has to start again, to cycle the
transition of repopulating the data structures to update them.
I've decided to go down the multithreading road, because the operations take
too long (a few whole seconds) for them to execute in the primary thread of
the user interface as they block it up, but there probably IS time for them
all to run in time to 'keep up' with the user entering data as they cannot
enter a lot of data incessantly fast all the time (or probably won't) - as
the time they have to lock some actual elements on the interface is
negligible compared to the total time they will take to run.
What's more, there are some cases which will be identified where the first
process can start again before the last one of the previous cycle has
completely finished, enabling a multithreading scenario to take advantage of
this.
What's the best way of accomplishing this? I'm trying to work on a suitable
class structure.
Klueless - 04 Jun 2004 05:54 GMT
> I've decided to go down the multithreading road, because the operations take
> too long (a few whole seconds)

    The simplest approach is to have one GUI thread (the main thread)
and one worker thread (background, non-GUI).  The worker thread
will own the FSM.  Arrange user actions on the GUI to cause the GUI
thread to post messages to the worker thread which will act on them when
finished with any preexisting work.
Russell Hind - 04 Jun 2004 08:27 GMT
> Hi
> I am looking for any articles anyone may know of on developing a finite
> state machine in a gui application?

You could take a look at the fsm library in the boost sandbox.
Documentation index is

http://cvs.sourceforge.net/viewcvs.py/*checkout*/boost-sandbox/boost-sandbox/lib
s/fsm/doc/index.html


and a tutorial at

http://cvs.sourceforge.net/viewcvs.py/*checkout*/boost-sandbox/boost-sandbox/lib
s/fsm/doc/tutorial.html


The document and code are in

http://cvs.sourceforge.net/viewcvs.py/boost-sandbox/boost-sandbox/libs/fsm/
http://cvs.sourceforge.net/viewcvs.py/boost-sandbox/boost-sandbox/boost/fsm/

There is quite a lot of discussion going on about this library at the
moment on the boost libs.  I haven't been able to try it myself as it
doesn't work with bcc32 which is my current compiler, but I am
interested in it because we do implement a lot of state machines here.
You could get more help with it from the boost newsgroups if interested.

Cheers

Russell

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.