Libosmium  2.22.0
Fast and flexible C++ library for working with OpenStreetMap data
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:
Collaboration graph
[legend]

Public Member Functions

 RelationsMapIndex ()=delete
 
 RelationsMapIndex (const RelationsMapIndex &)=delete
 
RelationsMapIndexoperator= (const RelationsMapIndex &)=delete
 
 RelationsMapIndex (RelationsMapIndex &&) noexcept
 
RelationsMapIndexoperator= (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:

...
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) {
...
});
...
Definition: relation.hpp:161
void for_each(const osmium::unsigned_object_id_type id, TFunc &&func) const
Definition: relations_map.hpp:232
Definition: relations_map.hpp:323
RelationsMapIndex build_member_to_parent_index()
Definition: relations_map.hpp:415
void add_members(const osmium::Relation &relation)
Definition: relations_map.hpp:370
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

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.

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