blob: b71b3780af31f28cdce8ada71dc6ef23ac40bb3f (
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
31
32
33
34
|
#pragma once
#include "types.hpp"
#include "Hash.hpp"
#include <unordered_map>
#include <string>
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;
bool operator != (const DataView &other) const;
std::string toString() 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>;
}
|