Libosmium  2.20.0
Fast and flexible C++ library for working with OpenStreetMap data
Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
osmium::index::multimap::SparseMemMultimap< TId, TValue > Class Template Referencefinal

#include <sparse_mem_multimap.hpp>

Inheritance diagram for osmium::index::multimap::SparseMemMultimap< TId, TValue >:
Inheritance graph
[legend]
Collaboration diagram for osmium::index::multimap::SparseMemMultimap< TId, TValue >:
Collaboration graph
[legend]

Public Types

using collection_type = typename std::multimap< const TId, TValue >
 
using iterator = typename collection_type::iterator
 
using const_iterator = typename collection_type::const_iterator
 
using value_type = typename collection_type::value_type
 
using element_type = typename std::pair< TId, TValue >
 
- Public Types inherited from osmium::index::multimap::Multimap< TId, TValue >
using key_type = TId
 The "key" type, usually osmium::unsigned_object_id_type. More...
 
using value_type = TValue
 The "value" type, usually a Location or size_t. More...
 
using iterator = element_type *
 

Public Member Functions

 SparseMemMultimap ()=default
 
 ~SparseMemMultimap () noexcept=default
 
void unsorted_set (const TId id, const TValue value)
 
void set (const TId id, const TValue value) override
 Set the field with id to value. More...
 
std::pair< iterator, iteratorget_all (const TId id)
 
std::pair< const_iterator, const_iteratorget_all (const TId id) const
 
void remove (const TId id, const TValue value)
 
iterator begin ()
 
iterator end ()
 
size_t size () const override
 
size_t used_memory () const override
 
void clear () override
 
void consolidate ()
 
void dump_as_list (const int fd) override
 
- Public Member Functions inherited from osmium::index::multimap::Multimap< TId, TValue >
 Multimap ()=default
 
 Multimap (const Multimap &)=delete
 
Multimapoperator= (const Multimap &)=delete
 
virtual ~Multimap () noexcept=default
 
virtual void set (const TId id, const TValue value)=0
 Set the field with id to value. More...
 
virtual size_t size () const =0
 
virtual size_t used_memory () const =0
 
virtual void clear ()=0
 
virtual void sort ()
 
virtual void dump_as_list (const int)
 

Private Types

enum  { element_size = sizeof(TId) + sizeof(TValue) + sizeof(void*) * 4U }
 

Private Attributes

collection_type m_elements
 

Additional Inherited Members

- Protected Member Functions inherited from osmium::index::multimap::Multimap< TId, TValue >
 Multimap (Multimap &&) noexcept=default
 
Multimapoperator= (Multimap &&) noexcept=default
 

Detailed Description

template<typename TId, typename TValue>
class osmium::index::multimap::SparseMemMultimap< TId, TValue >

This implementation uses std::multimap internally. It uses rather a lot of memory, but might make sense for small maps.

Member Typedef Documentation

◆ collection_type

template<typename TId , typename TValue >
using osmium::index::multimap::SparseMemMultimap< TId, TValue >::collection_type = typename std::multimap<const TId, TValue>

◆ const_iterator

template<typename TId , typename TValue >
using osmium::index::multimap::SparseMemMultimap< TId, TValue >::const_iterator = typename collection_type::const_iterator

◆ element_type

template<typename TId , typename TValue >
using osmium::index::multimap::SparseMemMultimap< TId, TValue >::element_type = typename std::pair<TId, TValue>

◆ iterator

template<typename TId , typename TValue >
using osmium::index::multimap::SparseMemMultimap< TId, TValue >::iterator = typename collection_type::iterator

◆ value_type

template<typename TId , typename TValue >
using osmium::index::multimap::SparseMemMultimap< TId, TValue >::value_type = typename collection_type::value_type

Member Enumeration Documentation

◆ anonymous enum

template<typename TId , typename TValue >
anonymous enum
private
Enumerator
element_size 

Constructor & Destructor Documentation

◆ SparseMemMultimap()

template<typename TId , typename TValue >
osmium::index::multimap::SparseMemMultimap< TId, TValue >::SparseMemMultimap ( )
default

◆ ~SparseMemMultimap()

template<typename TId , typename TValue >
osmium::index::multimap::SparseMemMultimap< TId, TValue >::~SparseMemMultimap ( )
defaultnoexcept

Member Function Documentation

◆ begin()

template<typename TId , typename TValue >
iterator osmium::index::multimap::SparseMemMultimap< TId, TValue >::begin ( )
inline

◆ clear()

template<typename TId , typename TValue >
void osmium::index::multimap::SparseMemMultimap< TId, TValue >::clear ( )
inlineoverridevirtual

Clear memory used for this storage. After this you can not use the storage container any more.

Implements osmium::index::multimap::Multimap< TId, TValue >.

◆ consolidate()

template<typename TId , typename TValue >
void osmium::index::multimap::SparseMemMultimap< TId, TValue >::consolidate ( )
inline

◆ dump_as_list()

template<typename TId , typename TValue >
void osmium::index::multimap::SparseMemMultimap< TId, TValue >::dump_as_list ( const int  fd)
inlineoverridevirtual

◆ end()

template<typename TId , typename TValue >
iterator osmium::index::multimap::SparseMemMultimap< TId, TValue >::end ( )
inline

◆ get_all() [1/2]

template<typename TId , typename TValue >
std::pair< iterator, iterator > osmium::index::multimap::SparseMemMultimap< TId, TValue >::get_all ( const TId  id)
inline

◆ get_all() [2/2]

template<typename TId , typename TValue >
std::pair< const_iterator, const_iterator > osmium::index::multimap::SparseMemMultimap< TId, TValue >::get_all ( const TId  id) const
inline

◆ remove()

template<typename TId , typename TValue >
void osmium::index::multimap::SparseMemMultimap< TId, TValue >::remove ( const TId  id,
const TValue  value 
)
inline

◆ set()

template<typename TId , typename TValue >
void osmium::index::multimap::SparseMemMultimap< TId, TValue >::set ( const TId  id,
const TValue  value 
)
inlineoverridevirtual

Set the field with id to value.

Implements osmium::index::multimap::Multimap< TId, TValue >.

◆ size()

template<typename TId , typename TValue >
size_t osmium::index::multimap::SparseMemMultimap< TId, TValue >::size ( ) const
inlineoverridevirtual

Get the approximate number of items in the storage. The storage might allocate memory in blocks, so this size might not be accurate. You can not use this to find out how much memory the storage uses. Use used_memory() for that.

Implements osmium::index::multimap::Multimap< TId, TValue >.

◆ unsorted_set()

template<typename TId , typename TValue >
void osmium::index::multimap::SparseMemMultimap< TId, TValue >::unsorted_set ( const TId  id,
const TValue  value 
)
inline

◆ used_memory()

template<typename TId , typename TValue >
size_t osmium::index::multimap::SparseMemMultimap< TId, TValue >::used_memory ( ) const
inlineoverridevirtual

Get the memory used for this storage in bytes. Note that this is not necessarily entirely accurate but an approximation. For storage classes that store the data in memory, this is the main memory used, for storage classes storing data on disk this is the memory used on disk.

Implements osmium::index::multimap::Multimap< TId, TValue >.

Member Data Documentation

◆ m_elements

template<typename TId , typename TValue >
collection_type osmium::index::multimap::SparseMemMultimap< TId, TValue >::m_elements
private

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