diff options
author | Aleksi Lindeman <0xdec05eba@gmail.com> | 2018-03-11 00:12:37 +0100 |
---|---|---|
committer | Aleksi Lindeman <0xdec05eba@gmail.com> | 2018-03-11 00:13:38 +0100 |
commit | 1328d943c5016dd1662a4e46d4a408bca010cffc (patch) | |
tree | 8483ee99e3831fca474a2b7b3743e8dbd0e6ee52 /include/DataView.hpp | |
parent | 230e61091b401b8b2bb9496d557a15660fb5072b (diff) |
Add operation to allow users to be added to group
WARNING! Lazy implementation everywhere, does not handle out-of-order
packets
Diffstat (limited to 'include/DataView.hpp')
-rw-r--r-- | include/DataView.hpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/DataView.hpp b/include/DataView.hpp index c020f91..0ecf9fb 100644 --- a/include/DataView.hpp +++ b/include/DataView.hpp @@ -1,6 +1,8 @@ #pragma once #include "types.hpp" +#include "Hash.hpp" +#include <unordered_map> namespace odhtdb { @@ -9,8 +11,20 @@ namespace odhtdb 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>; } |