-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGlobalClass.h
55 lines (46 loc) · 1.65 KB
/
GlobalClass.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
46
47
48
49
50
51
52
53
54
55
#ifndef _GLOBALCLASS_H_
#define _GLOBALCLASS_H_
#include <string>
constexpr int FILE_PAGESIZE = 8192; // 内存页(==文件页)大小
constexpr int MEM_PAGEAMOUNT = 4096; // 内存页数量
constexpr int MAX_FILENAME_LEN = 256; // 文件名(包含路径)最大长度
constexpr int RecordColumnCount = 12 * 4;
// 记录字段数量限制,假设所有字段都是字符数组,一个字符数组字段需要4个字符->CXXX
constexpr int ColumnNameLength = 16; // 单个字段名称长度限制
constexpr int bptree_t = 40; // B+tree's degree, bptree_t >= 2
constexpr int MaxKeyCount = 2 * bptree_t; // the max number of keys in a b+tree node
constexpr int MaxChildCount = 2 * bptree_t; // the max number of child in a b+tree node
enum class DataType{INT, FLOAT, CHAR};
union Data{
int i;
double f;
char str[32];
};
class DataClass{
public:
DataType type;
private:
int bytes;
union Data data;
public:
DataClass();
DataClass(int i);
DataClass(double f);
DataClass(std::string str);
bool operator==(const DataClass &rhs);
bool operator<(const DataClass &rhs);
bool operator<=(const DataClass &rhs);
bool operator>=(const DataClass &rhs);
bool operator>(const DataClass &rhs);
friend std::ostream& operator<<(std::ostream &out, const DataClass &obj);
friend class Tuple;
friend class RM;
friend class PrintResult;
};
typedef struct{
std::string attr;
std::string op; //1:<, 2:=, 3:>, 4:!=, 5:<=, 6:==, 7:>=
DataClass value;
friend class RM;
}SelectCondition;
#endif