Loading...
Searching...
No Matches
osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder > Class Template Reference

`#include <relations_manager.hpp>`

Inheritance diagram for osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >:
[legend]
Collaboration diagram for osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >:
[legend]

## Public Member Functions

| RelationsManager ()
SecondPassHandler< RelationsManager > & | handler (const std::function< void(osmium::memory::Buffer &&)> &callback=nullptr)
void | relation (const osmium::Relation &relation)
void | handle_node (const osmium::Node &node)
void | handle_way (const osmium::Way &way)
void | handle_relation (const osmium::Relation &relation)
template<typename TFunc >
void | for_each_incomplete_relation (TFunc &&func)
Public Member Functions inherited from osmium::relations::RelationsManagerBase
| RelationsManagerBase ()
osmium::relations::RelationsDatabase & | relations_database () noexcept
| Access the internal RelationsDatabase.
osmium::relations::MembersDatabase< osmium::Node > & | member_nodes_database () noexcept
| Access the internal database containing member nodes.
const osmium::relations::MembersDatabase< osmium::Node > & | member_nodes_database () const noexcept
| Access the internal database containing member nodes.
osmium::relations::MembersDatabase< osmium::Way > & | member_ways_database () noexcept
| Access the internal database containing member ways.
const osmium::relations::MembersDatabase< osmium::Way > & | member_ways_database () const noexcept
| Access the internal database containing member ways.
osmium::relations::MembersDatabase< osmium::Relation > & | member_relations_database () noexcept
| Access the internal database containing member relations.
const osmium::relations::MembersDatabase< osmium::Relation > & | member_relations_database () const noexcept
| Access the internal database containing member relations.
relations::MembersDatabaseCommon & | member_database (osmium::item_type type) noexcept
const relations::MembersDatabaseCommon & | member_database (osmium::item_type type) const noexcept
const osmium::OSMObject * | get_member_object (const osmium::RelationMember &member) const noexcept
const osmium::Node * | get_member_node (osmium::object_id_type id) const noexcept
const osmium::Way * | get_member_way (osmium::object_id_type id) const noexcept
const osmium::Relation * | get_member_relation (osmium::object_id_type id) const noexcept
void | prepare_for_lookup ()
relations_manager_memory_usage | used_memory () const noexcept
osmium::memory::Buffer & | buffer () noexcept
| Access the output buffer.
void | set_callback (const std::function< void(osmium::memory::Buffer &&)> &callback)
| Set the callback called when the output buffer is full.
void | flush_output ()
| Flush the output buffer.
void | possibly_flush ()
| Flush the output buffer if it is full.
osmium::memory::Buffer | read ()
| Return the contents of the output buffer.
Public Member Functions inherited from osmium::handler::Handler
void | osm_object (const osmium::OSMObject &) const noexcept
void | node (const osmium::Node &) const noexcept
void | way (const osmium::Way &) const noexcept
void | relation (const osmium::Relation &) const noexcept
void | area (const osmium::Area &) const noexcept
void | changeset (const osmium::Changeset &) const noexcept
void | tag_list (const osmium::TagList &) const noexcept
void | way_node_list (const osmium::WayNodeList &) const noexcept
void | relation_member_list (const osmium::RelationMemberList &) const noexcept
void | outer_ring (const osmium::OuterRing &) const noexcept
void | inner_ring (const osmium::InnerRing &) const noexcept
void | changeset_discussion (const osmium::ChangesetDiscussion &) const noexcept
void | flush () const noexcept

## Private Types

using | check_order_handler = std::conditional_t< TCheckOrder, osmium::handler::CheckOrder, osmium::handler::Handler >

## Private Member Functions

bool | new_relation (const osmium::Relation &) const noexcept
bool | new_member (const osmium::Relation &, const osmium::RelationMember &, std::size_t) const noexcept
void | complete_relation (const osmium::Relation &) const noexcept
void | before_node (const osmium::Node &) const noexcept
void | node_not_in_any_relation (const osmium::Node &) const noexcept
void | after_node (const osmium::Node &) const noexcept
void | before_way (const osmium::Way &) const noexcept
void | way_not_in_any_relation (const osmium::Way &) const noexcept
void | after_way (const osmium::Way &) const noexcept
void | before_relation (const osmium::Relation &) const noexcept
void | relation_not_in_any_relation (const osmium::Relation &) const noexcept
void | after_relation (const osmium::Relation &) const noexcept
TManager & | derived () noexcept
void | handle_complete_relation (RelationHandle &rel_handle)

