From f77e73c01a15426bcc6e3d7fe5826d2a741fed38 Mon Sep 17 00:00:00 2001 From: hnOsmium0001 Date: Mon, 18 Apr 2022 20:18:09 -0700 Subject: Add Uid for IresObject --- source/Uid.hpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 source/Uid.hpp (limited to 'source/Uid.hpp') diff --git a/source/Uid.hpp b/source/Uid.hpp new file mode 100644 index 0000000..a076533 --- /dev/null +++ b/source/Uid.hpp @@ -0,0 +1,32 @@ +#pragma once + +#include "Utils.hpp" + +#include +#include +#include + +struct Uid { + uint64_t upper = 0; + uint64_t lower = 0; + + static Uid Create(); + + bool IsNull() const; + + void Read(const rapidjson::Value& value); + void WriteInto(rapidjson::Value& value, rapidjson::Document& root); + rapidjson::Value Write(rapidjson::Document& root); + + auto operator<=>(const Uid&) const = default; +}; + +template <> +struct std::hash { + size_t operator()(const Uid& uid) const { + size_t hash = 0; + Utils::HashCombine(hash, uid.upper); + Utils::HashCombine(hash, uid.lower); + return hash; + } +}; -- cgit v1.2.3-70-g09d2