20 #include <ripple/basics/contract.h>
21 #include <ripple/ledger/CachedView.h>
22 #include <ripple/protocol/Serializer.h>
30 return read(k) !=
nullptr;
38 auto const iter =
map_.find(k.
key);
39 if (iter !=
map_.end())
41 if (!iter->second || !k.
check(*iter->second))
51 auto const er =
map_.emplace(k.
key, sle);
52 auto const& iter = er.first;
53 bool const inserted = er.second;
54 if (iter->second && !k.
check(*iter->second))
A pair of SHAMap key and LedgerEntryType.
std::optional< digest_type > digest(key_type const &key) const override
std::shared_ptr< SLE const > read(Keylet const &k) const override
Return the state item associated with a key.
std::unordered_map< key_type, std::shared_ptr< SLE const >, hardened_hash<> > map_
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
DigestAwareReadView const & base_
std::shared_ptr< T > fetch(const key_type &key)
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
bool exists(Keylet const &k) const override
Determine if a state item exists.
bool check(STLedgerEntry const &) const
Returns true if the SLE matches the type.
virtual std::optional< digest_type > digest(key_type const &key) const =0
Return the digest associated with the key.