Libosmium
2.20.0
Fast and flexible C++ library for working with OpenStreetMap data
|
#include <members_database.hpp>
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 |
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.
TObject | The object type stores in the members database. Can be osmium::Node, Way, or Relation. |
|
inline |
Construct a MembersDatabase.
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. |
|
inline |
Add the specified object to the database.
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. |
|
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.
Complexity: Logarithmic in the number of members tracked (as returned by size()).