Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Fsm

I am a begginner in C++ MFC (GUI) and I would like some help! to design a method of display state machine, conditional branch (i.e. arrows) and its karnaugh maps on screen.
Can anyone help me I need to display a finite state machine (FSM) on screen using C++.
[263 byte] By [socram] at [2007-11-11 7:38:30]
# 1 Re: Fsm
You need a way to store the fsm so you can generate the diagrams that you want, and the routines to generate the data at whatever level you desire. Once you have that, you can begin to work on the graphics side of the program.
jonnin at 2007-11-11 21:02:00 >
# 2 Re: Fsm
thanks for reply
as i said im a novice when using the mfc
how do i go about using a storage method??

thanks in advance.
socram at 2007-11-11 21:03:07 >
# 3 Re: Fsm
C++ (and MFC) are not aware of a fsm. You will want to define a class that has states, exit state conditions & destinations, etc. This will be something of a graph data structure. This has nothing to do with MFC -- you will not encounter MFC until you start trying to display the data or interact with the user. The graph / state class will be something along the lines of (total pseudocode)

class state_exit
{
exit condition (what is the best way to represent this??)
pointer to destination state
}

class state
{
state name (id num, whatever)
vector of state_exits
..whatever else
}

and you fill it in by creating ALL the states with names (ID num ok) filled in. Once you have that, you fill in the exits (use the address of existing states!). You probably want to create a file format that defines these if your fsm is not very small and simple. You SHOULD use a small and simple fsm to test out everything for a while, maybe a 3-state one that goes state 1 to 2 to 3 to 1.
jonnin at 2007-11-11 21:04:00 >