Started writing the header file.
[rpn.git] / src / rpn.h
blobc1cc1cdc1be769bda67f306695d810893f00c0a2
1 #ifndef _RPN_H_
2 #define _RPN_H_
4 #include <list>
5 #include <map>
6 #include <stack>
7 #include <string>
8 using namespace std;
10 namespace RPN
12 // forward declarations.
13 class Calculator;
14 class Command;
15 class Operator;
17 typedef long double Value;
18 typedef map<string, Command> Commands;
19 typedef map<string, Operator> Operators;
20 typedef map<string, Value> Variables;
21 typedef stack<Value> Stack;
22 typedef stack<Stack> History;
24 class Calculator
26 Commands commands;
27 History history;
28 Operators operators;
29 Variables variables;
30 public:
31 Calculator();
32 void Eval(string input);
35 class Operator
37 public:
38 virtual operator()(Value a, Value b) = 0;
41 class Command
43 public:
44 virtual unsigned int Arguments() = 0;
45 virtual operator()(Calculator& calculator, list<string>& args) = 0;
49 #endif // _RPN_H_