-
Notifications
You must be signed in to change notification settings - Fork 0
/
IndexManager.cpp
47 lines (36 loc) · 1010 Bytes
/
IndexManager.cpp
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
#include "IndexManager.h"
#include "ChunkIndexer.h"
#include "DNALineReader.h"
#include "MergeManager.h"
using namespace std;
void IndexManager::init(IndexConfig* cfg)
{
//here sets variables needed for different operations
this->config = cfg;
}
//indexes all files into an index
bool IndexManager::buildIndex()
{
ChunkIndexer chunkIndexer;
MergeManager mergeManager;
DNALineReader reader;
if(!chunkIndexer.init(this->config, &reader))
return false;
if(!chunkIndexer.indexChunks())
return false;
int longestLine = (int) chunkIndexer.getLongestInputLine();
printf("Longest input line is of size %d\n",longestLine);
if(!mergeManager.init(this->config,&reader,chunkIndexer.getTotalChunks()))
return false;
if(!mergeManager.mergeChunks())
return false;
return true;
}
bool IndexManager::search(const string * query, vector<int> *result)
{
return true;
}
bool IndexManager::scan (const int k, vector<int> *result)
{
return true;
}