CatapultServer
v0.5.0.1 (Elephant)
|
Go to the documentation of this file.
27 namespace catapult {
namespace tree {
class TreeNode; } }
29 namespace catapult {
namespace tree {
77 bool hasLink(
size_t index)
const;
83 std::unique_ptr<const TreeNode>
linkedNode(
size_t index)
const;
112 std::array<Hash256, BranchTreeNode::Max_Links>
m_links;
TreeNode copy() const
Creates a copy of this node.
Definition: TreeNode.cpp:234
const TreeNodePath & path() const
Gets the node path.
Definition: TreeNode.cpp:90
utils::ByteArray< Hash256_Size, Hash256_tag > Hash256
Definition: src/catapult/types.h:47
TreeNode()
Creates an empty tree node.
Definition: TreeNode.cpp:172
std::array< std::shared_ptr< const TreeNode >, BranchTreeNode::Max_Links > m_linkedNodes
Definition: TreeNode.h:113
TreeNodePath m_path
Definition: TreeNode.h:111
Hash256 m_hash
Definition: TreeNode.h:52
LeafTreeNode(const TreeNodePath &path, const Hash256 &value)
Creates a leaf node with path and value.
Definition: TreeNode.cpp:62
Hash256 m_value
Definition: TreeNode.h:51
Builder for building a hash.
Definition: Hashes.h:61
const Hash256 & hash() const
Gets the hash representation of this node.
Definition: TreeNode.cpp:202
bool empty() const
Returns true if this node represents an empty node.
Definition: TreeNode.cpp:181
KeccakBuilder< Sha3ModeTag, Hash256_tag > Sha3_256_Builder
Sha3_256_Builder.
Definition: Hashes.h:85
TreeNodePath m_emptyPath
Definition: TreeNode.h:168
const Hash256 & value() const
Gets the node value.
Definition: TreeNode.cpp:72
bool m_isDirty
Definition: TreeNode.h:116
const TreeNodePath & path() const
Gets the node path.
Definition: TreeNode.cpp:68
TreeNodePath m_path
Definition: TreeNode.h:50
void compactLinks()
Compacts all links by replacing node links with hash links.
Definition: TreeNode.cpp:152
bool isLeaf() const
Returns true if this node represents a leaf node.
Definition: TreeNode.cpp:189
static constexpr size_t Max_Links
Maximum number of branch links.
Definition: TreeNode.h:63
void final(OutputType &output) noexcept
Finalize hash calculation. Returns result in output.
Definition: Hashes.cpp:145
void setPath(const TreeNodePath &path)
Sets the node path.
Definition: TreeNode.cpp:211
const Hash256 & link(size_t index) const
Gets the branch link at index.
Definition: TreeNode.cpp:102
std::bitset< BranchTreeNode::Max_Links > m_linkSet
Definition: TreeNode.h:114
const BranchTreeNode & asBranchNode() const
Gets a branch node interface to this node.
Definition: TreeNode.cpp:227
std::array< Hash256, BranchTreeNode::Max_Links > m_links
Definition: TreeNode.h:112
void setPath(const TreeNodePath &path)
Sets the branch node path.
Definition: TreeNode.cpp:130
const Hash256 & hash() const
Gets the hash representation of this node.
Definition: TreeNode.cpp:116
void update(const RawBuffer &dataBuffer) noexcept
Updates the state of hash with data inside dataBuffer.
Definition: Hashes.cpp:134
std::vector< uint8_t > m_path
Definition: TreeNodePath.cpp:112
bool hasLink(size_t index) const
Returns true if this branch has a link at index.
Definition: TreeNode.cpp:98
Represents a leaf tree node.
Definition: TreeNode.h:34
const TreeNodePath & path() const
Gets the node path.
Definition: TreeNode.cpp:193
uint8_t highestLinkIndex() const
Gets the index of the highest set link.
Definition: TreeNode.cpp:112
#define CATAPULT_THROW_RUNTIME_ERROR(MESSAGE)
Macro used to throw a catapult runtime error.
Definition: exceptions.h:167
void setLink(const Hash256 &link, size_t index)
Sets the branch link at index.
Definition: TreeNode.cpp:135
std::unique_ptr< LeafTreeNode > m_pLeafNode
Definition: TreeNode.h:170
const LeafTreeNode & asLeafNode() const
Gets a leaf node interface to this node.
Definition: TreeNode.cpp:220
Definition: AddressExtractionExtension.cpp:28
constexpr T Log2(T value)
Calculates log2(value).
Definition: IntegerMath.h:46
Represents a tree node.
Definition: TreeNode.h:124
bool isBranch() const
Returns true if this node represents a branch node.
Definition: TreeNode.cpp:185
Hash256 m_emptyHash
Definition: TreeNode.h:169
Hash256 m_hash
Definition: TreeNode.h:115
Represents a path in a tree.
Definition: TreeNodePath.h:31
BranchTreeNode(const TreeNodePath &path)
Creates a branch node with path.
Definition: TreeNode.cpp:84
std::unique_ptr< BranchTreeNode > m_pBranchNode
Definition: TreeNode.h:171
void clearLink(size_t index)
Clears the branch link at index.
Definition: TreeNode.cpp:147
std::unique_ptr< const TreeNode > linkedNode(size_t index) const
Gets a copy of the linked node at index or nullptr if no linked node is present.
Definition: TreeNode.cpp:107
Represents a branch tree node.
Definition: TreeNode.h:60
const Hash256 & hash() const
Gets the hash representation of this node.
Definition: TreeNode.cpp:76
size_t numLinks() const
Gets the number of links set in this node.
Definition: TreeNode.cpp:94