Libosmium: osmium::relations::MembersDatabaseCommon Class Reference

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

Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Attributes | List of all members
osmium::relations::MembersDatabaseCommon Class Reference

`#include <members_database.hpp>`

Inheritance diagram for osmium::relations::MembersDatabaseCommon:
[legend]
Collaboration diagram for osmium::relations::MembersDatabaseCommon:
[legend]

## Classes
struct | compare_member_id
struct | counts
struct | element

## Public Member Functions
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

## Protected Types
using | iterator = std::vector<element>::iterator
using | const_iterator = std::vector<element>::const_iterator

## Protected Member Functions
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
static std::iterator_traits< iterator >::difference_type | count_not_removed (const iterator_range< iterator > &range) noexcept

## Protected Attributes
osmium::ItemStash & | m_stash
osmium::relations::RelationsDatabase & | m_relations_db
bool | m_init_phase = true

## Private Attributes
std::vector< element > | m_elements

## Detailed Description

This is the parent class for the MembersDatabase class. All the functionality which doesn't depend on the template parameter used in derived databases is contained in this class.

Usually you want to use the MembersDatabase class only.

## Member Typedef Documentation

## ◆ const_iterator

using osmium::relations::MembersDatabaseCommon::const_iterator = std::vector<element>::const_iterator
| protected

## ◆ iterator

using osmium::relations::MembersDatabaseCommon::iterator = std::vector<element>::iterator
| protected

## Constructor & Destructor Documentation

## ◆ MembersDatabaseCommon()

osmium::relations::MembersDatabaseCommon::MembersDatabaseCommon | ( | osmium::ItemStash & | stash,
|  | osmium::relations::RelationsDatabase & | relations_db )
| inlineprotected

## Member Function Documentation

## ◆ add_object()

void osmium::relations::MembersDatabaseCommon::add_object | ( | const osmium::OSMObject & | object,
|  | iterator_range< iterator > & | range )
| inlineprotected

## ◆ count()

counts osmium::relations::MembersDatabaseCommon::count | ( |  | ) | const
| inlinenoexcept

Counts the number of members in different states. Usually only used for testing and debugging.

Complexity: Linear in the number of members tracked.

## ◆ count_not_removed()

std::iterator_traits< iterator >::difference_type osmium::relations::MembersDatabaseCommon::count_not_removed | ( | const iterator_range< iterator > & | range | ) |
| inlinestaticprotectednoexcept

## ◆ find() [1/2]

iterator_range< iterator > osmium::relations::MembersDatabaseCommon::find | ( | osmium::object_id_type | id | ) |
| inlineprotected

## ◆ find() [2/2]

iterator_range< const_iterator > osmium::relations::MembersDatabaseCommon::find | ( | osmium::object_id_type | id | ) | const
| inlineprotected

## ◆ get_object()

const osmium::OSMObject * osmium::relations::MembersDatabaseCommon::get_object | ( | 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()).

## ◆ prepare_for_lookup()

void osmium::relations::MembersDatabaseCommon::prepare_for_lookup | ( |  | ) |
| inline

Prepare the database for lookup. Call this function after calling track() for all objects needed and before adding the first object with add() or querying the first object with get(). You can only call this function once.

## ◆ remove()

void osmium::relations::MembersDatabaseCommon::remove | ( | osmium::object_id_type | member_id,
|  | osmium::object_id_type | relation_id )
| inline

Remove the entry with the specified member_id and relation_id from the database. If the entry doesn't exist, nothing happens.

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

## ◆ size()

std::size_t osmium::relations::MembersDatabaseCommon::size | ( |  | ) | const
| inlinenoexcept

The number of members tracked in the database. Includes members tracked, but not found yet, members found and members marked as removed.

Complexity: Constant.

## ◆ track()

void osmium::relations::MembersDatabaseCommon::track | ( | RelationHandle & | rel_handle,
|  | osmium::object_id_type | member_id,
|  | std::size_t | member_num )
| inline

Tell the database that you are interested in an object with the specified id and that it is a member of the given relation (as specified through the relation handle).

Parameters

  rel_handle | Relation this object is a member of.
  member_id | Id of an object of type TObject.
  member_num | This is the nth member in the relation.

## ◆ used_memory()

std::size_t osmium::relations::MembersDatabaseCommon::used_memory | ( |  | ) | const
| inlinenoexcept

Return an estimate of the number of bytes currently needed for the MembersDatabase. This does NOT include the memory used in the stash. Used for debugging.

## Member Data Documentation

## ◆ m_elements

std::vector<element> osmium::relations::MembersDatabaseCommon::m_elements
| private

## ◆ m_init_phase

bool osmium::relations::MembersDatabaseCommon::m_init_phase = true
| protected

## ◆ m_relations_db

osmium::relations::RelationsDatabase& osmium::relations::MembersDatabaseCommon::m_relations_db
| protected

## ◆ m_stash

osmium::ItemStash& osmium::relations::MembersDatabaseCommon::m_stash
| protected

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

- include/osmium/relations/members_database.hpp