Loading...
Searching...
No Matches
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(std::is_nothrow_move_constructible< map_type >::value)
RelationsMapIndex & | operator= (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

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

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

## Member Typedef Documentation

## map_type

using osmium::index::RelationsMapIndex::map_type

private

Initial value:
detail::flat_map<osmium::unsigned_object_id_type, uint32_t,
osmium::unsigned_object_id_type, uint32_t>

## Constructor & Destructor Documentation

## RelationsMapIndex() [1/4]

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

inline explicit private

## 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

inline default noexcept

## ~RelationsMapIndex()

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

default noexcept

## Member Function Documentation

## empty()

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

inline noexcept

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.)

## 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.

osmium::unsigned_object_id_type member_id = 17;
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 && |  | ) |

inline default noexcept

## size()

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

inline noexcept

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_map

map_type osmium::index::RelationsMapIndex::m_map

private

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

- include/osmium/index/relations_map.hpp