-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTruthTable.h
45 lines (32 loc) · 1.26 KB
/
TruthTable.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef TRUTHTABLE_H
#define TRUTHTABLE_H
#include <iostream>
#include <vector>
#include "Implicant.h"
using namespace std;
namespace Tt{
class InvalidInput {};
class NoInput {};
class ExtraVar {};
class BracketError {};
enum class VarNum {A=0, B, C, D, E, F, G, H};
typedef vector<bool> TBinCode;
class Truthtable {
public:
Truthtable (VarNum =VarNum::A);
TBinCode get_table () const;
TBinCode& set_table (const TBinCode&);
string output_to_string (int);
private:
TBinCode bin_code;
};
Truthtable operator~ (const Truthtable&);
Truthtable operator& (const Truthtable&, const Truthtable&);
Truthtable operator^ (const Truthtable&, const Truthtable&);
Truthtable operator| (const Truthtable&, const Truthtable&);
string pre_process (int, const string&);
int find_char (const string&, char);
Truthtable calc (const string&);
}
string expr_to_truthtable (int, const string&);
#endif