cgv
Loading...
Searching...
No Matches
cgv::data::interval_map< Key, T > Class Template Reference

Extension of a standard map container that allows easy retreival of lower and upper bounds given a key. More...

#include <interval_map.h>

Public Types

using base_type = std::map< Key, T >
 
using key_type = Key
 
using mapped_type = T
 
using value_type = typename base_type::value_type
 
using size_type = typename base_type::size_type
 
using iterator = typename base_type::iterator
 
using const_iterator = typename base_type::const_iterator
 
using reverse_iterator = typename base_type::reverse_iterator
 
using const_reverse_iterator = typename base_type::const_reverse_iterator
 

Public Member Functions

void clear ()
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
const_reverse_iterator crbegin () const
 
const_reverse_iterator crend () const
 
size_type size () const
 
bool empty () const
 
std::pair< iterator, bool > insert (key_type key, const mapped_type &value)
 
size_type erase (key_type frame)
 
iterator erase (iterator it)
 
iterator find (key_type key)
 
iterator lower_bound (key_type key)
 Returns an iterator pointing to the first element in the container whose key is equivalent or smaller than the given key. If no such element exists, returns end().
 
const_iterator lower_bound (key_type key) const
 Returns a const iterator pointing to the first element in the container whose key is equivalent or smaller than the given key. If no such element exists, returns end().
 
iterator upper_bound (key_type key)
 Returns an iterator pointing to the first element in the container whose key is greater than the given key. If no such element exists, returns end().
 
const_iterator upper_bound (key_type key) const
 Returns a const iterator pointing to the first element in the container whose key is greater than the given key. If no such element exists, returns end().
 
std::pair< iterator, iterator > bounds (key_type key)
 Returns a pair of iterators pointing to the lower and upper bounds of the given key.
 
std::pair< const_iterator, const_iterator > bounds (key_type key) const
 Returns a pair of const iterators pointing to the lower and upper bounds of the given key.
 

Detailed Description

template<class Key, class T>
class cgv::data::interval_map< Key, T >

Extension of a standard map container that allows easy retreival of lower and upper bounds given a key.

Template Parameters
Keythe key type
Tthe value type

Definition at line 12 of file interval_map.h.

Member Typedef Documentation

◆ base_type

template<class Key , class T >
using cgv::data::interval_map< Key, T >::base_type = std::map<Key, T>

Definition at line 14 of file interval_map.h.

◆ const_iterator

template<class Key , class T >
using cgv::data::interval_map< Key, T >::const_iterator = typename base_type::const_iterator

Definition at line 20 of file interval_map.h.

◆ const_reverse_iterator

template<class Key , class T >
using cgv::data::interval_map< Key, T >::const_reverse_iterator = typename base_type::const_reverse_iterator

Definition at line 22 of file interval_map.h.

◆ iterator

template<class Key , class T >
using cgv::data::interval_map< Key, T >::iterator = typename base_type::iterator

Definition at line 19 of file interval_map.h.

◆ key_type

template<class Key , class T >
using cgv::data::interval_map< Key, T >::key_type = Key

Definition at line 15 of file interval_map.h.

◆ mapped_type

template<class Key , class T >
using cgv::data::interval_map< Key, T >::mapped_type = T

Definition at line 16 of file interval_map.h.

◆ reverse_iterator

template<class Key , class T >
using cgv::data::interval_map< Key, T >::reverse_iterator = typename base_type::reverse_iterator

Definition at line 21 of file interval_map.h.

◆ size_type

template<class Key , class T >
using cgv::data::interval_map< Key, T >::size_type = typename base_type::size_type

Definition at line 18 of file interval_map.h.

◆ value_type

template<class Key , class T >
using cgv::data::interval_map< Key, T >::value_type = typename base_type::value_type

Definition at line 17 of file interval_map.h.

Member Function Documentation

◆ begin() [1/2]

template<class Key , class T >
iterator cgv::data::interval_map< Key, T >::begin ( )
inline

Definition at line 44 of file interval_map.h.

◆ begin() [2/2]

template<class Key , class T >
const_iterator cgv::data::interval_map< Key, T >::begin ( ) const
inline

Definition at line 46 of file interval_map.h.

◆ bounds() [1/2]

template<class Key , class T >
std::pair< iterator, iterator > cgv::data::interval_map< Key, T >::bounds ( key_type  key)
inline

Returns a pair of iterators pointing to the lower and upper bounds of the given key.

The lower bound is defined as the greatest stored key less than or equal to the given key. The upper bound is defined as the smallest stored key greater than the given key.

Definition at line 126 of file interval_map.h.

References cgv::data::interval_map< Key, T >::lower_bound(), and cgv::data::interval_map< Key, T >::upper_bound().

◆ bounds() [2/2]

template<class Key , class T >
std::pair< const_iterator, const_iterator > cgv::data::interval_map< Key, T >::bounds ( key_type  key) const
inline

Returns a pair of const iterators pointing to the lower and upper bounds of the given key.

