rippled
Loading...
Searching...
No Matches
SHAMapLeafNode.h
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/ripple/rippled
4 Copyright (c) 2012, 2013 Ripple Labs Inc.
5
6 Permission to use, copy, modify, and/or distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#ifndef RIPPLE_SHAMAP_SHAMAPLEAFNODE_H_INCLUDED
21#define RIPPLE_SHAMAP_SHAMAPLEAFNODE_H_INCLUDED
22
23#include <xrpld/shamap/SHAMapItem.h>
24#include <xrpld/shamap/SHAMapTreeNode.h>
25
26#include <cstdint>
27
28namespace ripple {
29
31{
32protected:
33 boost::intrusive_ptr<SHAMapItem const> item_;
34
36 boost::intrusive_ptr<SHAMapItem const> item,
38
40 boost::intrusive_ptr<SHAMapItem const> item,
42 SHAMapHash const& hash);
43
44public:
47 operator=(SHAMapLeafNode const&) = delete;
48
49 bool
50 isLeaf() const final override
51 {
52 return true;
53 }
54
55 bool
56 isInner() const final override
57 {
58 return false;
59 }
60
61 void
62 invariants(bool is_root = false) const final override;
63
64public:
65 boost::intrusive_ptr<SHAMapItem const> const&
66 peekItem() const;
67
74 bool
75 setItem(boost::intrusive_ptr<SHAMapItem const> i);
76
77 std::string
78 getString(SHAMapNodeID const&) const final override;
79};
80
81} // namespace ripple
82
83#endif
SHAMapLeafNode & operator=(SHAMapLeafNode const &)=delete
std::string getString(SHAMapNodeID const &) const final override
bool isInner() const final override
Determines if this is an inner node.
boost::intrusive_ptr< SHAMapItem const > item_
bool isLeaf() const final override
Determines if this is a leaf node.
bool setItem(boost::intrusive_ptr< SHAMapItem const > i)
Set the item that this node points to and update the node's hash.
SHAMapLeafNode(SHAMapLeafNode const &)=delete
void invariants(bool is_root=false) const final override
boost::intrusive_ptr< SHAMapItem const > const & peekItem() const
Identifies a node inside a SHAMap.
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.
Definition algorithm.h:25
STL namespace.