vg
tools for working with variation graphs
|
#include <stream_index.hpp>
Public Member Functions | |
void | insert (const BitString &key, const Item &value) |
bool | traverse_up (const BitString &key, const function< bool(const Item &)> &iteratee) const |
bool | traverse_in_order (const BitString &low, const BitString &high, const function< bool(const Item &)> &iteratee) const |
Public Attributes | |
BitString | prefix |
Each TreeNode represents a prefix over its parent. More... | |
unique_ptr< TreeNode > | children [2] |
Item | content |
Each TreeNode also may hold an item record. More... | |
bool | has_content = false |
This is set if we actually have one. More... | |
void vg::BitStringTree< Item >::TreeNode::insert | ( | const BitString & | key, |
const Item & | value | ||
) |
Insert the given item at or under this node. Its key must have had our prefix already removed from it.
bool vg::BitStringTree< Item >::TreeNode::traverse_in_order | ( | const BitString & | low, |
const BitString & | high, | ||
const function< bool(const Item &)> & | iteratee | ||
) | const |
Iterate over elements in the tree with an in-order traversal between the two given keys, inclusive. Low and high have already had this node's prefix removed.
Define a function to process each child. Returns false if we stop early
bool vg::BitStringTree< Item >::TreeNode::traverse_up | ( | const BitString & | key, |
const function< bool(const Item &)> & | iteratee | ||
) | const |
Search down to the node that corresponds to the given key, or where it would be. Call the iteratee for that node and every parent, from bottom to top, until the iteratee returns false. If not found, do not call the iteratee. Retruns true if the iteratee did not ask to stop, and false otherwise. The key will have already had this node's prefix removed.
unique_ptr<TreeNode> vg::BitStringTree< Item >::TreeNode::children[2] |
Each TreeNode holds a 0 child and a 1 child, at most Their prefixes say what full prefixes they actually correspond to
Item vg::BitStringTree< Item >::TreeNode::content |
Each TreeNode also may hold an item record.
bool vg::BitStringTree< Item >::TreeNode::has_content = false |
This is set if we actually have one.
BitString vg::BitStringTree< Item >::TreeNode::prefix |
Each TreeNode represents a prefix over its parent.