Kagome
Polkadot Runtime Engine in C++17
code_substitutes.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_CODE_SUBSTITUTES_HPP
7 #define KAGOME_CODE_SUBSTITUTES_HPP
8 
9 #include <initializer_list>
10 #include <unordered_set>
11 
12 #include "block_id.hpp"
13 
14 namespace kagome::primitives {
15 
20  : public std::unordered_set<primitives::BlockId> {
21  CodeSubstituteBlockIds() = default;
22  CodeSubstituteBlockIds(const CodeSubstituteBlockIds &src) = default;
25  std::initializer_list<primitives::BlockId> init)
26  : unordered_set<primitives::BlockId>(init) {}
27  ~CodeSubstituteBlockIds() = default;
28 
30  default;
32 
33  bool contains(const primitives::BlockInfo &block_info) const {
34  return count(block_info.number) != 0 || count(block_info.hash) != 0;
35  };
36 
37  bool contains(const primitives::BlockId &block_id) const {
38  return count(block_id) != 0;
39  }
40  };
41 
42 } // namespace kagome::primitives
43 
44 #endif // KAGOME_CODE_SUBSTITUTES_HPP
bool contains(const primitives::BlockId &block_id) const
CodeSubstituteBlockIds(std::initializer_list< primitives::BlockId > init)
bool contains(const primitives::BlockInfo &block_info) const
CodeSubstituteBlockIds & operator=(const CodeSubstituteBlockIds &src)=default
boost::variant< BlockHash, BlockNumber > BlockId
Block id is the variant over BlockHash and BlockNumber.
Definition: block_id.hpp:18