CatapultServer  v0.5.0.1 (Elephant)
ShortHash.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "BaseValue.h"
23 #include "catapult/types.h"
24 #include <unordered_set>
25 
26 namespace catapult { namespace utils {
27 
28  struct ShortHash_tag {};
30 
31  // Trivial hash function for ShortHash
32  struct ShortHashHasher {
33  size_t operator()(const ShortHash& shortHash) const {
34  return shortHash.unwrap();
35  }
36  };
37 
38  // An unordered set of short hashes.
39  using ShortHashesSet = std::unordered_set<ShortHash, ShortHashHasher>;
40 
42  inline ShortHash ToShortHash(const Hash256& hash) {
43  return reinterpret_cast<const ShortHash&>(hash[0]);
44  }
45 }}
catapult::utils::ToShortHash
ShortHash ToShortHash(const Hash256 &hash)
Gets the short hash corresponding to hash.
Definition: ShortHash.h:42
catapult::utils::ShortHash_tag
Definition: ShortHash.h:28
catapult::utils::ShortHashHasher::operator()
size_t operator()(const ShortHash &shortHash) const
Definition: ShortHash.h:33
catapult::utils::BasicBaseValue::unwrap
constexpr ValueType unwrap() const
Unwraps this value and returns the underlying raw value.
Definition: BaseValue.h:53
catapult::utils::ShortHashHasher
Definition: ShortHash.h:32
catapult::utils::BaseValue
Immutable wrapper for basic types, to provide some type-safety.
Definition: BaseValue.h:100
catapult::utils::ShortHashesSet
std::unordered_set< ShortHash, ShortHashHasher > ShortHashesSet
Definition: ShortHash.h:39
types.h
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::utils::ByteArray
Base class for wrappers of byte array types, to provide some type-safety.
Definition: ByteArray.h:29
BaseValue.h