summaryrefslogtreecommitdiff
path: root/include/erebos/storage.h
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2021-01-24 22:46:48 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2021-01-29 22:28:01 +0100
commita16b33031c7bcf2eabf1e0c3571000234b7740df (patch)
treef012ff7814abe7fa22c5a610388faf4310d53772 /include/erebos/storage.h
parent3a3cce8eed7e43faa8c9f606e56bb43ba3bd9451 (diff)
Attach service
Diffstat (limited to 'include/erebos/storage.h')
-rw-r--r--include/erebos/storage.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/erebos/storage.h b/include/erebos/storage.h
index 29eaa8f..4f67a4b 100644
--- a/include/erebos/storage.h
+++ b/include/erebos/storage.h
@@ -123,6 +123,9 @@ public:
explicit operator std::string() const;
bool isZero() const;
+ static Digest of(const std::vector<uint8_t> & content);
+ template<class S> static Digest of(const ObjectT<S> &);
+
const std::array<uint8_t, size> & arr() const { return value; }
bool operator==(const Digest & other) const { return value == other.value; }
@@ -136,6 +139,12 @@ private:
std::array<uint8_t, size> value;
};
+template<class S>
+Digest Digest::of(const ObjectT<S> & obj)
+{
+ return Digest::of(obj.encode());
+}
+
class PartialRef
{
public: