-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathStructure.h
More file actions
75 lines (66 loc) · 1.53 KB
/
Copy pathStructure.h
File metadata and controls
75 lines (66 loc) · 1.53 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef STRUCTURE_H
#define STRUCTURE_H
#include <set>
#include <string>
#include <vector>
using namespace std;
struct item { //item means attribute
string name;
int type;
int length;
bool unique;
set<string> indices;
bool operator ==(const item &rhs) const;
};
struct table {
int entrySize;
string name;
vector <item> items;
table (const string & name,const vector<item> &items);
table ();
void write();
};
class element {
public :
int datai;
float dataf;
string datas;
int type; // 0: int 1: float 2:string -1:invalid;
bool operator < (const element &s) const ;
bool operator == (const element &s) const ;
bool operator > (const element &s) const ;
bool operator >= (const element &s) const ;
bool operator <= (const element &s) const ;
bool operator != (const element &s) const ;
element();
element(int d);
element(float d);
element(double d);
element(string d);
element(const char *d);
void print();
};
class Rule {
public:
//int index;
string itemname;
int type; // 0: < 1: <= 2: = 3: >= 4: > 5: <>
element rhs;
Rule(int type, element rhs);
Rule(string itemname,int type,element rhs);
};
class Fitter {
public:
vector <Rule> rules;
Fitter();
void addRule(const Rule &rule);
bool test(const table &nowtable,const vector <element> &data) const;
};
struct Index
{
string index_name;
string table_name;
string attr_name;
Index(string s1,string s2,string s3):index_name(s1),table_name(s2),attr_name(s3){};
};
#endif // STRUCTURE_H