The lower bound is defined as the greatest stored key less than or equal to the given key. The upper bound is defined as the smallest stored key greater than the given key.

Definition at line 134 of file interval_map.h.

References cgv::data::interval_map< Key, T >::lower_bound(), and cgv::data::interval_map< Key, T >::upper_bound().

◆ cbegin()

template<class Key , class T >
const_iterator cgv::data::interval_map< Key, T >::cbegin ( ) const
inline

Definition at line 60 of file interval_map.h.

◆ cend()

template<class Key , class T >
const_iterator cgv::data::interval_map< Key, T >::cend ( ) const
inline

Definition at line 62 of file interval_map.h.

◆ clear()

template<class Key , class T >
void cgv::data::interval_map< Key, T >::clear ( )
inline

Definition at line 42 of file interval_map.h.

◆ crbegin()

template<class Key , class T >
const_reverse_iterator cgv::data::interval_map< Key, T >::crbegin ( ) const
inline

Definition at line 64 of file interval_map.h.

◆ crend()

template<class Key , class T >
const_reverse_iterator cgv::data::interval_map< Key, T >::crend ( ) const
inline

Definition at line 66 of file interval_map.h.

◆ empty()

template<class Key , class T >
bool cgv::data::interval_map< Key, T >::empty ( ) const
inline

Definition at line 73 of file interval_map.h.

◆ end() [1/2]

template<class Key , class T >
iterator cgv::data::interval_map< Key, T >::end ( )
inline

Definition at line 48 of file interval_map.h.

◆ end() [2/2]

template<class Key , class T >
const_iterator cgv::data::interval_map< Key, T >::end ( ) const
inline

Definition at line 50 of file interval_map.h.

◆ erase() [1/2]

template<class Key , class T >
iterator cgv::data::interval_map< Key, T >::erase ( iterator  it)
inline

Definition at line 88 of file interval_map.h.

◆ erase() [2/2]

template<class Key , class T >
size_type cgv::data::interval_map< Key, T >::erase ( key_type  frame)
inline

Definition at line 83 of file interval_map.h.

◆ find()

template<class Key , class T >
iterator cgv::data::interval_map< Key, T >::find ( key_type  key)
inline

Definition at line 93 of file interval_map.h.

◆ insert()

template<class Key , class T >
std::pair< iterator, bool > cgv::data::interval_map< Key, T >::insert ( key_type  key,
const mapped_type &  value 
)
inline

Definition at line 78 of file interval_map.h.

◆ lower_bound() [1/2]

template<class Key , class T >
iterator cgv::data::interval_map< Key, T >::lower_bound ( key_type  key)
inline

Returns an iterator pointing to the first element in the container whose key is equivalent or smaller than the given key. If no such element exists, returns end().

Definition at line 99 of file interval_map.h.

References cgv::base::action::end().

Referenced by cgv::data::interval_map< Key, T >::bounds(), and cgv::data::interval_map< Key, T >::bounds().

◆ lower_bound() [2/2]

template<class Key , class T >
const_iterator cgv::data::interval_map< Key, T >::lower_bound ( key_type  key) const
inline

Returns a const iterator pointing to the first element in the container whose key is equivalent or smaller than the given key. If no such element exists, returns end().

Definition at line 106 of file interval_map.h.

◆ rbegin() [1/2]

template<class Key , class T >
reverse_iterator cgv::data::interval_map< Key, T >::rbegin ( )
inline

Definition at line 52 of file interval_map.h.

◆ rbegin() [2/2]

template<class Key , class T >
const_reverse_iterator cgv::data::interval_map< Key, T >::rbegin ( ) const
inline

Definition at line 54 of file interval_map.h.

◆ rend() [1/2]

template<class Key , class T >
reverse_iterator cgv::data::interval_map< Key, T >::rend ( )
inline

Definition at line 56 of file interval_map.h.

◆ rend() [2/2]

template<class Key , class T >
const_reverse_iterator cgv::data::interval_map< Key, T >::rend ( ) const
inline

Definition at line 58 of file interval_map.h.

◆ size()

template<class Key , class T >
size_type cgv::data::interval_map< Key, T >::size ( ) const
inline

Definition at line 68 of file interval_map.h.

◆ upper_bound() [1/2]

template<class Key , class T >
iterator cgv::data::interval_map< Key, T >::upper_bound ( key_type  key)
inline

Returns an iterator pointing to the first element in the container whose key is greater than the given key. If no such element exists, returns end().

Definition at line 112 of file interval_map.h.

Referenced by cgv::data::interval_map< Key, T >::bounds(), and cgv::data::interval_map< Key, T >::bounds().

◆ upper_bound() [2/2]

template<class Key , class T >
const_iterator cgv::data::interval_map< Key, T >::upper_bound ( key_type  key) const
inline

Returns a const iterator pointing to the first element in the container whose key is greater than the given key. If no such element exists, returns end().

Definition at line 118 of file interval_map.h.


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