## Static Private Member Functions

static bool | wanted_type (osmium::item_type type) noexcept

## Private Attributes

check_order_handler | m_check_order_handler
SecondPassHandler< RelationsManager > | m_handler_pass2

## Detailed Description

template<typename TManager, bool TNodes, bool TWays, bool TRelations, bool TCheckOrder = true>
class osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >

This is a base class for RelationManager classes. It keeps track of all interesting relations and all interesting members of those relations. When all members are available it calls code to handle the completed relation.

This class is intended as a base class for classes that handle specific types of relations. Derive from this class, implement the complete_relation() function and overwrite certain other functions as needed.

Template Parameters

  TManager | The derived class (Uses CRTP).
  TNodes | Are we interested in member nodes?
  TWays | Are we interested in member ways?
  TRelations | Are we interested in member relations?
  TCheckOrder | Should the order of the input data be checked?

Precondition
  The Ids of all objects must be unique in the input data.

## Member Typedef Documentation

## check_order_handler

template<typename TManager , bool TNodes, bool TWays, bool TRelations, bool TCheckOrder = true>

using osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >::check_order_handler = std::conditional_t<TCheckOrder, osmium::handler::CheckOrder, osmium::handler::Handler>

private

## Constructor & Destructor Documentation

## RelationsManager()

template<typename TManager , bool TNodes, bool TWays, bool TRelations, bool TCheckOrder = true>

osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >::RelationsManager | ( |  | ) |

inline

## Member Function Documentation

## after_node()

template<typename TManager , bool TNodes, bool TWays, bool TRelations, bool TCheckOrder = true>

void osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >::after_node | ( | const osmium::Node & |  | ) | const

inline private noexcept

This method is called for all nodes during the second pass after the relation member handling.

Overwrite this method in a derived class if you are interested in this.

## after_relation()

template<typename TManager , bool TNodes, bool TWays, bool TRelations, bool TCheckOrder = true>

void osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >::after_relation | ( | const osmium::Relation & |  | ) | const

inline private noexcept

This method is called for all relations during the second pass after the relation member handling.

Overwrite this method in a derived class if you are interested in this.

## after_way()

template<typename TManager , bool TNodes, bool TWays, bool TRelations, bool TCheckOrder = true>

void osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >::after_way | ( | const osmium::Way & |  | ) | const

inline private noexcept

This method is called for all ways during the second pass after the relation member handling.

Overwrite this method in a derived class if you are interested in this.

## before_node()

template<typename TManager , bool TNodes, bool TWays, bool TRelations, bool TCheckOrder = true>

void osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >::before_node | ( | const osmium::Node & |  | ) | const

inline private noexcept

This method is called for all nodes during the second pass before the relation member handling.

Overwrite this method in a derived class if you are interested in this.

## before_relation()

template<typename TManager , bool TNodes, bool TWays, bool TRelations, bool TCheckOrder = true>

void osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >::before_relation | ( | const osmium::Relation & |  | ) | const

inline private noexcept

This method is called for all relations during the second pass before the relation member handling.

Overwrite this method in a derived class if you are interested in this.

## before_way()

template<typename TManager , bool TNodes, bool TWays, bool TRelations, bool TCheckOrder = true>

void osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >::before_way | ( | const osmium::Way & |  | ) | const

inline private noexcept

This method is called for all ways during the second pass before the relation member handling.

Overwrite this method in a derived class if you are interested in this.

## complete_relation()

template<typename TManager , bool TNodes, bool TWays, bool TRelations, bool TCheckOrder = true>

void osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >::complete_relation | ( | const osmium::Relation & |  | ) | const

inline private noexcept

This method is called for each complete relation, ie when all members you have expressed interest in are available.

You have to overwrite this in a derived class.

## derived()

template<typename TManager , bool TNodes, bool TWays, bool TRelations, bool TCheckOrder = true>

TManager & osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >::derived | ( |  | ) |

inline private noexcept

## for_each_incomplete_relation()

template<typename TManager , bool TNodes, bool TWays, bool TRelations, bool TCheckOrder = true>
template<typename TFunc >

void osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >::for_each_incomplete_relation | ( | TFunc && | func | ) |

inline

Call this function it will call your function back for every incomplete relation, that is all relations that have missing members in the input data. Usually you call this only after your second pass through the data if you are interested in any relations that have all or some of their members missing in the input data.

