CatapultServer  v0.5.0.1 (Elephant)
catapult::tree::BranchTreeNode Class Reference

Represents a branch tree node. More...

Collaboration diagram for catapult::tree::BranchTreeNode:

Public Member Functions

 BranchTreeNode (const TreeNodePath &path)
 Creates a branch node with path. More...
 
const TreeNodePathpath () 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 Hash256link (size_t index) const
 Gets the branch link at index. More...
 
std::unique_ptr< const TreeNodelinkedNode (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 Hash256hash () 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_Linksm_links
 
std::array< std::shared_ptr< const TreeNode >, BranchTreeNode::Max_Linksm_linkedNodes
 
std::bitset< BranchTreeNode::Max_Linksm_linkSet
 
Hash256 m_hash
 
bool m_isDirty
 

Detailed Description

Represents a branch tree node.

Constructor & Destructor Documentation

◆ BranchTreeNode()

catapult::tree::BranchTreeNode::BranchTreeNode ( const TreeNodePath path)
explicit

Creates a branch node with path.

Member Function Documentation

◆ clearLink()

void catapult::tree::BranchTreeNode::clearLink ( size_t  index)

Clears the branch link at index.

Here is the call graph for this function:

◆ compactLinks()

void catapult::tree::BranchTreeNode::compactLinks ( )

Compacts all links by replacing node links with hash links.

◆ hash()

const Hash256 & catapult::tree::BranchTreeNode::hash ( ) const

Gets the hash representation of this node.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasLink()

bool catapult::tree::BranchTreeNode::hasLink ( size_t  index) const

Returns true if this branch has a link at index.

◆ highestLinkIndex()

uint8_t catapult::tree::BranchTreeNode::highestLinkIndex ( ) const

Gets the index of the highest set link.

Here is the call graph for this function:

◆ link()

const Hash256 & catapult::tree::BranchTreeNode::link ( size_t  index) const

Gets the branch link at index.

Here is the caller graph for this function:

◆ linkedNode()

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.

Here is the caller graph for this function:

◆ numLinks()

size_t catapult::tree::BranchTreeNode::numLinks ( ) const

Gets the number of links set in this node.

Here is the caller graph for this function:

◆ path()

const TreeNodePath & catapult::tree::BranchTreeNode::path ( ) const

Gets the node path.

Here is the caller graph for this function:

◆ setLink() [1/3]

void catapult::tree::BranchTreeNode::setLink ( const Hash256 link,
size_t  index 
)

Sets the branch link at index.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setLink() [2/3]

void catapult::tree::BranchTreeNode::setLink ( const TreeNode node,
size_t  index 
)

Sets the branch link at index to node.

Here is the call graph for this function:

◆ setLink() [3/3]

void catapult::tree::BranchTreeNode::setLink ( size_t  index)
private

◆ setPath()

void catapult::tree::BranchTreeNode::setPath ( const TreeNodePath path)

Sets the branch node path.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_hash

Hash256 catapult::tree::BranchTreeNode::m_hash
mutableprivate

◆ m_isDirty

bool catapult::tree::BranchTreeNode::m_isDirty
mutableprivate

◆ m_linkedNodes

std::array<std::shared_ptr<const TreeNode>, BranchTreeNode::Max_Links> catapult::tree::BranchTreeNode::m_linkedNodes
private

◆ m_links

std::array<Hash256, BranchTreeNode::Max_Links> catapult::tree::BranchTreeNode::m_links
private

◆ m_linkSet

std::bitset<BranchTreeNode::Max_Links> catapult::tree::BranchTreeNode::m_linkSet
private

◆ m_path

TreeNodePath catapult::tree::BranchTreeNode::m_path
private

◆ Max_Links

constexpr size_t catapult::tree::BranchTreeNode::Max_Links = 16
staticconstexpr

Maximum number of branch links.


The documentation for this class was generated from the following files: