-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStatistics.h
45 lines (35 loc) · 1.05 KB
/
Statistics.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 STATISTICS_
#define STATISTICS_
#include "ParseTree.h"
//#include <vector>
#include <map>
#include <string>
using namespace std;
typedef struct relInfo{
map<string, int> attrs;
int numTuples;
int numRel;
} relInfo;
class Statistics{
private:
map<string,relInfo> mymap;
double tempRes;
public:
Statistics();
Statistics(Statistics ©Me); // Performs deep copy
~Statistics();
void AddRel(char *relName, int numTuples);
void AddAtt(char *relName, char *attName, int numDistincts);
void CopyRel(char *oldName, char *newName);
char* SearchAttr(char * attrName);
void Read(char *fromWhere);
void Write(char *fromWhere);
void Apply(struct AndList *parseTree, char *relNames[], int numToJoin);
double Estimate(struct AndList *parseTree, char **relNames, int numToJoin);
double ApplyEstimate(struct AndList *parseTree, char **relNames, int numToJoin) { // apply and return
double estimate = Estimate(parseTree, relNames, numToJoin);
Apply(parseTree, relNames, numToJoin);
return estimate;
}
};
#endif