forked from starkdg/Redis-ImageScout
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mvptree.hpp
54 lines (32 loc) · 1.12 KB
/
mvptree.hpp
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
#ifndef _MVPTREE_H
#define _MVPTREE_H
#include <list>
#include "mvpnode.hpp"
using namespace std;
class MVPTree {
private:
vector<DataPoint*> m_arrivals;
map<long long, DataPoint*> m_ids;
MVPNode* m_top;
int n_internal, n_leaf;
void LinkNodes(map<int, MVPNode*> &nodes, map<int, MVPNode*> &childnodes)const;
void ExpandNode(MVPNode *node, map<int, MVPNode*> &childnodes, const int index)const;
MVPNode* ProcessNode(const int level, const int index, MVPNode *node, vector<DataPoint*> &points,
map<int, MVPNode*> &childnodes, map<int, vector<DataPoint*>*> &childpoints);
public:
static int n_ops;
MVPTree():m_top(NULL),n_internal(0),n_leaf(0){};
const DataPoint* Lookup(const long long id);
void Add(DataPoint *dp);
void Add(vector<DataPoint*> &points);
void Sync();
void Delete(const long long id);
const int Size()const;
void CountNodes(int &n_internal, int &n_leaf)const;
void Clear();
const list<QueryResult> Query(const DataPoint &target, const double radius) const;
void Print()const;
size_t MemoryUsage()const;
const map<long long, DataPoint*> GetMap()const;
};
#endif /* _MVPTREE_H */