1#ifndef OSMIUM_INDEX_MAP_SPARSE_MEM_MAP_HPP
2#define OSMIUM_INDEX_MAP_SPARSE_MEM_MAP_HPP
38#include <osmium/io/detail/read_write.hpp>
46#define OSMIUM_HAS_INDEX_MAP_SPARSE_MEM_MAP
58 template <
typename TId,
typename TValue>
66 element_size =
sizeof(TId) +
sizeof(TValue) +
sizeof(
void*) * 4U
75 void set(
const TId
id,
const TValue value)
final {
79 TValue
get(
const TId
id)
const final {
90 return osmium::index::empty_value<TValue>();
95 size_t size() const noexcept final {
108 using t =
typename std::map<TId, TValue>::value_type;
112 osmium::io::detail::reliable_write(fd,
reinterpret_cast<const char*
>(v.data()),
sizeof(t) * v.size());
123#ifdef OSMIUM_WANT_NODE_LOCATION_MAPS
Definition: location.hpp:271
Definition: sparse_mem_map.hpp:59
@ element_size
Definition: sparse_mem_map.hpp:66
TValue get(const TId id) const final
Definition: sparse_mem_map.hpp:79
size_t used_memory() const noexcept final
Definition: sparse_mem_map.hpp:99
TValue get_noexcept(const TId id) const noexcept final
Definition: sparse_mem_map.hpp:87
void dump_as_list(const int fd) final
Definition: sparse_mem_map.hpp:107
void set(const TId id, const TValue value) final
Set the field with id to value.
Definition: sparse_mem_map.hpp:75
void clear() final
Definition: sparse_mem_map.hpp:103
size_t size() const noexcept final
Definition: sparse_mem_map.hpp:95
std::map< TId, TValue > m_elements
Definition: sparse_mem_map.hpp:69
#define REGISTER_MAP(id, value, klass, name)
Definition: map.hpp:287
Namespace for everything in the Osmium library.
Definition: assembler.hpp:53
uint64_t unsigned_object_id_type
Type for OSM object (node, way, or relation) IDs where we only allow positive IDs.
Definition: types.hpp:46