Libosmium: osmium::index::IdSetDense< T, chunk_bits > Class Template Reference

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

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
osmium::index::IdSetDense< T, chunk_bits > Class Template Reference

`#include <id_set.hpp>`

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

## Public Types
using | const_iterator = IdSetDenseIterator<T, chunk_bits>

## Public Member Functions
| IdSetDense ()=default
| IdSetDense (const IdSetDense &other)
IdSetDense & | operator= (IdSetDense other)
| IdSetDense (IdSetDense &&) noexcept=default
IdSetDense & | operator= (IdSetDense &&)=default
| ~IdSetDense () noexcept override=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
T | size () const noexcept
void | clear () final
std::size_t | used_memory () const noexcept final
const_iterator | begin () const
const_iterator | end () const
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 Types
enum | : std::size_t { chunk_size = 1U << chunk_bits }

## Private Member Functions
T | 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 int | bitmask (T id) noexcept

## Private Attributes
std::vector< std::unique_ptr< unsigned char[]> > | m_data
T | m_size = 0

## Friends
class | IdSetDenseIterator< T, chunk_bits >
void | swap (IdSetDense &first, IdSetDense &second) noexcept

## Detailed Description

template<typename T, std::size_t chunk_bits>
class osmium::index::IdSetDense< T, chunk_bits >

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, std::size_t chunk_bits>

using osmium::index::IdSetDense< T, chunk_bits >::const_iterator = IdSetDenseIterator<T, chunk_bits>

## Member Enumeration Documentation

## ◆ anonymous enum

template<typename T, std::size_t chunk_bits>

anonymous enum : std::size_t
| private

Enumerator
chunk_size |

## Constructor & Destructor Documentation

## ◆ IdSetDense() [1/3]

template<typename T, std::size_t chunk_bits>

osmium::index::IdSetDense< T, chunk_bits >::IdSetDense | ( |  | ) |
| default

## ◆ IdSetDense() [2/3]

template<typename T, std::size_t chunk_bits>

osmium::index::IdSetDense< T, chunk_bits >::IdSetDense | ( | const IdSetDense< T, chunk_bits > & | other | ) |
| inline

## ◆ IdSetDense() [3/3]

template<typename T, std::size_t chunk_bits>

osmium::index::IdSetDense< T, chunk_bits >::IdSetDense | ( | IdSetDense< T, chunk_bits > && |  | ) |
| defaultnoexcept

## ◆ ~IdSetDense()

template<typename T, std::size_t chunk_bits>

osmium::index::IdSetDense< T, chunk_bits >::~IdSetDense | ( |  | ) |
| overridedefaultnoexcept

## Member Function Documentation

## ◆ begin()

template<typename T, std::size_t chunk_bits>

const_iterator osmium::index::IdSetDense< T, chunk_bits >::begin | ( |  | ) | const
| inline

## ◆ bitmask()

template<typename T, std::size_t chunk_bits>

unsigned int osmium::index::IdSetDense< T, chunk_bits >::bitmask | ( | T | id | ) |
| inlinestaticprivatenoexcept

## ◆ check_and_set()

template<typename T, std::size_t chunk_bits>

bool osmium::index::IdSetDense< T, chunk_bits >::check_and_set | ( | T | id | ) |
| inline

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

Parameters

  id | The Id to set.

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

## ◆ chunk_id()

template<typename T, std::size_t chunk_bits>

std::size_t osmium::index::IdSetDense< T, chunk_bits >::chunk_id | ( | T | id | ) |
| inlinestaticprivatenoexcept

## ◆ clear()

template<typename T, std::size_t chunk_bits>

void osmium::index::IdSetDense< T, chunk_bits >::clear | ( |  | ) |
| inlinefinalvirtual

Clear the set.

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

## ◆ empty()

template<typename T, std::size_t chunk_bits>

bool osmium::index::IdSetDense< T, chunk_bits >::empty | ( |  | ) | const
| inlinefinalvirtualnoexcept

Is the set empty?

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

## ◆ end()

template<typename T, std::size_t chunk_bits>

const_iterator osmium::index::IdSetDense< T, chunk_bits >::end | ( |  | ) | const
| inline

## ◆ get()

template<typename T, std::size_t chunk_bits>

bool osmium::index::IdSetDense< T, chunk_bits >::get | ( | T | id | ) | const
| inlinefinalvirtualnoexcept

Is the Id in the set?

Parameters

  id | The Id to check.

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

## ◆ get_element()

template<typename T, std::size_t chunk_bits>

unsigned char & osmium::index::IdSetDense< T, chunk_bits >::get_element | ( | T | id | ) |
| inlineprivate

## ◆ last()

template<typename T, std::size_t chunk_bits>

T osmium::index::IdSetDense< T, chunk_bits >::last | ( |  | ) | const
| inlineprivatenoexcept

## ◆ offset()

template<typename T, std::size_t chunk_bits>

std::size_t osmium::index::IdSetDense< T, chunk_bits >::offset | ( | T | id | ) |
| inlinestaticprivatenoexcept

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

template<typename T, std::size_t chunk_bits>

IdSetDense & osmium::index::IdSetDense< T, chunk_bits >::operator= | ( | IdSetDense< T, chunk_bits > && |  | ) |
| default

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

template<typename T, std::size_t chunk_bits>

IdSetDense & osmium::index::IdSetDense< T, chunk_bits >::operator= | ( | IdSetDense< T, chunk_bits > | other | ) |
| inline

## ◆ set()

template<typename T, std::size_t chunk_bits>

void osmium::index::IdSetDense< T, chunk_bits >::set | ( | T | id | ) |
| inlinefinalvirtual

Add the given Id to the set.

Parameters

  id | The Id to set.

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

## ◆ size()

template<typename T, std::size_t chunk_bits>

T osmium::index::IdSetDense< T, chunk_bits >::size | ( |  | ) | const
| inlinenoexcept

The number of Ids stored in the set.

## ◆ unset()

template<typename T, std::size_t chunk_bits>

void osmium::index::IdSetDense< T, chunk_bits >::unset | ( | T | id | ) |
| inline

Remove the given Id from the set.

Parameters

  id | The Id to set.

## ◆ used_memory()

template<typename T, std::size_t chunk_bits>

std::size_t osmium::index::IdSetDense< T, chunk_bits >::used_memory | ( |  | ) | const
| inlinefinalvirtualnoexcept

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

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

## Friends And Related Symbol Documentation

## ◆ IdSetDenseIterator< T, chunk_bits >

template<typename T, std::size_t chunk_bits>

friend class IdSetDenseIterator< T, chunk_bits >
| friend

## ◆ swap

template<typename T, std::size_t chunk_bits>

void swap | ( | IdSetDense< T, chunk_bits > & | first,
|  | IdSetDense< T, chunk_bits > & | second )
| friend

## Member Data Documentation

## ◆ m_data

template<typename T, std::size_t chunk_bits>

std::vector<std::unique_ptr<unsigned char[]> > osmium::index::IdSetDense< T, chunk_bits >::m_data
| private

## ◆ m_size

template<typename T, std::size_t chunk_bits>

T osmium::index::IdSetDense< T, chunk_bits >::m_size = 0
| private

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

- include/osmium/index/id_set.hpp