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

#include <byid.hpp>

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

List of all members.

Public Types

typedef TValue value_type
 The "value" type, usually a coordinates class or similar.

Public Member Functions

virtual ~ById ()
virtual void set (uint64_t id, TValue value)=0
 Set the field with id to value.
virtual const TValue & operator[] (uint64_t id) const =0
 Retrieve value by key. Does not check for overflow or empty fields.
virtual uint64_t size () const =0
virtual uint64_t used_memory () const =0
virtual void clear ()=0

Detailed Description

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

This abstract class defines an interface to storage classes intended for storing small pieces of data (such as coordinates) indexed by a positive object ID. The storage must be very space efficient and able to scale to billions of objects.

Subclasses have different implementations that will 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.


Member Typedef Documentation

template<typename TValue >
typedef TValue Osmium::Storage::ById< TValue >::value_type

The "value" type, usually a coordinates class or similar.


Constructor & Destructor Documentation

template<typename TValue >
virtual Osmium::Storage::ById< TValue >::~ById ( ) [inline, virtual]

Member Function Documentation

template<typename TValue >
virtual void Osmium::Storage::ById< TValue >::clear ( ) [pure virtual]

Clear memory used for this storage. After this you can not use the storage container any more.

Implemented in Osmium::Storage::Mmap< TValue >, Osmium::Storage::SparseTable< TValue >, and Osmium::Storage::FixedArray< TValue >.

template<typename TValue >
virtual const TValue& Osmium::Storage::ById< TValue >::operator[] ( uint64_t  id) const [pure virtual]

Retrieve value by key. Does not check for overflow or empty fields.

Implemented in Osmium::Storage::Mmap< TValue >, Osmium::Storage::SparseTable< TValue >, and Osmium::Storage::FixedArray< TValue >.

template<typename TValue >
virtual void Osmium::Storage::ById< TValue >::set ( uint64_t  id,
TValue  value 
) [pure virtual]
template<typename TValue >
virtual uint64_t Osmium::Storage::ById< 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::Storage::Mmap< TValue >, Osmium::Storage::SparseTable< TValue >, and Osmium::Storage::FixedArray< TValue >.

template<typename TValue >
virtual uint64_t Osmium::Storage::ById< 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::Storage::Mmap< TValue >, Osmium::Storage::SparseTable< TValue >, and Osmium::Storage::FixedArray< TValue >.


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