Libosmium  2.10.3
Fast and flexible C++ library for working with OpenStreetMap data
Public Types | Public Member Functions | Private Attributes | List of all members
osmium::index::IdSetSmall< T > Class Template Reference

#include <id_set.hpp>

Inheritance diagram for osmium::index::IdSetSmall< T >:
Inheritance graph
[legend]
Collaboration diagram for osmium::index::IdSetSmall< T >:
Collaboration graph
[legend]

Public Types

using const_iterator = typename std::vector< T >::const_iterator
 Iterator type. There is no non-const iterator. More...
 

Public Member Functions

void set (T id) override final
 
bool get (T id) const noexcept override final
 
bool get_binary_search (T id) const noexcept
 
bool empty () const noexcept override final
 
void clear () override final
 
void sort_unique ()
 
size_t size () const noexcept
 
const_iterator begin () const noexcept
 
const_iterator end () const noexcept
 
const_iterator cbegin () const noexcept
 
const_iterator cend () const noexcept
 
- Public Member Functions inherited from osmium::index::IdSet< T >
virtual ~IdSet ()
 

Private Attributes

std::vector< T > m_data
 

Detailed Description

template<typename T>
class osmium::index::IdSetSmall< T >

IdSet implementation for small Id sets. It writes the Ids into a vector and uses linear search.

Member Typedef Documentation

§ const_iterator

template<typename T >
using osmium::index::IdSetSmall< T >::const_iterator = typename std::vector<T>::const_iterator

Iterator type. There is no non-const iterator.

Member Function Documentation

§ begin()

template<typename T >
const_iterator osmium::index::IdSetSmall< T >::begin ( ) const
inlinenoexcept

§ cbegin()

template<typename T >
const_iterator osmium::index::IdSetSmall< T >::cbegin ( ) const
inlinenoexcept

§ cend()

template<typename T >
const_iterator osmium::index::IdSetSmall< T >::cend ( ) const
inlinenoexcept

§ clear()

template<typename T >
void osmium::index::IdSetSmall< T >::clear ( )
inlinefinaloverridevirtual

Clear the set.

Implements osmium::index::IdSet< T >.

§ empty()

template<typename T >
bool osmium::index::IdSetSmall< T >::empty ( ) const
inlinefinaloverridevirtualnoexcept

Is the set empty?

Implements osmium::index::IdSet< T >.

§ end()

template<typename T >
const_iterator osmium::index::IdSetSmall< T >::end ( ) const
inlinenoexcept

§ get()

template<typename T >
bool osmium::index::IdSetSmall< T >::get ( id) const
inlinefinaloverridevirtualnoexcept

Is the Id in the set? Uses linear search.

Parameters
idThe Id to check.

Implements osmium::index::IdSet< T >.

§ get_binary_search()

template<typename T >
bool osmium::index::IdSetSmall< T >::get_binary_search ( id) const
inlinenoexcept

Is the Id in the set? Uses a binary search. For larger sets this might be more efficient than calling get(), the set must be sorted.

Parameters
idThe Id to check.
Precondition
You must have called sort_unique() before calling this or be sure there are no duplicates and the Ids have been set in order.

§ set()

template<typename T >
void osmium::index::IdSetSmall< T >::set ( id)
inlinefinaloverridevirtual

Add the given Id to the set.

Implements osmium::index::IdSet< T >.

§ size()

template<typename T >
size_t osmium::index::IdSetSmall< T >::size ( ) const
inlinenoexcept

The number of Ids stored in the set.

Precondition
You must have called sort_unique() before calling this or be sure there are no duplicates.

§ sort_unique()

template<typename T >
void osmium::index::IdSetSmall< T >::sort_unique ( )
inline

Sort the internal vector and remove any duplicates. Call this before using size(), get_binary_search() or using an iterator.

Member Data Documentation

§ m_data

template<typename T >
std::vector<T> osmium::index::IdSetSmall< T >::m_data
private

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