Osmium
0.1
|
#include <byid.hpp>
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 |
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.
typedef TValue Osmium::Storage::ById< TValue >::value_type |
The "value" type, usually a coordinates class or similar.
virtual Osmium::Storage::ById< TValue >::~ById | ( | ) | [inline, virtual] |
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 >.
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 >.
virtual void Osmium::Storage::ById< TValue >::set | ( | uint64_t | id, |
TValue | value | ||
) | [pure virtual] |
Set the field with id to value.
Implemented in Osmium::Storage::Mmap< TValue >, Osmium::Storage::SparseTable< TValue >, and Osmium::Storage::FixedArray< 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 >.
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 >.