-
Notifications
You must be signed in to change notification settings - Fork 1
/
defs.h
74 lines (60 loc) · 1.15 KB
/
defs.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
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
#ifndef DEFS
#define DEFS
#include <iostream>
#include <ctime>
#include <unordered_map>
#include <map>
#include <chrono>
#include <string>
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include "./anchorhash/AnchorHash.h"
#include "./robinhoodmap/robin_hood.h"
#include "./xxhash/xxhash.h"
using namespace std;
void inline pause()
{
cout << '\n' << "Press the Enter key to continue.";
cin.ignore( ( numeric_limits< streamsize >::max )( ), '\n' );
}
#define FT_LEN 13
struct FiveTuple
{
char ft[14];
bool operator==(const FiveTuple& connID) const
{
return memcmp(ft, connID.ft, FT_LEN) == 0;
}
FiveTuple(const FiveTuple& connID)
{
memcpy(ft, connID.ft, FT_LEN);
ft[FT_LEN] = 0;
}
FiveTuple(const string str)
{
memcpy(ft, str.c_str(), FT_LEN);
ft[FT_LEN] = 0;
}
FiveTuple(const char* chr)
{
memcpy(ft, chr, FT_LEN);
ft[FT_LEN] = 0;
}
FiveTuple()
{
ft[FT_LEN] = 0;
}
};
struct FiveTupleHasher
{
std::hash<string> string_hash;
size_t operator()(const FiveTuple& x) const
{
return XXH64(x.ft, FT_LEN, 42);
}
};
typedef std::pair<FiveTuple, int> hist_pair;
#endif