-
Notifications
You must be signed in to change notification settings - Fork 0
/
BigQ.h
46 lines (29 loc) · 906 Bytes
/
BigQ.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
#ifndef BIGQ_H
#define BIGQ_H
#include <pthread.h>
#include <iostream>
#include "Pipe.h"
#include "File.h"
#include "Record.h"
#include <stdlib.h>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
class BigQ {
friend void* proxyFunction(void *fooPtr, void *args);
private:
const char *tempFileName;
Record *records;
void WritePageToDisk(File *file, Page *page);
int SortRecords(Page *page, OrderMaker *sortorder, int numPages);
void MergeSort(Record *records, int start, int end, OrderMaker *sortorder);
void Merge(Record *records, int start, int mid, int end, OrderMaker *sortorder);
void KWayMerge(File *file, Pipe *out, int runNum, vector<int> runLen, OrderMaker *sortorder);
public:
pthread_t threadID;
BigQ(Pipe &in, Pipe &out, OrderMaker &sortorder, int runlen);
void* Worker(void *args);
~BigQ();
};
#endif