Libosmium: osmium::relations::MembersDatabase< TObject > Class Template Reference

Libosmium Fast and flexible C++ library for working with OpenStreetMap data

Loading...
Searching...
No Matches
Public Member Functions | List of all members
osmium::relations::MembersDatabase< TObject > Class Template Reference

`#include <members_database.hpp>`

Inheritance diagram for osmium::relations::MembersDatabase< TObject >:
[legend]
Collaboration diagram for osmium::relations::MembersDatabase< TObject >:
[legend]

## Public Member Functions
| MembersDatabase (osmium::ItemStash &stash, osmium::relations::RelationsDatabase &relation_db)
template<typename TFunc>
bool | add (const TObject &object, TFunc &&func)
const TObject * | get (osmium::object_id_type id) const
Public Member Functions inherited from osmium::relations::MembersDatabaseCommon
std::size_t | used_memory () const noexcept
std::size_t | size () const noexcept
counts | count () const noexcept
void | track (RelationHandle &rel_handle, osmium::object_id_type member_id, std::size_t member_num)
void | prepare_for_lookup ()
void | remove (osmium::object_id_type member_id, osmium::object_id_type relation_id)
const osmium::OSMObject * | get_object (osmium::object_id_type id) const

## Additional Inherited Members
Protected Types inherited from osmium::relations::MembersDatabaseCommon
using | iterator = std::vector<element>::iterator
using | const_iterator = std::vector<element>::const_iterator
Protected Member Functions inherited from osmium::relations::MembersDatabaseCommon
iterator_range< iterator > | find (osmium::object_id_type id)
iterator_range< const_iterator > | find (osmium::object_id_type id) const
void | add_object (const osmium::OSMObject &object, iterator_range< iterator > &range)
| MembersDatabaseCommon (osmium::ItemStash &stash, osmium::relations::RelationsDatabase &relations_db)
Static Protected Member Functions inherited from osmium::relations::MembersDatabaseCommon
static std::iterator_traits< iterator >::difference_type | count_not_removed (const iterator_range< iterator > &range) noexcept
Protected Attributes inherited from osmium::relations::MembersDatabaseCommon
osmium::ItemStash & | m_stash
osmium::relations::RelationsDatabase & | m_relations_db
bool | m_init_phase = true

## Detailed Description

template<typename TObject>
class osmium::relations::MembersDatabase< TObject >

A MembersDatabase is used together with a RelationsDatabase to bring a relation and their members together. It tracks all members of a specific type needed to complete a relation.

More documentation is in the MembersDatabaseCommon parent class which contains all the pieces that aren't dependent on the template parameter.

Template Parameters

  TObject | The object type stores in the members database. Can be osmium::Node, Way, or Relation.

## Constructor & Destructor Documentation

## ◆ MembersDatabase()

template<typename TObject>

osmium::relations::MembersDatabase< TObject >::MembersDatabase | ( | osmium::ItemStash & | stash,
|  | osmium::relations::RelationsDatabase & | relation_db )
| inline

Construct a MembersDatabase.

Parameters

  stash | Reference to an ItemStash object. All member objects will be stored in this stash. It must be available until the MembersDatabase is destroyed.
  relation_db | The RelationsDatabase where relations are stored. Usually it will use the same ItemStash as the MembersDatabase.

## Member Function Documentation

## ◆ add()

template<typename TObject>
template<typename TFunc>

bool osmium::relations::MembersDatabase< TObject >::add | ( | const TObject & | object,
|  | TFunc && | func )
| inline

Add the specified object to the database.

Parameters

  object | Object to add.
  func | If the object is the last member to complete a relation, this function is called with the relation as a parameter.

Returns
  true if the object was actually added, false if no relation needed this object.

Precondition
  You have to call prepare_for_lookup() before using this.

## ◆ get()

template<typename TObject>

const TObject * osmium::relations::MembersDatabase< TObject >::get | ( | osmium::object_id_type | id | ) | const
| inline

Find the object with the specified id in the database and return a pointer to it. Returns nullptr if there is no object with that id in the database.

Precondition
  You have to call prepare_for_lookup() before using this.

Complexity: Logarithmic in the number of members tracked (as returned by size()).

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

- include/osmium/relations/members_database.hpp