## handle_complete_relation()

template<typename TManager , bool TNodes, bool TWays, bool TRelations, bool TCheckOrder = true>

void osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >::handle_complete_relation | ( | RelationHandle & | rel_handle | ) |

inline private

## handle_node()

template<typename TManager , bool TNodes, bool TWays, bool TRelations, bool TCheckOrder = true>

void osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >::handle_node | ( | const osmium::Node & | node | ) |

inline

## handle_relation()

template<typename TManager , bool TNodes, bool TWays, bool TRelations, bool TCheckOrder = true>

void osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >::handle_relation | ( | const osmium::Relation & | relation | ) |

inline

## handle_way()

template<typename TManager , bool TNodes, bool TWays, bool TRelations, bool TCheckOrder = true>

void osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >::handle_way | ( | const osmium::Way & | way | ) |

inline

## handler()

template<typename TManager , bool TNodes, bool TWays, bool TRelations, bool TCheckOrder = true>

SecondPassHandler< RelationsManager > & osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >::handler | ( | const std::function< void(osmium::memory::Buffer &&)> & | callback = `nullptr` | ) |

inline

Return reference to second pass handler.

## new_member()

template<typename TManager , bool TNodes, bool TWays, bool TRelations, bool TCheckOrder = true>

bool osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >::new_member | ( | const osmium::Relation & | ,
|  | const osmium::RelationMember & | ,
|  | std::size_t |
| ) |  | const

inline private noexcept

This method is called for every member of every relation that will be kept. It should decide if the member is interesting or not and return true or false to signal that. Only interesting members are later added to the relation.

Overwrite this method in a derived class. In the MultipolygonManager class this is used for instance to only keep members of type way and ignore all others.

## new_relation()

template<typename TManager , bool TNodes, bool TWays, bool TRelations, bool TCheckOrder = true>

bool osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >::new_relation | ( | const osmium::Relation & |  | ) | const

inline private noexcept

This method is called from the first pass handler for every relation in the input, to check whether it should be kept.

Overwrite this method in a derived class to only add relations you are interested in, for instance depending on the type tag. Storing relations takes a lot of memory, so it makes sense to filter this as much as possible.

## node_not_in_any_relation()

template<typename TManager , bool TNodes, bool TWays, bool TRelations, bool TCheckOrder = true>

void osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >::node_not_in_any_relation | ( | const osmium::Node & |  | ) | const

inline private noexcept

This method is called for all nodes that are not a member of any relation.

Overwrite this method in a derived class if you are interested in this.

## relation()

template<typename TManager , bool TNodes, bool TWays, bool TRelations, bool TCheckOrder = true>

void osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >::relation | ( | const osmium::Relation & | relation | ) |

inline

Add the specified relation to the list of relations we want to build. This calls the new_relation() and new_member() functions to actually decide what to keep.

This member function is named relation() so the manager can be used as a handler for the first pass through a data file.

Parameters

  relation | Relation we might want to build.

## relation_not_in_any_relation()

template<typename TManager , bool TNodes, bool TWays, bool TRelations, bool TCheckOrder = true>

void osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >::relation_not_in_any_relation | ( | const osmium::Relation & |  | ) | const

inline private noexcept

This method is called for all relations that are not a member of any relation.

Overwrite this method in a derived class if you are interested in this.

## wanted_type()

template<typename TManager , bool TNodes, bool TWays, bool TRelations, bool TCheckOrder = true>

static bool osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >::wanted_type | ( | osmium::item_type | type | ) |

inline static private noexcept

## way_not_in_any_relation()

template<typename TManager , bool TNodes, bool TWays, bool TRelations, bool TCheckOrder = true>

void osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >::way_not_in_any_relation | ( | const osmium::Way & |  | ) | const

inline private noexcept

This method is called for all ways that are not a member of any relation.

Overwrite this method in a derived class if you are interested in this.

## Member Data Documentation

## m_check_order_handler

template<typename TManager , bool TNodes, bool TWays, bool TRelations, bool TCheckOrder = true>

check_order_handler osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >::m_check_order_handler

private

## m_handler_pass2

template<typename TManager , bool TNodes, bool TWays, bool TRelations, bool TCheckOrder = true>

SecondPassHandler<RelationsManager> osmium::relations::RelationsManager< TManager, TNodes, TWays, TRelations, TCheckOrder >::m_handler_pass2

private

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

- include/osmium/relations/relations_manager.hpp