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

#include <id_set.hpp>

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

Public Types

using const_iterator = IdSetDenseIterator< T >
 

Public Member Functions

 IdSetDense ()=default
 
bool check_and_set (T id)
 
void set (T id) final
 
void unset (T id)
 
bool get (T id) const noexcept final
 
bool empty () const noexcept final
 
size () const noexcept
 
void clear () final
 
std::size_t used_memory () const noexcept final
 
IdSetDenseIterator< T > begin () const
 
IdSetDenseIterator< T > end () const
 
- 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 ()=default
 

Private Member Functions

last () const noexcept
 
unsigned char & get_element (T id)
 

Static Private Member Functions

static std::size_t chunk_id (T id) noexcept
 
static std::size_t offset (T id) noexcept
 
static unsigned char bitmask (T id) noexcept
 

Private Attributes

std::vector< std::unique_ptr< unsigned char[]> > m_data
 
m_size = 0
 

Static Private Attributes

static constexpr const std::size_t chunk_bits = 22u
 
static constexpr const std::size_t chunk_size = 1u << chunk_bits
 

Friends

class IdSetDenseIterator< T >
 

Detailed Description

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

A set of Ids of the given type. Internal storage is in chunks of arrays used as bit fields. Internally those chunks will be allocated as needed, so it works relatively efficiently with both smaller and larger Id sets. If it is not used, no memory is allocated at all.

Member Typedef Documentation

◆ const_iterator

template<typename T>
using osmium::index::IdSetDense< T >::const_iterator = IdSetDenseIterator<T>

Constructor & Destructor Documentation

◆ IdSetDense()

template<typename T>
osmium::index::IdSetDense< T >::IdSetDense ( )
default

Member Function Documentation

◆ begin()

template<typename T>
IdSetDenseIterator<T> osmium::index::IdSetDense< T >::begin ( ) const
inline

◆ bitmask()

template<typename T>
static unsigned char osmium::index::IdSetDense< T >::bitmask ( id)
inlinestaticprivatenoexcept

◆ check_and_set()

template<typename T>
bool osmium::index::IdSetDense< T >::check_and_set ( id)
inline

Add the Id to the set if it is not already in there.

Parameters
idThe Id to set.
Returns
true if the Id was added, false if it was already set.

◆ chunk_id()

template<typename T>
static std::size_t osmium::index::IdSetDense< T >::chunk_id ( id)
inlinestaticprivatenoexcept

◆ clear()

template<typename T>
void osmium::index::IdSetDense< T >::clear ( )
inlinefinalvirtual

Clear the set.

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

◆ empty()

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

Is the set empty?

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

◆ end()

template<typename T>
IdSetDenseIterator<T> osmium::index::IdSetDense< T >::end ( ) const
inline

◆ get()

template<typename T>
bool osmium::index::IdSetDense< T >::get ( id) const
inlinefinalvirtualnoexcept

Is the Id in the set?

Parameters
idThe Id to check.

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

◆ get_element()

template<typename T>
unsigned char& osmium::index::IdSetDense< T >::get_element ( id)
inlineprivate

◆ last()

template<typename T>
T osmium::index::IdSetDense< T >::last ( ) const
inlineprivatenoexcept

◆ offset()

template<typename T>
static std::size_t osmium::index::IdSetDense< T >::offset ( id)
inlinestaticprivatenoexcept

◆ set()

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

Add the given Id to the set.

Parameters
idThe Id to set.

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

◆ size()

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

The number of Ids stored in the set.

◆ unset()

template<typename T>
void osmium::index::IdSetDense< T >::unset ( id)
inline

Remove the given Id from the set.

Parameters
idThe Id to set.

◆ used_memory()

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

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

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

Friends And Related Function Documentation

◆ IdSetDenseIterator< T >

template<typename T>
friend class IdSetDenseIterator< T >
friend

Member Data Documentation

◆ chunk_bits

template<typename T>
constexpr const std::size_t osmium::index::IdSetDense< T >::chunk_bits = 22u
staticprivate

◆ chunk_size

template<typename T>
constexpr const std::size_t osmium::index::IdSetDense< T >::chunk_size = 1u << chunk_bits
staticprivate

◆ m_data

template<typename T>
std::vector<std::unique_ptr<unsigned char[]> > osmium::index::IdSetDense< T >::m_data
private

◆ m_size

template<typename T>
T osmium::index::IdSetDense< T >::m_size = 0
private

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