Libosmium  2.9.0
Fast and flexible C++ library for working with OpenStreetMap data
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
osmium::index::map::Map< TId, TValue > Class Template Referenceabstract

#include <map.hpp>

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

Public Types

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...
 

Public Member Functions

 Map ()=default
 
virtual ~Map () noexcept=default
 
virtual void reserve (const size_t)
 
virtual void set (const TId id, const TValue value)=0
 Set the field with id to value. More...
 
virtual const TValue get (const TId id) const =0
 Retrieve value by id. Does not check for overflow or empty fields. 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)
 
virtual void dump_as_array (const int)
 

Protected Member Functions

 Map (Map &&)=default
 
Mapoperator= (Map &&)=default
 

Private Member Functions

 Map (const Map &)=delete
 
Mapoperator= (const Map &)=delete
 

Private Attributes

TId template parameter for
class Map must be unsigned
integral 
type
 

Detailed Description

template<typename TId, typename TValue>
class osmium::index::map::Map< TId, TValue >

This abstract class defines an interface to storage classes intended for storing small pieces of data (such as coordinates) indexed by a positive integer (such as an object ID). The storage must be very space efficient and able to scale to billions of objects.

Subclasses have different implementations that store the data in different ways in memory and/or on disk. Some storage classes are better suited when working with the whole planet, some are better for data extracts.

Note that these classes are not required to track "empty" fields. When reading data you have to be sure you have put something in there before.

A typical use for this and derived classes is storage of node locations indexed by node ID. These indexes will only work on 64 bit systems if used in this case. 32 bit systems just can't address that much memory!

Template Parameters
TIdId type, usually osmium::unsigned_object_id_type, must be an unsigned integral type.
TValueValue type, usually osmium::Location or size_t. Copied by value, so should be "small" type.

Member Typedef Documentation

template<typename TId , typename TValue >
using osmium::index::map::Map< TId, TValue >::key_type = TId

The "key" type, usually osmium::unsigned_object_id_type.

template<typename TId , typename TValue >
using osmium::index::map::Map< TId, TValue >::value_type = TValue

The "value" type, usually a Location or size_t.

Constructor & Destructor Documentation

template<typename TId , typename TValue >
osmium::index::map::Map< TId, TValue >::Map ( const Map< TId, TValue > &  )
privatedelete
template<typename TId , typename TValue >
osmium::index::map::Map< TId, TValue >::Map ( Map< TId, TValue > &&  )
protecteddefault
template<typename TId , typename TValue >
osmium::index::map::Map< TId, TValue >::Map ( )
default
template<typename TId , typename TValue >
virtual osmium::index::map::Map< TId, TValue >::~Map ( )
virtualdefaultnoexcept

Member Function Documentation

template<typename TId , typename TValue >
virtual void osmium::index::map::Map< TId, TValue >::clear ( )
pure virtual

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

Implemented in osmium::index::map::SparseMemMap< TId, TValue >, and osmium::index::map::Dummy< TId, TValue >.

template<typename TId , typename TValue >
virtual void osmium::index::map::Map< TId, TValue >::dump_as_array ( const int  )
inlinevirtual
template<typename TId , typename TValue >
virtual void osmium::index::map::Map< TId, TValue >::dump_as_list ( const int  )
inlinevirtual
template<typename TId , typename TValue >
virtual const TValue osmium::index::map::Map< TId, TValue >::get ( const TId  id) const
pure virtual

Retrieve value by id. Does not check for overflow or empty fields.

Implemented in osmium::index::map::SparseMemMap< TId, TValue >, and osmium::index::map::Dummy< TId, TValue >.

template<typename TId , typename TValue >
Map& osmium::index::map::Map< TId, TValue >::operator= ( const Map< TId, TValue > &  )
privatedelete
template<typename TId , typename TValue >
Map& osmium::index::map::Map< TId, TValue >::operator= ( Map< TId, TValue > &&  )
protecteddefault
template<typename TId , typename TValue >
virtual void osmium::index::map::Map< TId, TValue >::reserve ( const size_t  )
inlinevirtual
template<typename TId , typename TValue >
virtual void osmium::index::map::Map< TId, TValue >::set ( const TId  id,
const TValue  value 
)
pure virtual
template<typename TId , typename TValue >
virtual size_t osmium::index::map::Map< TId, TValue >::size ( ) const
pure virtual

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.

Implemented in osmium::index::map::SparseMemMap< TId, TValue >, and osmium::index::map::Dummy< TId, TValue >.

template<typename TId , typename TValue >
virtual void osmium::index::map::Map< TId, TValue >::sort ( )
inlinevirtual

Sort data in map. Call this after writing all data and before reading. Not all implementations need this.

template<typename TId , typename TValue >
virtual size_t osmium::index::map::Map< TId, TValue >::used_memory ( ) const
pure virtual

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.

Implemented in osmium::index::map::SparseMemMap< TId, TValue >, and osmium::index::map::Dummy< TId, TValue >.

Member Data Documentation

template<typename TId , typename TValue >
TId template parameter for class Map must be unsigned integral osmium::index::map::Map< TId, TValue >::type
private

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