Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > finite state machine

Reply
Thread Tools

finite state machine

 
 
Jeff Flinn
Guest
Posts: n/a
 
      03-03-2011
Larry Evans wrote:
> On 03/01/11 15:55, dr.oktopus wrote:
>> Hello,
>> I am moving my first steps into the wonderful world of oop.
>> I have considered this approach in writing a fsm.
>>

> [snip]
> Searching posts to boost development mailing list:
>
> http://www.boost.org/community/groups.html
>
> will show other ways of doing this. For example:
>
> http://article.gmane.org/gmane.comp....9836/match=fsm
>
> HTH.
>
> -Larry


More specifically there's the transition table approach of the Meta
State Machine library described at:

http://www.boost.org/doc/libs/1_46_0...msm/index.html

and the state char approach of the Statechart library at:

http://www.boost.org/doc/libs/1_46_0...doc/index.html

Jeff
 
Reply With Quote
 
 
 
 
dr.oktopus
Guest
Posts: n/a
 
      03-03-2011
Ok. Thanks to all.
 
Reply With Quote
 
 
 
 
DeMarcus
Guest
Posts: n/a
 
      03-09-2011
On 2011-03-01 22:55, dr.oktopus wrote:
> Hello,
> I am moving my first steps into the wonderful world of oop.
> I have considered this approach in writing a fsm.
>
> class fsm {
>
> public:
> void run_fsm (void); // advance machine for 1 step
>
> private:
> void (*state) (void);
>
> void state1 (void);
> void state2 (void);
> ..
> };
>
> void fsm::run_fsm (void)
> {
> state();
> }
>
> void fsm::state1 (void)
> {
> ..
> if (statehastochangetostate2)
> state = state2;
> ..
> }
>
> void fsm::state2 (void)
> {
> ..
> if (statehastochangetostate1)
> state = state1;
> ..
> }
>
> It is a simple fsm, but what I would like to know
> are your opinions about this approach.
> I don't try to compile it (I don't have a compiler at hand),
> but I think it should work.
> Suggestions?
> Thanks,
> willy



I don't have any suggestions but you can get more ideas from here.

http://www.boost.org/doc/libs/1_46_0...doc/index.html
http://www.boost.org/doc/libs/1_46_0...TML/index.html

Also the book C++ Template Metaprogramming by Abrahams and Gurtovoy
contains a chapter on FSM.

Hope this helps.

/Daniel

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Safe finite state machine design SomeDude VHDL 3 08-14-2006 12:47 PM
Gate Level model of a Finite state machine Inderkal VHDL 8 12-09-2004 11:17 PM
FSM (Finite State Machine) Generator - Open Source Roberto Nunnari Java 2 02-04-2004 07:16 AM
"Tag" Finite State Machine Davide T HTML 5 12-10-2003 08:20 PM
HELP PLEASE!! - Finite State Machine - Automaton - Microprogrammed System deejayfred VHDL 0 10-02-2003 01:23 AM



Advertisments