Libosmium 2.22.0 Fast and flexible C++ library for working with OpenStreetMap data

Loading...
Searching...
No Matches
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 >:
[legend]
Collaboration diagram for osmium::index::IdSetSmall< T >:
[legend]

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

## Public Member Functions
| IdSetSmall ()=default
| IdSetSmall (const IdSetSmall &)=default
IdSetSmall & | operator= (const IdSetSmall &)=default
| IdSetSmall (IdSetSmall &&) noexcept=default
IdSetSmall & | operator= (IdSetSmall &&) noexcept=default
| ~IdSetSmall () noexcept override=default
void | set (T id) final
bool | get (T id) const noexcept final
bool | get_binary_search (T id) const noexcept
bool | empty () const noexcept final
void | clear () final
void | sort_unique ()
std::size_t | size () const noexcept
std::size_t | used_memory () const noexcept final
void | merge_sorted (const IdSetSmall< T > &other)
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 >
| IdSet ()=default
| IdSet (const IdSet &)=default
IdSet & | operator= (const IdSet &)=default
| IdSet (IdSet &&) noexcept=default
IdSet & | operator= (IdSet &&) noexcept=default
virtual | ~IdSet () noexcept=default

## 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.

## Constructor & Destructor Documentation

## ◆ IdSetSmall() [1/3]

template<typename T >

osmium::index::IdSetSmall< T >::IdSetSmall | ( |  | ) |
| default

## ◆ IdSetSmall() [2/3]

template<typename T >

osmium::index::IdSetSmall< T >::IdSetSmall | ( | const IdSetSmall< T > & |  | ) |
| default

## ◆ IdSetSmall() [3/3]

template<typename T >

osmium::index::IdSetSmall< T >::IdSetSmall | ( | IdSetSmall< T > && |  | ) |
| default noexcept

## ◆ ~IdSetSmall()

template<typename T >

osmium::index::IdSetSmall< T >::~IdSetSmall | ( |  | ) |
| override default noexcept

## Member Function Documentation

## ◆ begin()

template<typename T >

const_iterator osmium::index::IdSetSmall< T >::begin | ( |  | ) | const
| inline noexcept

## ◆ cbegin()

template<typename T >

const_iterator osmium::index::IdSetSmall< T >::cbegin | ( |  | ) | const
| inline noexcept

## ◆ cend()

template<typename T >

const_iterator osmium::index::IdSetSmall< T >::cend | ( |  | ) | const
| inline noexcept

## ◆ clear()

template<typename T >

void osmium::index::IdSetSmall< T >::clear | ( |  | ) |
| inline final virtual

Clear the set.

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

## ◆ empty()

template<typename T >

bool osmium::index::IdSetSmall< T >::empty | ( |  | ) | const
| inline final virtual noexcept

Is the set empty?

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

## ◆ end()

template<typename T >

const_iterator osmium::index::IdSetSmall< T >::end | ( |  | ) | const
| inline noexcept

## ◆ get()

template<typename T >

bool osmium::index::IdSetSmall< T >::get | ( | T | id | ) | const
| inline final virtual noexcept

Is the Id in the set? Uses linear search.

Parameters

  id | The Id to check.

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

## ◆ get_binary_search()

template<typename T >

bool osmium::index::IdSetSmall< T >::get_binary_search | ( | T | id | ) | const
| inline noexcept

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

  id | The 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.

## ◆ merge_sorted()

template<typename T >

void osmium::index::IdSetSmall< T >::merge_sorted | ( | const IdSetSmall< T > & | other | ) |
| inline

Merge the other set into this one. The result is sorted.

Precondition
  Both sets must be sorted and must not contain any duplicates. Call sort_unique() if you are not sure.

## ◆ operator=() [1/2]

template<typename T >

IdSetSmall & osmium::index::IdSetSmall< T >::operator= | ( | const IdSetSmall< T > & |  | ) |
| default

## ◆ operator=() [2/2]

template<typename T >

IdSetSmall & osmium::index::IdSetSmall< T >::operator= | ( | IdSetSmall< T > && |  | ) |
| default noexcept

## ◆ set()

template<typename T >

void osmium::index::IdSetSmall< T >::set | ( | T | id | ) |
| inline final virtual

Add the given Id to the set.

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

## ◆ size()

template<typename T >

std::size_t osmium::index::IdSetSmall< T >::size | ( |  | ) | const
| inline noexcept

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(), merge_sorted() or using an iterator.

## ◆ used_memory()

template<typename T >

std::size_t osmium::index::IdSetSmall< T >::used_memory | ( |  | ) | const
| inline final virtual noexcept

Get an estimate of the amount of memory used for the set.

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

## 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:

- include/osmium/index/id_set.hpp