20#ifndef RIPPLE_SHAMAP_SHAMAPTREENODE_H_INCLUDED 
   21#define RIPPLE_SHAMAP_SHAMAPTREENODE_H_INCLUDED 
   23#include <xrpl/basics/IntrusivePointer.h> 
   24#include <xrpl/basics/IntrusiveRefCounts.h> 
   25#include <xrpl/basics/SHAMapHash.h> 
   26#include <xrpl/protocol/Serializer.h> 
   27#include <xrpl/shamap/SHAMapItem.h> 
   28#include <xrpl/shamap/SHAMapNodeID.h> 
Identifies a node inside a SHAMap.
 
SHAMapTreeNode & operator=(SHAMapTreeNode const &)=delete
 
static intr_ptr::SharedPtr< SHAMapTreeNode > makeAccountState(Slice data, SHAMapHash const &hash, bool hashValid)
 
virtual ~SHAMapTreeNode() noexcept=default
 
virtual std::string getString(SHAMapNodeID const &) const
 
virtual bool isLeaf() const =0
Determines if this is a leaf node.
 
static intr_ptr::SharedPtr< SHAMapTreeNode > makeTransaction(Slice data, SHAMapHash const &hash, bool hashValid)
 
SHAMapTreeNode(SHAMapTreeNode const &)=delete
 
virtual void partialDestructor()
 
static intr_ptr::SharedPtr< SHAMapTreeNode > makeTransactionWithMeta(Slice data, SHAMapHash const &hash, bool hashValid)
 
virtual void updateHash()=0
Recalculate the hash of this node.
 
SHAMapTreeNode(std::uint32_t cowid) noexcept
Construct a node.
 
virtual bool isInner() const =0
Determines if this is an inner node.
 
std::uint32_t cowid_
Determines the owning SHAMap, if any.
 
virtual void invariants(bool is_root=false) const =0
 
static intr_ptr::SharedPtr< SHAMapTreeNode > makeFromPrefix(Slice rawNode, SHAMapHash const &hash)
 
SHAMapTreeNode(std::uint32_t cowid, SHAMapHash const &hash) noexcept
 
SHAMapHash const & getHash() const
Return the hash of this node.
 
virtual void serializeForWire(Serializer &) const =0
Serialize the node in a format appropriate for sending over the wire.
 
virtual void serializeWithPrefix(Serializer &) const =0
Serialize the node in a format appropriate for hashing.
 
static intr_ptr::SharedPtr< SHAMapTreeNode > makeFromWire(Slice rawNode)
 
virtual SHAMapNodeType getType() const =0
Determines the type of node.
 
A shared intrusive pointer class that supports weak pointers.
 
An immutable linear range of bytes.
 
void unshare()
If this node is shared with another map, mark it as no longer shared.
 
virtual intr_ptr::SharedPtr< SHAMapTreeNode > clone(std::uint32_t cowid) const =0
Make a copy of this node, setting the owner.
 
std::uint32_t cowid() const
Returns the SHAMap that owns this node.
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
static constexpr unsigned char const wireTypeAccountState
 
static constexpr unsigned char const wireTypeCompressedInner
 
static constexpr unsigned char const wireTypeInner
 
static constexpr unsigned char const wireTypeTransaction
 
static constexpr unsigned char const wireTypeTransactionWithMeta
 
Implement the strong count, weak count, and bit flags for an intrusive pointer.