Libosmium
2.20.0
Fast and flexible C++ library for working with OpenStreetMap data
|
#include <map.hpp>
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 () noexcept=default | |
Map (const Map &)=delete | |
Map & | operator= (const Map &)=delete |
virtual | ~Map () noexcept=default |
virtual void | reserve (const std::size_t) |
virtual void | set (const TId id, const TValue value)=0 |
Set the field with id to value. More... | |
virtual TValue | get (const TId id) const =0 |
virtual TValue | get_noexcept (const TId id) const noexcept=0 |
virtual std::size_t | size () const =0 |
virtual std::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 &&) noexcept=default | |
Map & | operator= (Map &&) noexcept=default |
Private Attributes | |
TId template parameter for class Map must be unsigned integral | type |
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!
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. |
using osmium::index::map::Map< TId, TValue >::key_type = TId |
The "key" type, usually osmium::unsigned_object_id_type.
using osmium::index::map::Map< TId, TValue >::value_type = TValue |
The "value" type, usually a Location or size_t.
|
protecteddefaultnoexcept |
|
defaultnoexcept |
|
delete |
|
virtualdefaultnoexcept |
|
pure virtual |
Clear memory used for this storage. After this you can not use the storage container any more.
Implemented in osmium::index::map::Dummy< TId, TValue >, osmium::index::map::FlexMem< TId, TValue >, and osmium::index::map::SparseMemMap< TId, TValue >.
|
inlinevirtual |
|
inlinevirtual |
Reimplemented in osmium::index::map::SparseMemMap< TId, TValue >.
|
pure virtual |
Retrieve value by id.
id | The id to look for. |
osmium::not_found | if the id could not be found. |
Implemented in osmium::index::map::Dummy< TId, TValue >, osmium::index::map::FlexMem< TId, TValue >, and osmium::index::map::SparseMemMap< TId, TValue >.
|
pure virtualnoexcept |
Retrieve value by id.
id | The id to look for. |
Implemented in osmium::index::map::FlexMem< TId, TValue >, osmium::index::map::SparseMemMap< TId, TValue >, and osmium::index::map::Dummy< TId, TValue >.
|
delete |
|
protecteddefaultnoexcept |
|
inlinevirtual |
|
pure virtual |
Set the field with id to value.
Implemented in osmium::index::map::FlexMem< TId, TValue >, osmium::index::map::SparseMemMap< TId, TValue >, and osmium::index::map::Dummy< TId, TValue >.
|
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::Dummy< TId, TValue >, osmium::index::map::FlexMem< TId, TValue >, and osmium::index::map::SparseMemMap< TId, TValue >.
|
inlinevirtual |
Sort data in map. Call this after writing all data and before reading. Not all implementations need this.
Reimplemented in osmium::index::map::FlexMem< TId, TValue >.
|
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::Dummy< TId, TValue >, osmium::index::map::FlexMem< TId, TValue >, and osmium::index::map::SparseMemMap< TId, TValue >.
|
private |