-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHeapFile.h
41 lines (32 loc) · 814 Bytes
/
HeapFile.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
#ifndef HEAP_FILE_H_
#define HEAP_FILE_H_
#include "DBFile.h"
class HeapFile: protected DBFileBase {
friend class DBFile;
friend class SortedFile; // sort file used a temp heap file for merging
using DBFileBase::GetNext;
protected:
HeapFile ();
~HeapFile() {}
int Close ();
void Add (Record& me);
void MoveFirst();
int GetNext (Record& fetchme, CNF& cnf, Record& literal);
protected:
void startWrite() { mode = WRITE; }
void startRead();
private:
void addtoNewPage(Record& rec) {
curPage.EmptyItOut();
curPage.Append(&rec);
}
HeapFile(const HeapFile&);
HeapFile& operator=(const HeapFile&);
};
inline void HeapFile::startRead() {
// cout<<"Start read"<<endl;
if (mode == READ) return;
mode = READ;
if (!curPage.empty()) theFile.addPage(&curPage);
}
#endif