Libosmium  2.20.0
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

 IdSetSmall ()=default
 
 IdSetSmall (const IdSetSmall &)=default
 
IdSetSmalloperator= (const IdSetSmall &)=default
 
 IdSetSmall (IdSetSmall &&) noexcept=default
 
IdSetSmalloperator= (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
 
IdSetoperator= (const IdSet &)=default
 
 IdSet (IdSet &&) noexcept=default
 
IdSetoperator= (IdSet &&) noexcept=default
 
virtual ~IdSet () noexcept=default
 
virtual void set (T id)=0
 
virtual bool get (T id) const noexcept=0
 
virtual bool empty () const =0
 
virtual void clear ()=0
 
virtual std::size_t used_memory () const noexcept=0
 

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 > &&  )
defaultnoexcept

◆ ~IdSetSmall()

template<typename T >
osmium::index::IdSetSmall< T >::~IdSetSmall ( )
overridedefaultnoexcept

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 ( )
inlinefinalvirtual

Clear the set.

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

◆ empty()

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

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
inlinefinalvirtualnoexcept

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.

◆ 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 > &&  )
defaultnoexcept

◆ set()

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

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

◆ used_memory()

template<typename T >
std::size_t osmium::index::IdSetSmall< T >::used_memory ( ) const
inlinefinalvirtualnoexcept

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: