-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathIndexManager.h
More file actions
74 lines (51 loc) · 1.58 KB
/
IndexManager.h
File metadata and controls
74 lines (51 loc) · 1.58 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
#ifndef __Minisql__IndexManager__
#define __Minisql__IndexManager__
#include <stdio.h>
#include <map>
#include <string>
#include <sstream>
#include "Attribute.h"
#include "BPlusTree.h"
#include <cstring>
class API;
class IndexManager{
private:
typedef map<string,BPlusTree<int> *> intMap;
typedef map<string,BPlusTree<string> *> stringMap;
typedef map<string,BPlusTree<float> *> floatMap;
// other values mean the size of the char.Eg, 4 means char(4);
API *api; // to call the functions of API
intMap indexIntMap;
stringMap indexStringMap;
floatMap indexFloatMap;
struct keyTmp{
int intTmp;
float floatTmp;
string stringTmp;
}; // the struct to help to convert the inputed string to specfied type
struct keyTmp kt;
int getDegree(int type);
int getKeySize(int type);
void setKey(int type,string key);
public:
IndexManager(API *api);
~IndexManager();
void createIndex(string filePath,int type);
void dropIndex(string filePath,int type);
offsetNumber searchIndex(string filePath,string key,int type);
void insertIndex(string filePath,string key,offsetNumber blockOffset,int type);
void deleteIndexByKey(string filePath,string key,int type);
};
class IndexInfo
{
public:
IndexInfo(string i, string t, string a, int ty)
{
strcpy(indexName, i.c_str()); strcpy(tableName, t.c_str()); strcpy(Attribute, a.c_str()); type = ty;
}
char indexName[50];
char tableName[50];
char Attribute[50];
int type;
};
#endif /* defined(__Minisql__IndexManager__) */