aboutsummaryrefslogtreecommitdiff
path: root/include/odhtdb/DataView.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/odhtdb/DataView.hpp')
-rw-r--r--include/odhtdb/DataView.hpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/odhtdb/DataView.hpp b/include/odhtdb/DataView.hpp
new file mode 100644
index 0000000..0ecf9fb
--- /dev/null
+++ b/include/odhtdb/DataView.hpp
@@ -0,0 +1,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>;
+}