-
Notifications
You must be signed in to change notification settings - Fork 2
/
HASHTCounter.hpp
51 lines (38 loc) · 976 Bytes
/
HASHTCounter.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
#ifndef HTC_HPP
#define HTC_HPP
#include <cstdint>
#include <iostream>
#include <omp.h>
#include <cstdio>
#include <sstream>
#include <fstream>
namespace mkmh{
using namespace mkmh;
using namespace std;
typedef uint64_t hash_t;
class HASHTCounter{
public:
HASHTCounter();
HASHTCounter(uint64_t sz);
~HASHTCounter();
int& operator[](hash_t key);
void increment(const hash_t& key);
void bulk_increment(hash_t* h, int num);
int& get(const hash_t& key);
void get(const hash_t& key, int& ret);
int size(void);
void size(int sz);
void resize(int sz);
inline void set(int pos, int val){
*(counts + pos) = val;
};
int* begin(void);
std::string to_string();
void write_to_binary(std::string filename);
void print();
private:
uint64_t my_size;
int* counts;
};
}
#endif