Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Interval_Tree< T, Compare > Struct Template Reference

Interval tree using nodes without virtual destructor. More...

#include <tpl_interval_tree.H>

Inheritance diagram for Aleph::Interval_Tree< T, Compare >:
[legend]
Collaboration diagram for Aleph::Interval_Tree< T, Compare >:
[legend]

Public Types

using Base = Gen_Interval_Tree< Interval_Tree_Node, T, Compare >
 
- Public Types inherited from Aleph::Gen_Interval_Tree< NodeType, T, Compare >
using Key = Interval< T >
 
using IntervalCmp = Interval_Less< T, Compare >
 
using Node = NodeType< Key >
 

Additional Inherited Members

- Public Member Functions inherited from Aleph::Gen_Interval_Tree< NodeType, T, Compare >
void set_seed (const unsigned long seed)
 Seeds the Mersenne Twister of the tree, as gsl_rng_set() did: the priorities are from then on those of GSL for the seed.
 
IntervalCmp key_comp () const noexcept(std::is_nothrow_copy_constructible_v< Compare >)
 Return the interval comparison functor (over Interval<T> keys).
 
const Compare & endpoint_comp () const noexcept
 Return the endpoint comparison functor (const)
 
const Compare & get_compare () const noexcept
 Backwards-compatible accessor for the endpoint comparator.
 
void swap (Gen_Interval_Tree &tree) noexcept(noexcept(std::swap(tree_root, tree.tree_root)) and noexcept(std::swap(cmp, tree.cmp)) and noexcept(r.swap(tree.r)) and noexcept(std::swap(num_nodes, tree.num_nodes)))
 Swap all state with tree in O(1)
 
 Gen_Interval_Tree (const unsigned long seed, const Compare &_cmp=Compare())
 Construct with explicit seed and comparator: the priorities are those of GSL for the seed, drawn from a Mersenne Twister in dynamic memory.
 
 Gen_Interval_Tree (const Compare &_cmp=Compare())
 Construct without a seed: the priorities are drawn from a SplitMix64 with a seed of its own, inside the tree, which allocates nothing.
 
 Gen_Interval_Tree (const Gen_Interval_Tree &)=delete
 Deleted copy constructor.
 
Gen_Interval_Tree & operator= (const Gen_Interval_Tree &)=delete
 Deleted copy assignment.
 
 Gen_Interval_Tree (Gen_Interval_Tree &&)=delete
 Deleted move constructor.
 
Gen_Interval_Tree & operator= (Gen_Interval_Tree &&)=delete
 Deleted move assignment.
 
Random_Source & random_source () noexcept
 The source of random numbers, which gives the priorities.
 
const Random_Source & random_source () const noexcept
 The source of random numbers, to look at it: its engine, or whether it is equal to another one.
 
Gsl_Compatible_Rng & rng () const
 The Mersenne Twister of the tree, which a tree that was given no seed makes here, and draws from it from then on.
 
Node *& getRoot () noexcept
 Return the tree's root.
 
const Node * getRoot () const
 Return the tree's root (const)
 
size_t size () const noexcept
 Return the number of nodes.
 
bool is_empty () const noexcept
 Return true if the tree is empty.
 
void reset_num_nodes () noexcept
 Reset the node count (used after manual tree destruction)
 
const Node * search (const Key &key) const noexcept(std::is_nothrow_copy_constructible_v< Compare > and NothrowPredicateWith< const Compare &, const T &, const T & >)
 Search for an exact interval in the tree.
 
Node * insert (Node *p)
 Insert a node (no duplicates).
 
Node * insert_dup (Node *p)
 Insert a node (duplicates allowed).
 
Node * remove (const Key &key)
 Remove an interval from the tree.
 
const Node * overlap_search (const Key &query) const
 Find any interval that overlaps with query (CLRS algorithm).
 
template<class Op >
void all_overlaps (const Key &query, Op &&op) const
 Apply op to every interval overlapping query.
 
DynList< Key > find_all_overlaps (const Key &query) const
 Find all intervals overlapping query.
 
template<class Op >
void stab (const T &p, Op &&op) const
 Apply op to every interval containing point p.
 
DynList< Key > find_stab (const T &p) const
 Find all intervals containing point p.
 
bool verify () const
 Verify BST, heap, and max_endpoint invariants.
 

Detailed Description

template<typename T, class Compare = Aleph::less<T>>
requires StrictWeakOrder<Compare, T>
struct Aleph::Interval_Tree< T, Compare >

Interval tree using nodes without virtual destructor.

Template Parameters
TEndpoint type.
CompareComparison functor for endpoints.

Definition at line 1279 of file tpl_interval_tree.H.

Member Typedef Documentation

◆ Base

template<typename T , class Compare = Aleph::less<T>>
using Aleph::Interval_Tree< T, Compare >::Base = Gen_Interval_Tree<Interval_Tree_Node, T, Compare>

Definition at line 1282 of file tpl_interval_tree.H.


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