Libosmium  2.20.0
Fast and flexible C++ library for working with OpenStreetMap data
Public Member Functions | Private Types | 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(std::is_nothrow_move_constructible< map_type >::value)
 
RelationsMapIndexoperator= (RelationsMapIndex &&) noexcept(std::is_nothrow_move_assignable< map_type >::value)
 
 ~RelationsMapIndex () noexcept=default
 
template<typename TFunc >
void for_each_parent (const osmium::unsigned_object_id_type member_id, TFunc &&func) const
 
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 Types

using map_type = detail::flat_map< osmium::unsigned_object_id_type, uint32_t, osmium::unsigned_object_id_type, uint32_t >
 

Private Member Functions

 RelationsMapIndex (map_type &&map)
 

Private Attributes

map_type m_map
 

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:234
Definition: relations_map.hpp:313
RelationsMapIndex build_member_to_parent_index()
Definition: relations_map.hpp:399
void add_members(const osmium::Relation &relation)
Definition: relations_map.hpp:347
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

Member Typedef Documentation

◆ map_type

Constructor & Destructor Documentation

◆ RelationsMapIndex() [1/4]

osmium::index::RelationsMapIndex::RelationsMapIndex ( map_type &&  map)
inlineexplicitprivate

◆ RelationsMapIndex() [2/4]

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

◆ RelationsMapIndex() [3/4]

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

◆ RelationsMapIndex() [4/4]

osmium::index::RelationsMapIndex::RelationsMapIndex ( RelationsMapIndex &&  ) const
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.)

◆ for_each_parent()

template<typename TFunc >
void osmium::index::RelationsMapIndex::for_each_parent ( const osmium::unsigned_object_id_type  member_id,
TFunc &&  func 
) const
inline

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

index.for_each_parent(member_id, [](osmium::unsigned_object_id_type id) {
...
});
Deprecated:
Use for_each() instead.

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_map

map_type osmium::index::RelationsMapIndex::m_map
private

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