-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIndexer.cpp
More file actions
83 lines (67 loc) · 2.35 KB
/
Indexer.cpp
File metadata and controls
83 lines (67 loc) · 2.35 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
#include <map>
#include <iostream>
#include "Indexer.h"
using namespace std;
Indexer::Indexer(int nDim, vector<int64_t> ranges, int nAttr, string arraydir) {
this->nDim = nDim;
this->nAttr = nAttr;
this->ranges = ranges;
this->arraydir = arraydir;
this->suffix = "";
// TODO: use Boost for robustness?
this->indexfile = arraydir + "/index.txt";
// Initialize maps
this->tileids = new vector<string>();
this->attrToTileMap = new map<int, vector<string>>();
}
// Destructor
Indexer::~Indexer() {
delete tileids;
delete attrToTileMap;
}
vector<string> * Indexer::findTilesByAttribute(int attrIndex) {
return &(*attrToTileMap)[attrIndex];
}
// Returns attribute tile given attribute index and tileid
string Indexer::getAttrTileById(int attrIndex, string tileid) {
return "tile-attrs[" + to_string(attrIndex) + "]-" + tileid + suffix + ".dat";
};
// Returns RLE attribute tile given attribute index and tileid
string Indexer::getRLEAttrTileById(int attrIndex, string tileid) {
return "rle-tile-attrs[" + to_string(attrIndex) + "]-" + tileid + suffix + ".dat";
};
// Returns coordinate tile given tile id
string Indexer::getCoordTileById(string tileid) {
return "tile-coords-" + tileid + suffix + ".dat";
}
// Returns all attribute tiles given tileid
vector<string> * Indexer::getAllAttrTilesById(string tileid) {
vector<string> * attrTiles = new vector<string>();
for (int i = 0; i < this->nAttr; ++i) {
attrTiles->push_back(Indexer::getAttrTileById(i, tileid));
}
return attrTiles;
};
// Returns all RLE attribute tiles given tileid
vector<string> * Indexer::getAllRLEAttrTilesById(string tileid) {
vector<string> * attrTiles = new vector<string>();
for (int i = 0; i < this->nAttr; ++i) {
attrTiles->push_back(Indexer::getRLEAttrTileById(i, tileid));
}
return attrTiles;
};
// Returns all tile ids tha fall in subranges
// Implemented by Subclasses
vector<string> * Indexer::getTilesByDimSubRange(vector<int64_t> * subranges) {
return NULL;
};
// Returns all whole tiles ids that fall completely within subranges
// Implemented by subclasses
vector<string> * Indexer::getWholeTilesByDimSubRange(vector<int64_t> * subranges) {
return NULL;
}
// Returns all tile ids that partially overlap with subranges
// Implemented by subclasses
vector<string> * Indexer::getPartialTilesByDimSubRange(vector<int64_t> * subranges) {
return NULL;
};