Osmium
0.1
|
#include <byid.hpp>
Public Member Functions | |
SparseTable (const uint64_t grow_size=10000) | |
~SparseTable () | |
void | set (uint64_t id, TValue value) |
Set the field with id to value. | |
const TValue & | operator[] (uint64_t id) const |
Retrieve value by key. Does not check for overflow or empty fields. | |
uint64_t | size () const |
uint64_t | used_memory () const |
void | clear () |
Private Attributes | |
uint64_t | m_grow_size |
google::sparsetable< TValue > | m_items |
The SparseTable store stores items in a Google sparsetable, a data structure that can hold sparsly filled tables in a very space efficient way. It will resize automatically.
Use this node location store if the ID space is only sparsly populated, such as when working with smaller OSM files (like country extracts).
Osmium::Storage::SparseTable< TValue >::SparseTable | ( | const uint64_t | grow_size = 10000 | ) | [inline] |
Constructor.
grow_size | The initial size of the storage (in items). The storage will grow by at least this size every time it runs out of space. |
Osmium::Storage::SparseTable< TValue >::~SparseTable | ( | ) | [inline] |
void Osmium::Storage::SparseTable< TValue >::clear | ( | ) | [inline, virtual] |
Clear memory used for this storage. After this you can not use the storage container any more.
Implements Osmium::Storage::ById< TValue >.
const TValue& Osmium::Storage::SparseTable< TValue >::operator[] | ( | uint64_t | id | ) | const [inline, virtual] |
Retrieve value by key. Does not check for overflow or empty fields.
Implements Osmium::Storage::ById< TValue >.
void Osmium::Storage::SparseTable< TValue >::set | ( | uint64_t | id, |
TValue | value | ||
) | [inline, virtual] |
Set the field with id to value.
Implements Osmium::Storage::ById< TValue >.
uint64_t Osmium::Storage::SparseTable< TValue >::size | ( | ) | const [inline, 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.
Implements Osmium::Storage::ById< TValue >.
uint64_t Osmium::Storage::SparseTable< TValue >::used_memory | ( | ) | const [inline, 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.
Implements Osmium::Storage::ById< TValue >.
uint64_t Osmium::Storage::SparseTable< TValue >::m_grow_size [private] |
google::sparsetable<TValue> Osmium::Storage::SparseTable< TValue >::m_items [private] |