-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathoperations.hpp
73 lines (53 loc) · 1.57 KB
/
operations.hpp
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
#ifndef operations_hpp
#define operations_hpp
/*! \file
\brief Declarations for Operation class and its descendants
*/
class Database;
//! Abstract class to represent an operation.
struct Operation
{
//! Execute the operation on the given database
virtual void operator()(Database & d) = 0;
virtual ~Operation() {}
};
//! Performs a table scan
struct Scan : public Operation
{
//! which relation to scan (index into Database::relations)
int relationNum;
//! fraction of buffer to use
double useBuffer;
void operator()(Database & d);
};
//! Performs a single table lookup
struct Lookup : public Operation
{
//! which index to search (index into Database::indices)
int indexNum;
void operator()(Database & d) { (*this)(d,1); }
void operator()(Database & d, int numMatches);
};
//! Performs a nested block join on two tables
struct BlockJoin : public Operation
{
//! inner relation number (index into Database::relations)
int innerRelation;
//! outer relation number (index into Database::relations)
int outerRelation;
//! fraction of buffer to use for inner loop
double innerBuffer;
//! fraction of buffer to use for outer loop
double outerBuffer;
void operator()(Database & d);
};
//! Performs nested-loop join of two tables with an index on the inner table
struct IndexLoop : public Lookup
{
//! outer relation number (index into Database::relations)
int relationNum;
//! average number of matches found in the inner relation for each record in outer relation
double matches;
void operator()(Database & d);
};
#endif