Yggdrasill  0.2
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
ygg::ZTreeNodeBase< Node, Options, Tag > Class Template Reference

Base class (template) to supply your node class with metainformation. More...

#include <ziptree.hpp>

Inheritance diagram for ygg::ZTreeNodeBase< Node, Options, Tag >:
ygg::bst::BSTNodeBase< Node, Tag >

Public Member Functions

size_t get_depth () const noexcept
 
void set_parent (Node *new_parent) noexcept
 
Node * get_parent () const noexcept
 
std::enable_if_t< InnerPC::parent_reference, Node *&> get_parent () const noexcept
 
void set_left (Node *new_left) noexcept
 
void set_right (Node *new_right) noexcept
 
Node *& get_left () noexcept
 
Node *const & get_left () const noexcept
 
Node *& get_right () noexcept
 
Node *const & get_right () const noexcept
 

Protected Member Functions

void update_rank () noexcept
 Update the stored rank in this node. More...
 

Protected Attributes

Node * _bst_children [2]
 
DefaultParentContainer< Node > _bst_parent
 

Friends

template<class , class , bool , bool >
class ztree_internal::ZTreeRankGenerator
 

Detailed Description

template<class Node, class Options, class Tag>
class ygg::ZTreeNodeBase< Node, Options, Tag >

Base class (template) to supply your node class with metainformation.

The class you use as nodes for the Zip Tree must derive from this class (template). It supplies your class with the necessary members to contain the linking between the tree nodes.

Template Parameters
NodeThe node class itself. Yes, that's the class derived from this template. This sounds weird, but is correct. See the examples if you're confused.
optionsThe options class (a version of TreeOptions) that you parameterize the tree with. (See the options parameter of ZTree.)
TagThe tag used to identify the tree that this node should be inserted into. See ZTree for details.

Member Function Documentation

◆ update_rank()

template<class Node, class Options, class Tag>
void ygg::ZTreeNodeBase< Node, Options, Tag >::update_rank ( )
inlineprotectednoexcept

Update the stored rank in this node.

If you configure your ZTree to generate the nodes' ranks from hashes (i.e., set TreeFlags::ZTREE_USE_HASH) and to store the nodes' ranks (i.e., set TreeFlags::ZTREE_RANK_TYPE), you must call this method before adding the node to your tree, but after the node's hash has become valid.

Warning
Inserting a node into the tree in the aforementioned case before calling calling this method leads to undefined behavior.

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