Loading...
Searching...
No Matches
osmium::ObjectPointerCollection Class Reference

`#include <object_pointer_collection.hpp>`

Inheritance diagram for osmium::ObjectPointerCollection:
[legend]
Collaboration diagram for osmium::ObjectPointerCollection:
[legend]

## Public Types

using | iterator = indirect_iterator<std::vector<osmium::OSMObject*>::iterator, osmium::OSMObject>
using | const_iterator = indirect_iterator<std::vector<osmium::OSMObject*>::const_iterator, const osmium::OSMObject>
using | ptr_iterator = std::vector<osmium::OSMObject*>::iterator

## Public Member Functions

| ObjectPointerCollection ()=default
void | osm_object (osmium::OSMObject &object)
template<typename TCompare>
void | sort (TCompare &&compare)
template<typename TEqual>
void | unique (TEqual &&equal)
bool | empty () const noexcept
std::size_t | size () const noexcept
void | clear ()
| Clear the collection,.
iterator | begin ()
iterator | end ()
const_iterator | cbegin () const
const_iterator | cend () const
ptr_iterator | ptr_begin () noexcept
| Access to begin of pointer vector.
ptr_iterator | ptr_end () noexcept
| Access to end of pointer vector.
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 Attributes

std::vector< osmium::OSMObject * > | m_objects

## Detailed Description

A collection of pointers to OSM objects. The pointers can be easily and quickly sorted or otherwise manipulated, while the objects themselves or the buffers they are in, do not have to be changed.

An iterator is provided that can iterate over the pointers but looks like it is iterating over the underlying OSM objects.

This class implements the visitor pattern which makes it easy to populate the collection from a buffer of OSM objects:

osmium::ObjectPointerCollection objects; osmium::memory::Buffer buffer = reader.read(); osmium::apply(buffer, objects);

It is not possible to remove pointers from the collection except by clearing the whole collection.

## Member Typedef Documentation

## const_iterator

using osmium::ObjectPointerCollection::const_iterator = indirect_iterator<std::vector<osmium::OSMObject*>::const_iterator, const osmium::OSMObject>

## iterator

using osmium::ObjectPointerCollection::iterator = indirect_iterator<std::vector<osmium::OSMObject*>::iterator, osmium::OSMObject>

## ptr_iterator

using osmium::ObjectPointerCollection::ptr_iterator = std::vector<osmium::OSMObject*>::iterator

## Constructor & Destructor Documentation

## ObjectPointerCollection()

osmium::ObjectPointerCollection::ObjectPointerCollection | ( |  | ) |

default

## Member Function Documentation

## begin()

iterator osmium::ObjectPointerCollection::begin | ( |  | ) |

inline

## cbegin()

const_iterator osmium::ObjectPointerCollection::cbegin | ( |  | ) | const

inline

## cend()

const_iterator osmium::ObjectPointerCollection::cend | ( |  | ) | const

inline

## clear()

void osmium::ObjectPointerCollection::clear | ( |  | ) |

inline

Clear the collection,.

## empty()

bool osmium::ObjectPointerCollection::empty | ( |  | ) | const

inlinenoexcept

Is the collection empty?

Complexity: Constant.

## end()

iterator osmium::ObjectPointerCollection::end | ( |  | ) |

inline

## osm_object()

void osmium::ObjectPointerCollection::osm_object | ( | osmium::OSMObject & | object | ) |

inline

Add a pointer to an object to the collection.

## ptr_begin()

ptr_iterator osmium::ObjectPointerCollection::ptr_begin | ( |  | ) |

inlinenoexcept

Access to begin of pointer vector.

## ptr_end()

ptr_iterator osmium::ObjectPointerCollection::ptr_end | ( |  | ) |

inlinenoexcept

Access to end of pointer vector.

## size()

std::size_t osmium::ObjectPointerCollection::size | ( |  | ) | const

inlinenoexcept

Return size of the collection.

Complexity: Constant.

## sort()

template<typename TCompare>

void osmium::ObjectPointerCollection::sort | ( | TCompare && | compare | ) |

inline

Sort objects according to the specified order functor. This function uses a stable sort.

## unique()

template<typename TEqual>

void osmium::ObjectPointerCollection::unique | ( | TEqual && | equal | ) |

inline

Make objects unique according to the specified equality functor.

Complexity: Linear in the number of items.

## Member Data Documentation

## m_objects

std::vector<osmium::OSMObject*> osmium::ObjectPointerCollection::m_objects

private

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

- include/osmium/object_pointer_collection.hpp