Main Page | Modules | Class Hierarchy | Class List | File List | Class Members

Calculator FSME tutorial

1.0

Intro

This example introduces Calculator - a sample calculator implementation, when primary logic is drawn.

Calculator supports only four types of actions with integer numbers, so it's quite unuseful. I wrote it only to demonstrate logic simplify with usage of finite state machine drawn with FSME.

How it works

The main class is CalculatorFSM, which is drawn with FSME (http://fsme.sf.net) and translated to source code with FSMC.

fsm.png

CalculatorFSM diagram

Every button click is an event to CalculatorFSM. It accepts event and processes it according to it's current state. The state is one of CalculatorFSM::States. Look at the outputs of CalculatorFSM and their implementation (for example, Calculator::saveOp).

To be general, all calculator operations are derived from Calculator::Operation. In principle, if there were no good calculator implementations, one could implement more operations to make it a bit more useful :-)


Generated on Fri Oct 29 13:35:13 2004 for Calculator by doxygen 1.3.8