#include <calc.h>
Inheritance diagram for CalculatorFSM:
Definition at line 9 of file calc.h.
Public Types | |
enum | Event { ResultRequested, Number, BinaryOp, Clear } |
enum | States { Idle, EnteringFirstOperand, Result, EnteringSecondOperand } |
Public Member Functions | |
CalculatorFSM () | |
Constructor. | |
virtual | ~CalculatorFSM () |
Destructor. | |
States | currentState () |
void | A (Event e) |
Static Public Member Functions | |
const char * | eventName (Event e) |
const char * | stateName (States s) |
Protected Member Functions | |
virtual void | saveNumber ()=0 |
virtual void | addNumber ()=0 |
virtual void | clear ()=0 |
virtual void | saveOp ()=0 |
virtual void | showResult ()=0 |
Private Member Functions | |
void | __processEvent (Event e) |
bool | debug_iNtErNal_input (const char *type, const char *name, bool i) |
void | debug_show_fsm_xml () |
Private Attributes | |
States | __Y |
std::queue< Event > | __events |
|
Events
|
|
States
Referenced by currentState(). |
|
Send event to FSM Use this function to send event to CalculatorFSM After you call it given event will be handled, and, if some of transition conditions match, appropriate transition will be triggered, and currentState() will be changed. If this function is called during existing event handling process, given event will be added to pending event queue, and will be handled after current transition. See examples for details. Definition at line 201 of file calc.cpp. Referenced by Calculator::slotClear(), Calculator::slotDiv(), Calculator::slotEqual(), Calculator::slotMinus(), Calculator::slotMul(), Calculator::slotNumber(), and Calculator::slotPlus(). |
|
Add a number to the current number, for example, if there is '12' on a screen and '3' button pressed, there should be '123' on a screen Implemented in Calculator.
|
|
Just clear :) Implemented in Calculator.
|
|
Get current FSM state
References States. Referenced by Calculator::slotClear(), Calculator::slotDiv(), Calculator::slotEqual(), Calculator::slotMinus(), Calculator::slotMul(), Calculator::slotNumber(), and Calculator::slotPlus(). |
|
Get symbolic name of an event
References BinaryOp, Clear, Number, and ResultRequested. |
|
A number have been entered, save it and proceed to the next one Implemented in Calculator.
|
|
Save operation to our stack. This output follows press '+', '-', ... Implemented in Calculator.
|
|
Calculate and display result of operation Implemented in Calculator.
|
|
Get symbolic name of a state
References EnteringFirstOperand, EnteringSecondOperand, Idle, and Result. Referenced by Calculator::slotClear(), Calculator::slotDiv(), Calculator::slotEqual(), Calculator::slotMinus(), Calculator::slotMul(), Calculator::slotNumber(), and Calculator::slotPlus(). |