-
Notifications
You must be signed in to change notification settings - Fork 0
/
GenericDBFile.h
68 lines (47 loc) · 1.32 KB
/
GenericDBFile.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
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef GENERIC_DBFILE_H
#define GENERIC_DBFILE_H
#include "Comparison.h"
#include "ComparisonEngine.h"
#include "File.h"
#include "Record.h"
#include "Schema.h"
#include "TwoWayList.h"
#include "Pipe.h"
#include "BigQ.h"
struct SortInfo { OrderMaker *myOrder; int runLength = 0;};
typedef enum {
heap,
sorted,
tree
} fType;
class GenericDBFile {
protected:
File *file;
Page *currentPage;
int currPageNum;
void WriteCurrentPageToDisk();
void PageToDiskOverWrite();
BigQ *bigq = NULL;
bool readMode = true;
Pipe *input;
Pipe *output;
int runLength;
OrderMaker *sortOrder;
struct SortInfo *sortdata;
public:
GenericDBFile(){};
virtual int Create(const char *fpath, void *startup) = 0;
virtual void Add(Record *addme) = 0;
virtual int GetNext(Record &fetchme) = 0;
virtual int GetNext(Record &fetchme, CNF &cnf, Record &literal) = 0;
// Opens bin files
virtual int Open(const char *fpath) = 0;
// Loads a tbl file. Call Create() before this
virtual void Load(Schema &myschema, const char *loadpath) = 0;
virtual int Close() = 0;
virtual void MoveFirst() = 0;
void WriteOrderMaker(OrderMaker *sortOrder, FILE *file);
void ReadOrderMaker(OrderMaker *sortOrder, FILE *file);
int GetNextRecord(Record *tempRec);
};
#endif