Libosmium: osmium::index::RelationsMapIndex Class Reference

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

Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
osmium::index::RelationsMapIndex Class Reference

`#include <relations_map.hpp>`

Collaboration diagram for osmium::index::RelationsMapIndex:
[legend]

## Public Member Functions
| RelationsMapIndex ()=delete
| RelationsMapIndex (const RelationsMapIndex &)=delete
RelationsMapIndex & | operator= (const RelationsMapIndex &)=delete
| RelationsMapIndex (RelationsMapIndex &&) noexcept
RelationsMapIndex & | operator= (RelationsMapIndex &&) noexcept
| ~RelationsMapIndex () noexcept=default
template<typename TFunc>
void | for_each (const osmium::unsigned_object_id_type id, TFunc &&func) const
bool | empty () const noexcept
std::size_t | size () const noexcept

## Private Member Functions
| RelationsMapIndex (detail::rel_index_map_type< uint32_t > &&map)
| RelationsMapIndex (detail::rel_index_map_type< uint64_t > &&map)

## Private Attributes
detail::rel_index_map_type< uint32_t > | m_map32
detail::rel_index_map_type< uint64_t > | m_map64
bool | m_small

## Friends
class | RelationsMapStash
class | RelationsMapIndexes

## Detailed Description

Index for looking up parent relation IDs given a member relation ID or the other way around.

You can not instantiate such an index yourself, instead you need to instantiate a RelationsMapStash, fill it and then create an index from it:

RelationsMapStash stash;
...
for_each_relation(const osmium::Relation& relation) {
stash.add_members(relation);
}
...
const auto index = stash.build_member_to_parent_index();
...
osmium::unsigned_object_id_type member_id = ...;
index.for_each(member_id, [](osmium::unsigned_object_id_type parent_id) {
...
});
...
osmium::Relation
Definition relation.hpp:161
osmium::index::RelationsMapIndex::RelationsMapStash
friend class RelationsMapStash
Definition relations_map.hpp:189
osmium::index::RelationsMapStash::build_member_to_parent_index
RelationsMapIndex build_member_to_parent_index()
Definition relations_map.hpp:415
osmium::index::RelationsMapStash::add_members
void add_members(const osmium::Relation &relation)
Definition relations_map.hpp:370
osmium::index
Indexing of OSM data, Locations, etc.
Definition id_set.hpp:51
osmium::unsigned_object_id_type
uint64_t unsigned_object_id_type
Type for OSM object (node, way, or relation) IDs where we only allow positive IDs.
Definition types.hpp:46
osmium::item_type::relation
@ relation
Definition item_type.hpp:50

## Constructor & Destructor Documentation

## ◆ RelationsMapIndex() [1/5]

osmium::index::RelationsMapIndex::RelationsMapIndex | ( | detail::rel_index_map_type< uint32_t > && | map | ) |
| inlineexplicitprivate

## ◆ RelationsMapIndex() [2/5]

osmium::index::RelationsMapIndex::RelationsMapIndex | ( | detail::rel_index_map_type< uint64_t > && | map | ) |
| inlineexplicitprivate

## ◆ RelationsMapIndex() [3/5]

osmium::index::RelationsMapIndex::RelationsMapIndex | ( |  | ) |
| delete

## ◆ RelationsMapIndex() [4/5]

osmium::index::RelationsMapIndex::RelationsMapIndex | ( | const RelationsMapIndex & |  | ) |
| delete

## ◆ RelationsMapIndex() [5/5]

osmium::index::RelationsMapIndex::RelationsMapIndex | ( | RelationsMapIndex && |  | ) |
| inlinedefaultnoexcept

## ◆ ~RelationsMapIndex()

osmium::index::RelationsMapIndex::~RelationsMapIndex | ( |  | ) |
| defaultnoexcept

## Member Function Documentation

## ◆ empty()

bool osmium::index::RelationsMapIndex::empty | ( |  | ) | const
| inlinenoexcept

Is this index empty?

Complexity: Constant.

## ◆ for_each()

template<typename TFunc>

void osmium::index::RelationsMapIndex::for_each | ( | const osmium::unsigned_object_id_type | id,
|  | TFunc && | func ) const
| inline

Find the given relation id in the index and call the given function with all related relation ids.

osmium::unsigned_object_id_type id = 17;
index.for_each(id, [](osmium::unsigned_object_id_type rid) {
...
});

Complexity: Logarithmic in the number of elements in the index. (Lookup uses binary search.)

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

RelationsMapIndex & osmium::index::RelationsMapIndex::operator= | ( | const RelationsMapIndex & |  | ) |
| delete

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

RelationsMapIndex & osmium::index::RelationsMapIndex::operator= | ( | RelationsMapIndex && |  | ) |
| inlinedefaultnoexcept

## ◆ size()

std::size_t osmium::index::RelationsMapIndex::size | ( |  | ) | const
| inlinenoexcept

How many entries are in this index?

Complexity: Constant.

## Friends And Related Symbol Documentation

## ◆ RelationsMapIndexes

friend class RelationsMapIndexes
| friend

## ◆ RelationsMapStash

friend class RelationsMapStash
| friend

## Member Data Documentation

## ◆ m_map32

detail::rel_index_map_type<uint32_t> osmium::index::RelationsMapIndex::m_map32
| private

## ◆ m_map64

detail::rel_index_map_type<uint64_t> osmium::index::RelationsMapIndex::m_map64
| private

## ◆ m_small

bool osmium::index::RelationsMapIndex::m_small
| private

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

- include/osmium/index/relations_map.hpp