blob: 0ecf9fb1768c3b3dfb26a5d4d7d7aca82a6f5166 (
plain)
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
|
#pragma once
#include "types.hpp"
#include "Hash.hpp"
#include <unordered_map>
namespace odhtdb
{
class DataView
{
public:
DataView() : data(nullptr), size(0) {}
DataView(void *_data, usize _size) : data(_data), size(_size) {}
bool operator == (const DataView &other) const;
void *data;
usize size;
};
struct DataViewHasher
{
size_t operator()(const DataView &dataView) const
{
return fnvHash((const unsigned char*)dataView.data, dataView.size);
}
};
template <typename ValueType>
using DataViewMap = std::unordered_map<DataView, ValueType, DataViewHasher>;
}
|