aboutsummaryrefslogtreecommitdiff
path: root/include/DataView.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-03-11 00:12:37 +0100
committerdec05eba <dec05eba@protonmail.com>2020-08-18 23:25:46 +0200
commit6099ec04bd0d98b9e75f5b55b1215c94ccf20202 (patch)
tree9a551e8e723cde057610d6071587bc76b4a6af19 /include/DataView.hpp
parent0e62cb8e5ed06d906ad84321cdda22acfcc952c9 (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.hpp14
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>;
}