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/SHAMapNodeID.h>
25#include <xrpld/shamap/SHAMapTreeNode.h>
26
27#include <cstdint>
28
29namespace ripple {
30
32{
33protected:
34 boost::intrusive_ptr<SHAMapItem const> item_;
35
37 boost::intrusive_ptr<SHAMapItem const> item,
39
41 boost::intrusive_ptr<SHAMapItem const> item,
43 SHAMapHash const& hash);
44
45public:
48 operator=(const SHAMapLeafNode&) = delete;
49
50 bool
51 isLeaf() const final override
52 {
53 return true;
54 }
55
56 bool
57 isInner() const final override
58 {
59 return false;
60 }
61
62 void
63 invariants(bool is_root = false) const final override;
64
65public:
66 boost::intrusive_ptr<SHAMapItem const> const&
67 peekItem() const;
68
75 bool
76 setItem(boost::intrusive_ptr<SHAMapItem const> i);
77
78 std::string
79 getString(SHAMapNodeID const&) const final override;
80};
81
82} // namespace ripple
83
84#endif
SHAMapLeafNode & operator=(const SHAMapLeafNode &)=delete
std::string getString(SHAMapNodeID const &) const final override
SHAMapLeafNode(const SHAMapLeafNode &)=delete
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.
void invariants(bool is_root=false) const final override
boost::intrusive_ptr< SHAMapItem const > const & peekItem() const
Identifies a node inside a SHAMap.
Definition: SHAMapNodeID.h:34
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:26
STL namespace.