1#ifndef OSMIUM_RELATIONS_RELATIONS_MANAGER_HPP
2#define OSMIUM_RELATIONS_RELATIONS_MANAGER_HPP
153 assert(
false &&
"Should not be here");
175 assert(
false &&
"Should not be here");
186 if (member.ref() == 0) {
259 osmium::memory::Buffer&
buffer() noexcept {
264 void set_callback(
const std::function<
void(osmium::memory::Buffer&&)>& callback) {
279 osmium::memory::Buffer
read() {
304 template <
typename TManager,
bool TNodes,
bool TWays,
bool TRelations,
bool TCheckOrder = true>
446 return *
static_cast<TManager*
>(
this);
450 derived().complete_relation(*rel_handle);
453 for (
const auto& member : rel_handle->
members()) {
454 if (member.ref() != 0) {
493 for (
auto& member : rel_handle->members()) {
558 template <
typename TFunc>
Definition: item_stash.hpp:57
std::size_t used_memory() const noexcept
Definition: item_stash.hpp:208
Definition: object.hpp:64
object_id_type id() const noexcept
Get ID of this object.
Definition: object.hpp:118
Definition: relation.hpp:56
Definition: relation.hpp:161
RelationMemberList & members()
Get a reference to the member list.
Definition: relation.hpp:179
Definition: handler.hpp:71
void node(const osmium::Node &) const noexcept
Definition: handler.hpp:78
void way(const osmium::Way &) const noexcept
Definition: handler.hpp:81
Definition: callback_buffer.hpp:70
osmium::memory::Buffer & buffer() noexcept
Definition: callback_buffer.hpp:133
void set_callback(const callback_func_type &callback=nullptr) noexcept
Definition: callback_buffer.hpp:144
osmium::memory::Buffer read()
Definition: callback_buffer.hpp:181
void possibly_flush()
Definition: callback_buffer.hpp:170
void flush()
Definition: callback_buffer.hpp:156
Definition: members_database.hpp:62
void prepare_for_lookup()
Definition: members_database.hpp:259
void track(RelationHandle &rel_handle, osmium::object_id_type member_id, std::size_t member_num)
Definition: members_database.hpp:246
const osmium::OSMObject * get_object(osmium::object_id_type id) const
Definition: members_database.hpp:305
void remove(osmium::object_id_type member_id, osmium::object_id_type relation_id)
Definition: members_database.hpp:273
std::size_t used_memory() const noexcept
Definition: members_database.hpp:187
const TObject * get(osmium::object_id_type id) const
Definition: members_database.hpp:403
bool add(const TObject &object, TFunc &&func)
Definition: members_database.hpp:364
Definition: relations_database.hpp:208
void remove()
Definition: relations_database.hpp:274
Definition: relations_database.hpp:82
void for_each_relation(TFunc &&func)
Definition: relations_database.hpp:323
RelationHandle add(const osmium::Relation &relation)
Definition: relations_database.hpp:317
std::size_t used_memory() const noexcept
Definition: relations_database.hpp:144
Definition: relations_manager.hpp:74
relations::MembersDatabaseCommon & member_database(osmium::item_type type) noexcept
Definition: relations_manager.hpp:141
relations::MembersDatabase< osmium::Way > m_member_ways_db
Definition: relations_manager.hpp:85
osmium::memory::CallbackBuffer m_output
Output buffer.
Definition: relations_manager.hpp:89
osmium::memory::Buffer read()
Return the contents of the output buffer.
Definition: relations_manager.hpp:279
const osmium::relations::MembersDatabase< osmium::Node > & member_nodes_database() const noexcept
Access the internal database containing member nodes.
Definition: relations_manager.hpp:111
RelationsManagerBase()
Definition: relations_manager.hpp:93
osmium::relations::MembersDatabase< osmium::Node > & member_nodes_database() noexcept
Access the internal database containing member nodes.
Definition: relations_manager.hpp:106
void prepare_for_lookup()
Definition: relations_manager.hpp:239
void flush_output()
Flush the output buffer.
Definition: relations_manager.hpp:269
void possibly_flush()
Flush the output buffer if it is full.
Definition: relations_manager.hpp:274
const relations::MembersDatabaseCommon & member_database(osmium::item_type type) const noexcept
Definition: relations_manager.hpp:163
const osmium::OSMObject * get_member_object(const osmium::RelationMember &member) const noexcept
Definition: relations_manager.hpp:185
osmium::relations::MembersDatabase< osmium::Relation > & member_relations_database() noexcept
Access the internal database containing member relations.
Definition: relations_manager.hpp:126
osmium::relations::RelationsDatabase & relations_database() noexcept
Access the internal RelationsDatabase.
Definition: relations_manager.hpp:101
osmium::memory::Buffer & buffer() noexcept
Access the output buffer.
Definition: relations_manager.hpp:259
const osmium::Node * get_member_node(osmium::object_id_type id) const noexcept
Definition: relations_manager.hpp:199
const osmium::relations::MembersDatabase< osmium::Way > & member_ways_database() const noexcept
Access the internal database containing member ways.
Definition: relations_manager.hpp:121
relations_manager_memory_usage used_memory() const noexcept
Definition: relations_manager.hpp:248
relations::MembersDatabase< osmium::Node > m_member_nodes_db
Databases of all members we are interested in.
Definition: relations_manager.hpp:84
relations::RelationsDatabase m_relations_db
Database of all relations we are interested in.
Definition: relations_manager.hpp:81
relations::MembersDatabase< osmium::Relation > m_member_relations_db
Definition: relations_manager.hpp:86
osmium::ItemStash m_stash
Definition: relations_manager.hpp:78
osmium::relations::MembersDatabase< osmium::Way > & member_ways_database() noexcept
Access the internal database containing member ways.
Definition: relations_manager.hpp:116
void set_callback(const std::function< void(osmium::memory::Buffer &&)> &callback)
Set the callback called when the output buffer is full.
Definition: relations_manager.hpp:264
const osmium::Relation * get_member_relation(osmium::object_id_type id) const noexcept
Definition: relations_manager.hpp:227
const osmium::relations::MembersDatabase< osmium::Relation > & member_relations_database() const noexcept
Access the internal database containing member relations.
Definition: relations_manager.hpp:131
const osmium::Way * get_member_way(osmium::object_id_type id) const noexcept
Definition: relations_manager.hpp:213
Definition: relations_manager.hpp:305
void relation(const osmium::Relation &relation)
Definition: relations_manager.hpp:488
void before_way(const osmium::Way &) const noexcept
Definition: relations_manager.hpp:392
void relation_not_in_any_relation(const osmium::Relation &) const noexcept
Definition: relations_manager.hpp:432
void after_relation(const osmium::Relation &) const noexcept
Definition: relations_manager.hpp:442
void handle_complete_relation(RelationHandle &rel_handle)
Definition: relations_manager.hpp:449
RelationsManager()
Definition: relations_manager.hpp:464
void complete_relation(const osmium::Relation &) const noexcept
Definition: relations_manager.hpp:352
SecondPassHandler< RelationsManager > m_handler_pass2
Definition: relations_manager.hpp:311
SecondPassHandler< RelationsManager > & handler(const std::function< void(osmium::memory::Buffer &&)> &callback=nullptr)
Definition: relations_manager.hpp:473
check_order_handler m_check_order_handler
Definition: relations_manager.hpp:309
void handle_way(const osmium::Way &way)
Definition: relations_manager.hpp:520
void handle_node(const osmium::Node &node)
Definition: relations_manager.hpp:505
bool new_relation(const osmium::Relation &) const noexcept
Definition: relations_manager.hpp:328
void node_not_in_any_relation(const osmium::Node &) const noexcept
Definition: relations_manager.hpp:372
void before_relation(const osmium::Relation &) const noexcept
Definition: relations_manager.hpp:422
void before_node(const osmium::Node &) const noexcept
Definition: relations_manager.hpp:362
void after_node(const osmium::Node &) const noexcept
Definition: relations_manager.hpp:382
static bool wanted_type(osmium::item_type type) noexcept
Definition: relations_manager.hpp:313
void for_each_incomplete_relation(TFunc &&func)
Definition: relations_manager.hpp:559
void way_not_in_any_relation(const osmium::Way &) const noexcept
Definition: relations_manager.hpp:402
TManager & derived() noexcept
Definition: relations_manager.hpp:445
void after_way(const osmium::Way &) const noexcept
Definition: relations_manager.hpp:412
typename std::conditional< TCheckOrder, osmium::handler::CheckOrder, osmium::handler::Handler >::type check_order_handler
Definition: relations_manager.hpp:307
void handle_relation(const osmium::Relation &relation)
Definition: relations_manager.hpp:535
bool new_member(const osmium::Relation &, const osmium::RelationMember &, std::size_t) const noexcept
Definition: relations_manager.hpp:342
Definition: manager_util.hpp:64
type
Definition: entity_bits.hpp:63
Namespace for everything in the Osmium library.
Definition: assembler.hpp:53
int64_t object_id_type
Type for OSM object (node, way, or relation) IDs.
Definition: types.hpp:45
item_type
Definition: item_type.hpp:45
Definition: manager_util.hpp:160