-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSortedFile.h
62 lines (38 loc) · 1.28 KB
/
SortedFile.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
#ifndef SORTEDFILE_H
#define SORTEDFILE_H
#include "BigQ.h"
#include "GenericDBFile.h"
#include "Pipe.h"
// struct SortInfo { OrderMaker *myOrder; int runLength = 0;};
class SortedFile : public GenericDBFile {
// BigQ *bigq;
// bool readMode;
// Pipe *input;
// Pipe *output;
// int runLength;
// OrderMaker *sortOrder;
// struct SortInfo *sortdata;
// void WriteOrderMaker(OrderMaker *sortOrder, FILE *file);
// void ReadOrderMaker(OrderMaker *sortOrder, FILE *file);
Record *tempRec;
bool prevGetNext = false;
void WriteToRead();
void WritePipeToDisk(Pipe *output);
void initQ();
int BinarySearch(Record *recs, int start, int end, Record *key, OrderMaker *sortOrder);
bool CompareOrderMakerCNF(Record *record, Record *literal, OrderMaker *sortOrder, CNF *cnf);
void WritePipeToDiskOverWrite(Pipe *output);
public:
SortedFile();
int Create(const char *fpath, void *startup);
// Opens bin files
int Open(const char *fpath);
// Loads a tbl file. Call Create() before this
void Load(Schema &myschema, const char *loadpath);
void Add(Record *addme);
int GetNext(Record &fetchme);
int GetNext(Record &fetchme, CNF &cnf, Record &literal);
void MoveFirst();
int Close();
};
#endif