osmium::index::map::Map< TId, TValue > Class Template Referenceabstract

`#include <map.hpp>`

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

## Public Types

typedef TId | key_type
| The "key" type, usually osmium::unsigned_object_id_type. More...
typedef TValue | value_type
| 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
Map & | operator= (Map &&)=default

## Private Member Functions

| Map (const Map &)=delete
Map & | operator= (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

  TId | Id type, usually osmium::unsigned_object_id_type, must be an unsigned integral type.
  TValue | Value type, usually osmium::Location or size_t. Copied by value, so should be "small" type.

## Member Typedef Documentation

template<typename TId , typename TValue >

typedef TId osmium::index::map::Map< TId, TValue >::key_type

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

template<typename TId , typename TValue >

typedef TValue osmium::index::map::Map< TId, TValue >::value_type

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 > & |  | ) |

private delete

template<typename TId , typename TValue >

osmium::index::map::Map< TId, TValue >::Map | ( | Map< TId, TValue > && |  | ) |

protected default

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 | ( |  | ) |

virtual default noexcept

## 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 |  | ) |

inline virtual

template<typename TId , typename TValue >

virtual void osmium::index::map::Map< TId, TValue >::dump_as_list | ( | const int |  | ) |

inline virtual

Reimplemented in osmium::index::map::SparseMemMap< TId, TValue >.

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 > & |  | ) |

private delete

template<typename TId , typename TValue >

Map& osmium::index::map::Map< TId, TValue >::operator= | ( | Map< TId, TValue > && |  | ) |

protected default

template<typename TId , typename TValue >

virtual void osmium::index::map::Map< TId, TValue >::reserve | ( | const size_t |  | ) |

inline virtual

template<typename TId , typename TValue >

virtual void osmium::index::map::Map< TId, TValue >::set | ( | const TId | id,
|  | const TValue | value
| ) |  |

pure virtual

Set the field with id to value.

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

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 | ( |  | ) |

inline virtual

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:

- osmium/index/map.hpp