|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
High-level interval tree with automatic memory management. More...
#include <tpl_interval_tree.H>
Classes | |
| class | Iterator |
| Inorder iterator yielding Interval<T> keys. More... | |
Public Types | |
| using | Key = Interval< T > |
| using | Item_Type = Key |
| using | Key_Type = Key |
| using | Node = typename Interval_Tree< T, Compare >::Node |
| using | Tree = Interval_Tree< T, Compare > |
Public Types inherited from StlAlephIterator< SetName > | |
| using | iterator = StlIterator< SetName > |
| using | const_iterator = StlConstIterator< SetName > |
Public Member Functions | |
| DynIntervalTree (const Compare &cmp=Compare()) | |
| Default constructor. | |
| DynIntervalTree (const unsigned long seed, const Compare &cmp=Compare()) | |
| Construct with explicit seed for the internal RNG. | |
| DynIntervalTree (const DynIntervalTree &src) | |
| Copy constructor. | |
| DynIntervalTree (DynIntervalTree &&src) | |
| Move constructor. | |
| DynIntervalTree & | operator= (const DynIntervalTree &src) |
| Copy assignment. | |
| DynIntervalTree & | operator= (DynIntervalTree &&src) noexcept(noexcept(std::declval< Tree & >().swap(std::declval< Tree & >()))) |
| Move assignment. | |
| ~DynIntervalTree () | |
| Destructor. | |
| void | swap (DynIntervalTree &other) noexcept(noexcept(std::declval< Tree & >().swap(std::declval< Tree & >()))) |
| Swap state with another tree in O(1). | |
| template<template< typename > class List> | |
| DynIntervalTree (const List< Key > &l) | |
| template<class It > requires (not std::is_arithmetic_v<It> and requires (It it) { *it; ++it; it != it; }) | |
| DynIntervalTree (It b, It e) | |
| DynIntervalTree (std::initializer_list< Key > l) | |
| Key & | insert (const Key &iv) |
| Insert an interval (unique). | |
| Key & | insert (Key &&iv) |
| Insert an interval (move version, unique). | |
| Key & | insert (const T &lo, const T &hi) |
| Insert an interval given endpoints (unique). | |
| Key & | insert_dup (const Key &iv) |
| Insert interval, allowing duplicates. | |
| Key & | append (const Key &iv) |
| Append an interval (alias for insert_dup). | |
| bool | remove (const Key &iv) |
| Remove an interval from the tree. | |
| bool | remove (const T &lo, const T &hi) |
| Remove an interval given endpoints. | |
| const Key * | search (const Key &iv) const noexcept(noexcept(std::declval< const Tree & >().search(iv))) |
| Search for an exact interval. | |
| const Key * | overlap_search (const Key &query) const |
Find any interval overlapping query. | |
| const Key * | overlap_search (const T &lo, const T &hi) const |
| Overload of overlap_search() using endpoints. | |
| template<class Op > | |
| void | all_overlaps (const Key &query, Op &&op) const |
| Apply op to every overlapping interval. | |
| DynList< Key > | find_all_overlaps (const Key &query) const |
| Find all overlapping intervals. | |
| DynList< Key > | find_all_overlaps (const T &lo, const T &hi) const |
| Overload of find_all_overlaps() using endpoints. | |
| 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. | |
| size_t | size () const noexcept |
| Return the number of intervals in the tree. | |
| auto | key_comp () const noexcept(std::is_nothrow_copy_constructible_v< Compare >) |
| Return the comparator that orders the intervals: by low endpoint, then by high endpoint. | |
| bool | is_empty () const noexcept |
| Return true if the tree contains no intervals. | |
| bool | empty () const noexcept |
| Return true if the tree contains no intervals (STL compatible). | |
| bool | verify () const |
| Verify all tree invariants (BST, Treap, MaxEndpoint). | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, const Key &> | |
| bool | traverse (Operation &op) |
| Traverse all intervals in inorder (sorted by low endpoint). | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, const Key &> | |
| bool | traverse (Operation &&op=Operation()) |
| Overload of traverse() for rvalue callbacks. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, const Key &> | |
| bool | traverse (Operation &op) const |
| Const overload of traverse(). | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, const Key &> | |
| bool | traverse (Operation &&op=Operation()) const |
| Const rvalue overload of traverse(). | |
Public Member Functions inherited from EqualSortedMethod< Container > | |
| bool | equal_to (const Container &r) const |
Equality test between this and r. | |
Public Member Functions inherited from FunctionalMethods< Container, T > | |
| void | emplace (Args &&... args) |
| Appends a new element into the container by constructing it from the given args. | |
| void | emplace_end (Args &&... args) |
See emplace(Args && ... args). | |
| void | emplace_ins (Args &&... args) |
| template<typename... Args> requires ((std::convertible_to<Args &&, T> and ...) and (Aleph::InsertableWith<typename Aleph::concepts_detail::defer<Container, std::tuple<Args...>>::type, Item_Arg<Args>> and ...)) | |
| size_t | ninsert (Args &&... args) |
| Insert n variadic items. | |
| template<typename... Args> requires ((std::convertible_to<Args &&, T> and ...) and (Aleph::AppendableWith<typename Aleph::concepts_detail::defer<Container, std::tuple<Args...>>::type, Item_Arg<Args>> and ...)) | |
| size_t | nappend (Args &&... args) |
| Append n variadic items. | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, const T &> | |
| void | for_each (Operation &operation) const |
| Traverse all the container and performs an operation on each element. | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, const T &> | |
| void | for_each (Operation &&operation) const |
| Overload of for_each() that accepts rvalues. | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, const T &> | |
| void | each (Operation &operation) const |
| Alias of for_each(). | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, const T &> | |
| void | each (Operation &&operation) const |
| Alias of for_each() that accepts rvalues. | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, const T &> | |
| void | each (const size_t pos, const size_t slice, Operation &operation) const |
Traverse the container starting at pos taking one item every slice, performing an operation on each visited element. | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, const T &> | |
| void | each (const size_t pos, const size_t slice, Operation &&operation) const |
See each(size_t pos, size_t slice, Operation & operation) const. | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, T &> | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< Container, Operation >::type, T > void | each (const size_t pos, const size_t slice, Operation &operation) |
Traverse the container starting at pos taking one item every slice, performing an operation that may modify each visited item. | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, T &> | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< Container, Operation >::type, T > void | each (const size_t pos, const size_t slice, Operation &&operation) |
See each(size_t pos, size_t slice, Operation & operation). | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, T &> | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< Container, Operation >::type, T > void | mutable_for_each (Operation &operation) |
| Apply a mutable operation to each element of the container. | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, T &> | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< Container, Operation >::type, T > void | mutable_for_each (Operation &&operation) |
See mutable_for_each(Operation & operation). | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| bool | all (Operation &operation) const |
| Check if all the elements of the container satisfy a condition. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| bool | all (Operation &&operation) const |
| Overload of all() that accepts rvalues. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| bool | exists (Operation &op) const |
| Test for existence in the container of an element satisfying a criterion. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| bool | exists (Operation &&op) const |
| Overload of exists() that accepts rvalues. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| bool | none (Operation &op) const |
| Test that no element satisfies a criterion. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| bool | none (Operation &&op) const |
| Overload of none() that accepts rvalues. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| size_t | count_if (Operation &op) const |
| Count the elements that satisfy a criterion. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| size_t | count_if (Operation &&op) const |
| Overload of count_if() that accepts rvalues. | |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | maps (Operation &op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | maps (Operation &&op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | maps_if (Prop prop, Operation &op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | maps_if (Prop prop, Operation &&op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | map (Operation &op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | map (Operation &&op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | map_if (Prop prop, Operation &op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | map_if (Prop prop, Operation &&op) const |
| template<class Operation > requires Aleph::InvocableWith<Operation &, const T &> | |
| auto | flat_map (Operation &op) const |
| Map each element to a container and concatenate the results. | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, const T &> | |
| auto | flat_map (Operation &&op) const |
| Overload of flat_map() that accepts rvalues. | |
| Aleph::DynList< T > | to_dynlist () const |
| Convert container to DynList. | |
| std::vector< T > | to_vector () const |
| Convert container to std::vector. | |
| template<typename Acc = T, class Op > requires Aleph::dry_detail::FoldOperation<Op, Acc, T> | |
| Acc | foldl (const Acc &init, Op &op) const |
| Fold the elements of the container to a specific result. | |
| template<typename Acc = T, class Op > requires Aleph::dry_detail::FoldOperation<Op, Acc, T> | |
| Acc | foldl (const Acc &init, Op &&op) const |
| Overload of foldl() that accepts rvalues. | |
| template<typename Acc = T, class Op > requires Aleph::dry_detail::FoldOperation<Op, Acc, T> | |
| Acc | fold_left (const Acc &init, Op &op) const |
| Alias for foldl(). | |
| template<typename Acc = T, class Op > requires Aleph::dry_detail::FoldOperation<Op, Acc, T> | |
| Acc | fold_left (const Acc &init, Op &&op) const |
| Overload of fold_left() that accepts rvalues. | |
| template<class Operation > requires Aleph::dry_detail::FoldOperation<Operation, T, T> | |
| T | fold (const T &init, Operation &operation) const |
| Simplified version of foldl() where the folded type is the same type of elements stored in the container. | |
| template<class Operation > requires Aleph::dry_detail::FoldOperation<Operation, T, T> | |
| T | fold (const T &init, Operation &&operation) const |
| Overload of fold() that accepts rvalues. | |
| template<typename Acc = T, class Op > requires Aleph::dry_detail::FoldRightOperation<Op, Acc, T> | |
| Acc | foldr (const Acc &init, Op &op) const |
| Fold the elements from the last to the first. | |
| template<typename Acc = T, class Op > requires Aleph::dry_detail::FoldRightOperation<Op, Acc, T> | |
| Acc | foldr (const Acc &init, Op &&op) const |
| Overload of foldr() that accepts rvalues. | |
| template<class Op , class U = T> requires Aleph::dry_detail::FoldOperation<Op, T, T> | |
| and std::copy_constructible< U > std::optional< T > | reduce (Op &op) const |
| Fold the elements with no initial value. | |
| template<class Op , class U = T> requires Aleph::dry_detail::FoldOperation<Op, T, T> | |
| and std::copy_constructible< U > std::optional< T > | reduce (Op &&op) const |
| Overload of reduce() that accepts rvalues. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| Aleph::DynList< T > | filter (Operation &operation) const |
| Filter the elements of a container according to a matching criterion. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| Aleph::DynList< T > | filter (Operation &&operation) const |
| Overload of filter() that accepts rvalues. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| Aleph::DynList< const T * > | ptr_filter (Operation &operation) const |
| Filter the elements of a container according to a matching criterion and return a pointer to the matched items in the container. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| Aleph::DynList< const T * > | ptr_filter (Operation &&operation) const |
| Overload of ptr_filter() that accepts rvalues. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| Aleph::DynList< std::tuple< T, size_t > > | pfilter (Operation &operation) const |
| Filter the elements of a container according to a matching criterion and determine its positions respect to the traversal of container. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| Aleph::DynList< std::tuple< T, size_t > > | pfilter (Operation &&operation) const |
| Overload of pfilter() that accepts rvalues. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| std::pair< Aleph::DynList< T >, Aleph::DynList< T > > | partition (Operation &op) const |
| Exclusive partition of container according to a filter criterion. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| std::pair< Aleph::DynList< T >, Aleph::DynList< T > > | partition (Operation &&op) const |
| Overload of partition() that accepts rvalues. | |
| std::pair< Aleph::DynList< T >, Aleph::DynList< T > > | partition (size_t n) const |
| Exclusive partition of container in the nth item. | |
| std::pair< Aleph::DynList< T >, Aleph::DynList< T > > | split_half () const |
| Split the container into two halves by alternating elements. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > | tpartition (Operation &op) const |
| Exclusive partition of container according to a filter criterion. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > | tpartition (Operation &&op) const |
| Overload of tpartition() that accepts rvalues. | |
| size_t | length () const noexcept(Aleph::dry_detail::const_traversal_is_noexcept< Container, T >) |
| Count the number of elements of a container. | |
| Aleph::DynList< T > | rev () const |
| Return a list with the elements of container in reverse order respect to its traversal order. | |
| Aleph::DynList< T > | take (const size_t n) const |
| Return a list with the first n elements seen in the container during its traversal. | |
| Aleph::DynList< T > | take (size_t i, const size_t j, const size_t step=1) const |
Return a list with the elements at positions i, i + step, i + 2 step, ... that are not greater than j, respect to the traversal order. | |
| Aleph::DynList< T > | drop (const size_t n) const |
| Drop the first n elements seen in the container during its traversal. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| Aleph::DynList< T > | take_while (Operation &op) const |
| The longest prefix of elements that satisfy a criterion. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| Aleph::DynList< T > | take_while (Operation &&op) const |
| Overload of take_while() that accepts rvalues. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| Aleph::DynList< T > | drop_while (Operation &op) const |
| The elements after the longest prefix that satisfies a criterion. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| Aleph::DynList< T > | drop_while (Operation &&op) const |
| Overload of drop_while() that accepts rvalues. | |
| template<class C = Container> requires requires (C & c) { c.remove(); } | |
| void | mutable_drop (const size_t n) |
| Drop the first n elements seen from container. | |
Public Member Functions inherited from GenericItems< Container, T > | |
| Aleph::DynList< T > | items () const |
| Return a list of all the elements of a container sorted by traversal order. | |
| Aleph::DynList< T > | keys () const |
See items(). | |
Public Member Functions inherited from StlAlephIterator< SetName > | |
| iterator | begin () noexcept |
| Return an STL-compatible iterator to the first element. | |
| iterator | end () noexcept |
| Return an STL-compatible end iterator. | |
| const_iterator | begin () const noexcept |
| Return a const iterator to the first element. | |
| const_iterator | end () const noexcept |
| Return a const end iterator. | |
| const_iterator | cbegin () const noexcept |
| Return a const iterator to the first element. | |
| const_iterator | cend () const noexcept |
| Return a const end iterator. | |
Private Member Functions | |
| void | copy_from (const DynIntervalTree &src) |
| void | destroy_tree () |
Private Attributes | |
| Tree | tree |
Additional Inherited Members | |
Static Public Member Functions inherited from FunctionalMethods< Container, T > | |
| template<typename... Items> requires ((std::convertible_to<Items &&, T> and ...) and (Aleph::AppendableWith<typename Aleph::concepts_detail::defer<Container, std::tuple<Items...>>::type, Item_Arg<Items>> and ...)) | |
| static Container | build (Items &&... items) |
| Build a container that holds the given items. | |
| template<class D , typename... Items> requires (std::derived_from<D, typename Aleph::concepts_detail::defer<Container, D>::type> and std::default_initializable<D> and (std::convertible_to<Items &&, T> and ...) and (Aleph::AppendableWith<typename Aleph::concepts_detail::defer<Container, std::tuple<D, Items...>>::type, Item_Arg<Items>> and ...)) | |
| static D | build_as (Items &&... items) |
Build a D, a class derived from the container, holding the given items. | |
Public Attributes inherited from FunctionalMethods< Container, T > | |
| template<typename... Args> requires (typename Aleph::concepts_detail::defer<Container, std::tuple<Args...>>::type & c, T && x) | |
| and { c.append(std::move(x)) | |
| Insert a new element into the container by constructing it from the given args. | |
| template<typename R = void, class Prop , class Operation > requires (Aleph::DynList<Aleph::dry_detail::map_result_t<R, Operation &, T>> & l, Operation & op, const T & item) | |
| and Aleph::InvocableWith< Operation &, const T & > | and { l.append(std::invoke(op, item)) |
| Conditional mapping of the elements of the container. | |
High-level interval tree with automatic memory management.
DynIntervalTree<T> wraps Interval_Tree<T> and provides:
| T | Endpoint type. |
| Compare | Comparison functor for endpoints. |
Definition at line 1329 of file tpl_interval_tree.H.
| using Aleph::DynIntervalTree< T, Compare >::Item_Type = Key |
Definition at line 1337 of file tpl_interval_tree.H.
| using Aleph::DynIntervalTree< T, Compare >::Key = Interval<T> |
Definition at line 1336 of file tpl_interval_tree.H.
| using Aleph::DynIntervalTree< T, Compare >::Key_Type = Key |
Definition at line 1338 of file tpl_interval_tree.H.
| using Aleph::DynIntervalTree< T, Compare >::Node = typename Interval_Tree<T, Compare>::Node |
Definition at line 1339 of file tpl_interval_tree.H.
| using Aleph::DynIntervalTree< T, Compare >::Tree = Interval_Tree<T, Compare> |
Definition at line 1340 of file tpl_interval_tree.H.
|
inline |
Default constructor.
| [in] | cmp | Comparison functor for endpoints. |
Definition at line 1360 of file tpl_interval_tree.H.
|
inline |
Construct with explicit seed for the internal RNG.
| [in] | seed | Random seed. |
| [in] | cmp | Comparison functor for endpoints. |
Definition at line 1366 of file tpl_interval_tree.H.
|
inline |
Copy constructor.
| [in] | src | Source tree to copy from. |
Definition at line 1373 of file tpl_interval_tree.H.
References Aleph::DynIntervalTree< T, Compare >::copy_from(), Aleph::Gen_Interval_Tree< NodeType, T, Compare >::endpoint_comp(), Aleph::DynIntervalTree< T, Compare >::swap(), and Aleph::DynIntervalTree< T, Compare >::tree.
|
inline |
Move constructor.
Not declared noexcept because the initializer tree(src.tree.endpoint_comp()) constructs a new Tree, which builds the key of its header node and copies the comparator — both can throw.
| [in,out] | src | Source tree to move from. |
Definition at line 1390 of file tpl_interval_tree.H.
References Aleph::Gen_Interval_Tree< NodeType, T, Compare >::swap(), and Aleph::DynIntervalTree< T, Compare >::tree.
|
inline |
Destructor.
Definition at line 1424 of file tpl_interval_tree.H.
References Aleph::DynIntervalTree< T, Compare >::destroy_tree().
|
inline |
Definition at line 1435 of file tpl_interval_tree.H.
|
inline |
Definition at line 1435 of file tpl_interval_tree.H.
|
inline |
Definition at line 1435 of file tpl_interval_tree.H.
|
inline |
Apply op to every overlapping interval.
| Op | Callable with signature void(const Key&). |
| [in] | query | the query interval. |
| [in] | op | callable to invoke for each overlap. |
| Any | exception thrown by op. |
Definition at line 1622 of file tpl_interval_tree.H.
References Aleph::Gen_Interval_Tree< NodeType, T, Compare >::all_overlaps(), and Aleph::DynIntervalTree< T, Compare >::tree.
|
inline |
Append an interval (alias for insert_dup).
| [in] | iv | the interval to append. |
| std::domain_error | if iv.low > iv.high. |
Definition at line 1544 of file tpl_interval_tree.H.
References Aleph::DynIntervalTree< T, Compare >::insert_dup().
Referenced by Aleph::DynIntervalTree< T, Compare >::copy_from(), and TEST().
|
inlineprivate |
Definition at line 1345 of file tpl_interval_tree.H.
References Aleph::DynIntervalTree< T, Compare >::append(), and FunctionalMethods< Container, T >::for_each().
Referenced by Aleph::DynIntervalTree< T, Compare >::DynIntervalTree().
|
inlineprivate |
Definition at line 1350 of file tpl_interval_tree.H.
References Aleph::destroyRec(), Aleph::Gen_Interval_Tree< NodeType, T, Compare >::getRoot(), Aleph::Gen_Interval_Tree< NodeType, T, Compare >::reset_num_nodes(), and Aleph::DynIntervalTree< T, Compare >::tree.
Referenced by Aleph::DynIntervalTree< T, Compare >::~DynIntervalTree(), and Aleph::DynIntervalTree< T, Compare >::operator=().
|
inlinenoexcept |
Return true if the tree contains no intervals (STL compatible).
| none |
Definition at line 1696 of file tpl_interval_tree.H.
References Aleph::DynIntervalTree< T, Compare >::is_empty().
|
inline |
Find all overlapping intervals.
| [in] | query | the query interval. |
Definition at line 1632 of file tpl_interval_tree.H.
References Aleph::Gen_Interval_Tree< NodeType, T, Compare >::find_all_overlaps(), and Aleph::DynIntervalTree< T, Compare >::tree.
Referenced by Aleph::DynIntervalTree< T, Compare >::find_all_overlaps(), meeting_scheduler(), segment_intersection(), and TEST().
|
inline |
Overload of find_all_overlaps() using endpoints.
| [in] | lo | lower endpoint. |
| [in] | hi | upper endpoint. |
Definition at line 1642 of file tpl_interval_tree.H.
References Aleph::DynIntervalTree< T, Compare >::find_all_overlaps().
|
inline |
Find all intervals containing point p.
| [in] | p | query point. |
Definition at line 1664 of file tpl_interval_tree.H.
References Aleph::Gen_Interval_Tree< NodeType, T, Compare >::find_stab(), and Aleph::DynIntervalTree< T, Compare >::tree.
Referenced by meeting_scheduler().
|
inline |
Insert an interval (unique).
| [in] | iv | the interval to insert. |
| std::domain_error | if iv.low > iv.high (invalid interval) or if the interval already exists in the tree. |
| what | the comparison or the copy of an endpoint throw, and std::bad_alloc, with the tree as it was. |
Definition at line 1451 of file tpl_interval_tree.H.
References ah_domain_error, ah_domain_error_if, Aleph::Gen_Interval_Tree< NodeType, T, Compare >::endpoint_comp(), Aleph::Gen_Interval_Tree< NodeType, T, Compare >::insert(), Aleph::Interval< T >::is_valid(), KEY, and Aleph::DynIntervalTree< T, Compare >::tree.
Referenced by Aleph::DynIntervalTree< T, Compare >::insert(), meeting_scheduler(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST_F().
|
inline |
Insert an interval given endpoints (unique).
| [in] | lo | lower endpoint. |
| [in] | hi | upper endpoint. |
| std::domain_error | if lo > hi or if the interval already exists. |
Definition at line 1506 of file tpl_interval_tree.H.
References Aleph::DynIntervalTree< T, Compare >::insert().
|
inline |
Insert an interval (move version, unique).
| [in,out] | iv | the interval to insert. |
| std::domain_error | if iv.low > iv.high (invalid interval) or if the interval already exists in the tree. |
| what | the comparison or the copy of an endpoint throw, and std::bad_alloc, with the tree as it was. |
Definition at line 1478 of file tpl_interval_tree.H.
References ah_domain_error, ah_domain_error_if, Aleph::Gen_Interval_Tree< NodeType, T, Compare >::endpoint_comp(), Aleph::Gen_Interval_Tree< NodeType, T, Compare >::insert(), KEY, and Aleph::DynIntervalTree< T, Compare >::tree.
|
inline |
Insert interval, allowing duplicates.
| [in] | iv | the interval to insert. |
| std::domain_error | if iv.low > iv.high. |
| what | the comparison or the copy of an endpoint throw, and std::bad_alloc, with the tree as it was. |
Definition at line 1524 of file tpl_interval_tree.H.
References ah_domain_error_if, Aleph::Gen_Interval_Tree< NodeType, T, Compare >::endpoint_comp(), Aleph::Gen_Interval_Tree< NodeType, T, Compare >::insert_dup(), Aleph::Interval< T >::is_valid(), KEY, and Aleph::DynIntervalTree< T, Compare >::tree.
Referenced by Aleph::DynIntervalTree< T, Compare >::append(), segment_intersection(), TEST(), and TEST().
|
inlinenoexcept |
Return true if the tree contains no intervals.
| none |
Definition at line 1690 of file tpl_interval_tree.H.
References Aleph::Gen_Interval_Tree< NodeType, T, Compare >::is_empty(), and Aleph::DynIntervalTree< T, Compare >::tree.
Referenced by Aleph::DynIntervalTree< T, Compare >::empty().
|
inlinenoexcept |
Return the comparator that orders the intervals: by low endpoint, then by high endpoint.
| what | copying the endpoint comparator throws. |
Definition at line 1681 of file tpl_interval_tree.H.
References Aleph::Gen_Interval_Tree< NodeType, T, Compare >::key_comp(), and Aleph::DynIntervalTree< T, Compare >::tree.
|
inline |
Copy assignment.
| [in] | src | Source tree to copy from. |
Definition at line 1400 of file tpl_interval_tree.H.
References Aleph::DynIntervalTree< T, Compare >::swap().
|
inlinenoexcept |
Move assignment.
| [in,out] | src | Source tree to move from. |
Definition at line 1413 of file tpl_interval_tree.H.
References Aleph::DynIntervalTree< T, Compare >::destroy_tree(), Aleph::Gen_Interval_Tree< NodeType, T, Compare >::swap(), and Aleph::DynIntervalTree< T, Compare >::tree.
|
inline |
Find any interval overlapping query.
| [in] | query | the query interval. |
Definition at line 1598 of file tpl_interval_tree.H.
References KEY, Aleph::Gen_Interval_Tree< NodeType, T, Compare >::overlap_search(), and Aleph::DynIntervalTree< T, Compare >::tree.
Referenced by Aleph::DynIntervalTree< T, Compare >::overlap_search(), TEST(), TEST(), and TEST().
|
inline |
Overload of overlap_search() using endpoints.
| [in] | lo | lower endpoint. |
| [in] | hi | upper endpoint. |
Definition at line 1609 of file tpl_interval_tree.H.
References Aleph::DynIntervalTree< T, Compare >::overlap_search().
|
inline |
Remove an interval from the tree.
| [in] | iv | the interval to remove. |
| what | the comparison or the copy of an endpoint throw, with the tree as it was. |
Definition at line 1558 of file tpl_interval_tree.H.
References Aleph::Gen_Interval_Tree< NodeType, T, Compare >::remove(), and Aleph::DynIntervalTree< T, Compare >::tree.
Referenced by Aleph::DynIntervalTree< T, Compare >::remove(), and TEST().
|
inline |
Remove an interval given endpoints.
| [in] | lo | lower endpoint. |
| [in] | hi | upper endpoint. |
Definition at line 1573 of file tpl_interval_tree.H.
References Aleph::DynIntervalTree< T, Compare >::remove().
|
inlinenoexcept |
Search for an exact interval.
| [in] | iv | interval to search. |
| what | the comparison or its copy throw; nothing when neither does. |
Definition at line 1585 of file tpl_interval_tree.H.
References KEY, Aleph::Gen_Interval_Tree< NodeType, T, Compare >::search(), and Aleph::DynIntervalTree< T, Compare >::tree.
|
inlinenoexcept |
Return the number of intervals in the tree.
| none |
Definition at line 1673 of file tpl_interval_tree.H.
References Aleph::Gen_Interval_Tree< NodeType, T, Compare >::size(), and Aleph::DynIntervalTree< T, Compare >::tree.
Referenced by TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
|
inline |
Apply op to every interval containing point p.
| Op | Callable with signature void(const Key&). |
| [in] | p | query point. |
| [in] | op | callable to invoke for each containing interval. |
| May | throw if the provided callback throws. |
Definition at line 1655 of file tpl_interval_tree.H.
References Aleph::Gen_Interval_Tree< NodeType, T, Compare >::stab(), and Aleph::DynIntervalTree< T, Compare >::tree.
|
inlinenoexcept |
Swap state with another tree in O(1).
| [in,out] | other | The other tree. |
Definition at line 1429 of file tpl_interval_tree.H.
References Aleph::Gen_Interval_Tree< NodeType, T, Compare >::swap(), and Aleph::DynIntervalTree< T, Compare >::tree.
Referenced by Aleph::DynIntervalTree< T, Compare >::DynIntervalTree(), and Aleph::DynIntervalTree< T, Compare >::operator=().
|
inline |
Overload of traverse() for rvalue callbacks.
| Operation | callable with signature bool(const Key&). |
| [in] | op | callable to perform on each interval. |
| anything | that op throws. |
Definition at line 1730 of file tpl_interval_tree.H.
|
inline |
Const rvalue overload of traverse().
| Operation | callable with signature bool(const Key&). |
| [in] | op | callable to perform on each interval. |
| anything | that op throws. |
Definition at line 1759 of file tpl_interval_tree.H.
|
inline |
Traverse all intervals in inorder (sorted by low endpoint).
If op returns false, traversal stops early.
| Operation | callable with signature bool(const Key&). |
| [in] | op | callable to perform on each interval. |
| anything | that op throws. |
Definition at line 1714 of file tpl_interval_tree.H.
References Aleph::Gen_Interval_Tree< NodeType, T, Compare >::getRoot(), Aleph::traverse(), and Aleph::DynIntervalTree< T, Compare >::tree.
|
inline |
Const overload of traverse().
| Operation | callable with signature bool(const Key&). |
| [in] | op | callable to perform on each interval. |
| anything | that op throws. |
Definition at line 1743 of file tpl_interval_tree.H.
References Aleph::Gen_Interval_Tree< NodeType, T, Compare >::getRoot(), Aleph::traverse(), and Aleph::DynIntervalTree< T, Compare >::tree.
|
inline |
Verify all tree invariants (BST, Treap, MaxEndpoint).
Definition at line 1701 of file tpl_interval_tree.H.
References Aleph::DynIntervalTree< T, Compare >::tree, and Aleph::Gen_Interval_Tree< NodeType, T, Compare >::verify().
Referenced by segment_intersection(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
|
private |
Definition at line 1343 of file tpl_interval_tree.H.
Referenced by Aleph::DynIntervalTree< T, Compare >::DynIntervalTree(), Aleph::DynIntervalTree< T, Compare >::DynIntervalTree(), Aleph::DynIntervalTree< T, Compare >::all_overlaps(), Aleph::DynIntervalTree< T, Compare >::destroy_tree(), Aleph::DynIntervalTree< T, Compare >::find_all_overlaps(), Aleph::DynIntervalTree< T, Compare >::find_stab(), Aleph::DynIntervalTree< T, Compare >::insert(), Aleph::DynIntervalTree< T, Compare >::insert(), Aleph::DynIntervalTree< T, Compare >::insert_dup(), Aleph::DynIntervalTree< T, Compare >::is_empty(), Aleph::DynIntervalTree< T, Compare >::key_comp(), Aleph::DynIntervalTree< T, Compare >::operator=(), Aleph::DynIntervalTree< T, Compare >::overlap_search(), Aleph::DynIntervalTree< T, Compare >::remove(), Aleph::DynIntervalTree< T, Compare >::search(), Aleph::DynIntervalTree< T, Compare >::size(), Aleph::DynIntervalTree< T, Compare >::stab(), Aleph::DynIntervalTree< T, Compare >::swap(), Aleph::DynIntervalTree< T, Compare >::traverse(), Aleph::DynIntervalTree< T, Compare >::traverse(), and Aleph::DynIntervalTree< T, Compare >::verify().