Space-efficient geometric algorithms and data structures

By Ilya Katz and Hervé Brönnimann    

inplaceds::my_tree_heap< _Key, _Compare, _Compare_PQ, _Alloc > Class Template Reference

#include <stl_set.h>


Detailed Description

template<class _Key, class _Compare, class _Compare_PQ, class _Alloc>
class inplaceds::my_tree_heap< _Key, _Compare, _Compare_PQ, _Alloc >

A standard container made up of unique keys, which can be retrieved in logarithmic time.

Parameters:
Key Type of key objects.
Compare Comparison function object type for priority queue, defaults to less<Key>.
Compare_PQ Comparison function object type for binary search tree, defaults to less<Key>.
Alloc Allocator type, defaults to allocator<Key>.
my_tree_heap supports iterators. Keep these two things in mind if using iterators:

Definition at line 111 of file stl_set.h.

Constructors

 my_tree_heap ()
 Default constructor creates no elements.
 my_tree_heap (const _Compare &__comp, const _Compare_PQ &__comp_pq, const allocator_type &__a=allocator_type())
 Default constructor creates no elements.
template<class _InputIterator>
 my_tree_heap (_InputIterator __first, _InputIterator __last)
 Builds a my_tree_heap from a range.
template<class _InputIterator>
 my_tree_heap (_InputIterator __first, _InputIterator __last, const _Compare &__comp, const allocator_type &__a=allocator_type())
 Builds a my_tree_heap from a range.
 my_tree_heap (const my_tree_heap< _Key, _Compare, _Compare_PQ, _Alloc > &__x)
 my_tree_heap copy constructor.

Public Types

Public typedefs
typedef _Key key_type
typedef _Key value_type
typedef _Compare key_compare
typedef _Compare_PQ key_compare_pq
Iterator-related typedefs
typedef _Alloc::pointer pointer
typedef _Alloc::const_pointer const_pointer
typedef _Alloc::reference reference
typedef _Alloc::const_reference const_reference
typedef _Rep_type::iterator iterator
typedef _Rep_type::const_iterator const_iterator
typedef _Rep_type::const_reverse_iterator reverse_iterator
typedef _Rep_type::const_reverse_iterator const_reverse_iterator
typedef _Rep_type::size_type size_type
typedef _Rep_type::difference_type difference_type
typedef _Rep_type::allocator_type allocator_type

Public Member Functions

void adjust_PQ (iterator it)
 If a node's priority was chnaged, the PQ needs to be adjusted.
tree_heap functions
void print ()
 Prints pre-order traversal of PQ and BST.
void segment_right_event (iterator it)
 Performs right-end point operations on a line segment.
template<class point_type>
void segment_intersection_event (iterator it, point_type point, iterator intersecting)
 Performs intersection event operations on a line segment.
template<class line_type>
iterator insert (const line_type &x)
 Insert a new element in to the priority queue. BST is not affected.
void insert_BST (iterator it)
 BST is updated to include the node that already exists in PQ.
void pop ()
 Removes an element that is located at the top of the queue from the queue and from BST.
iterator top () const
 Returns pointer to the top of the priority queue.
iterator successor (iterator x)
 Returns iterator to the next element after x in in-order traversal of the BST.
iterator predecessor (iterator x)
 Returns iterator to the previous element after x in in-order traversal of the BST.
void swap_lines (iterator a, iterator b)
 Swaps two line segments in the BST.
Generic functions
key_compare key_comp () const
 Returns the comparison object with which the my_tree_heap BST was constructed.
key_compare_pq key_comp_pq () const
 Returns the comparison object with which the my_tree_heap PQ was constructed.
allocator_type get_allocator () const
 Returns the allocator object with which the my_tree_heap was constructed.
const_iterator begin () const
 Returns a read/write iterator that points to the first element in the my_tree_heap. Iteration is done in ascending order according to the keys.
iterator begin ()
const_iterator end () const
 Returns a read/write iterator that points one past the last element in the my_tree_heap. Iteration is done in ascending order according to the keys.
iterator end ()
const_reverse_iterator rbegin () const
 Returns a read/write reverse iterator that points to the last element in the my_tree_heap. Iteration is done in descending order according to the keys.
const_reverse_iterator rend () const
 Returns a read-only (constant) reverse iterator that points to the last pair in the map. Iteration is done in descending order according to the keys.
bool empty () const
 Returns true if the my_tree_heap is empty.
size_type size () const
 Returns the size of the my_tree_heap.
void clear ()
 Erases all elements in a my_tree_heap.

Private Types

typedef inplaceds::_Rb_tree<
key_type, value_type, std::_Identity<
value_type >, key_compare,
key_compare_pq, _Alloc > 
_Rep_type

Private Member Functions

void erase (iterator __position)
 Erases an element from a tree_heap (both from PQ and BST).

Private Attributes

_Rep_type _M_t


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

Code Documentation generated Using Doxygen

Copyright © Ilya Katz and Hervé Brönnimann, 2005, 2006.