Osmium  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Private Attributes
Osmium::Storage::SparseTable< TValue > Class Template Reference

#include <byid.hpp>

Inheritance diagram for Osmium::Storage::SparseTable< TValue >:
Inheritance graph
[legend]
Collaboration diagram for Osmium::Storage::SparseTable< TValue >:
Collaboration graph
[legend]

List of all members.

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

Detailed Description

template<typename TValue>
class Osmium::Storage::SparseTable< TValue >

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


Constructor & Destructor Documentation

template<typename TValue >
Osmium::Storage::SparseTable< TValue >::SparseTable ( const uint64_t  grow_size = 10000) [inline]

Constructor.

Parameters:
grow_sizeThe initial size of the storage (in items). The storage will grow by at least this size every time it runs out of space.
template<typename TValue >
Osmium::Storage::SparseTable< TValue >::~SparseTable ( ) [inline]

Member Function Documentation

template<typename TValue >
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 >.

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

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

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

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


Member Data Documentation

template<typename TValue >
uint64_t Osmium::Storage::SparseTable< TValue >::m_grow_size [private]
template<typename TValue >
google::sparsetable<TValue> Osmium::Storage::SparseTable< TValue >::m_items [private]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines