CatapultServer
v0.5.0.1 (Elephant)
|
Represents a branch tree node. More...
Public Member Functions | |
BranchTreeNode (const TreeNodePath &path) | |
Creates a branch node with path. More... | |
const TreeNodePath & | path () const |
Gets the node path. More... | |
size_t | numLinks () const |
Gets the number of links set in this node. More... | |
bool | hasLink (size_t index) const |
Returns true if this branch has a link at index. More... | |
const Hash256 & | link (size_t index) const |
Gets the branch link at index. More... | |
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. More... | |
uint8_t | highestLinkIndex () const |
Gets the index of the highest set link. More... | |
const Hash256 & | hash () const |
Gets the hash representation of this node. More... | |
void | setPath (const TreeNodePath &path) |
Sets the branch node path. More... | |
void | setLink (const Hash256 &link, size_t index) |
Sets the branch link at index. More... | |
void | setLink (const TreeNode &node, size_t index) |
Sets the branch link at index to node. More... | |
void | clearLink (size_t index) |
Clears the branch link at index. More... | |
void | compactLinks () |
Compacts all links by replacing node links with hash links. More... | |
Static Public Attributes | |
static constexpr size_t | Max_Links = 16 |
Maximum number of branch links. More... | |
Private Member Functions | |
void | setLink (size_t index) |
Private Attributes | |
TreeNodePath | m_path |
std::array< Hash256, BranchTreeNode::Max_Links > | m_links |
std::array< std::shared_ptr< const TreeNode >, BranchTreeNode::Max_Links > | m_linkedNodes |
std::bitset< BranchTreeNode::Max_Links > | m_linkSet |
Hash256 | m_hash |
bool | m_isDirty |
Represents a branch tree node.
|
explicit |
Creates a branch node with path.
void catapult::tree::BranchTreeNode::clearLink | ( | size_t | index | ) |
Clears the branch link at index.
void catapult::tree::BranchTreeNode::compactLinks | ( | ) |
Compacts all links by replacing node links with hash links.
const Hash256 & catapult::tree::BranchTreeNode::hash | ( | ) | const |
Gets the hash representation of this node.
bool catapult::tree::BranchTreeNode::hasLink | ( | size_t | index | ) | const |
Returns true
if this branch has a link at index.
uint8_t catapult::tree::BranchTreeNode::highestLinkIndex | ( | ) | const |
Gets the index of the highest set link.
const Hash256 & catapult::tree::BranchTreeNode::link | ( | size_t | index | ) | const |
Gets the branch link at index.
std::unique_ptr< const TreeNode > catapult::tree::BranchTreeNode::linkedNode | ( | size_t | index | ) | const |
Gets a copy of the linked node at index or nullptr
if no linked node is present.
size_t catapult::tree::BranchTreeNode::numLinks | ( | ) | const |
Gets the number of links set in this node.
const TreeNodePath & catapult::tree::BranchTreeNode::path | ( | ) | const |
Gets the node path.
void catapult::tree::BranchTreeNode::setLink | ( | const Hash256 & | link, |
size_t | index | ||
) |
Sets the branch link at index.
void catapult::tree::BranchTreeNode::setLink | ( | const TreeNode & | node, |
size_t | index | ||
) |
Sets the branch link at index to node.
|
private |
void catapult::tree::BranchTreeNode::setPath | ( | const TreeNodePath & | path | ) |
Sets the branch node path.
|
mutableprivate |
|
mutableprivate |
|
private |
|
private |
|
private |
|
private |
|
staticconstexpr |
Maximum number of branch links.