Osmium
0.1
|
#include <objectstore.hpp>
Classes | |
class | ApplyHandler |
Public Member Functions | |
ObjectStore () | |
void | node (const shared_ptr< Osmium::OSM::Node const > &node) |
void | way (const shared_ptr< Osmium::OSM::Way const > &way) |
void | relation (const shared_ptr< Osmium::OSM::Relation const > &relation) |
void | clear_nodes () |
void | clear_ways () |
void | clear_relations () |
void | clear () |
template<class THandler > | |
void | feed_to (THandler *handler, Osmium::OSM::Meta &meta, bool clear=true) |
Private Types | |
typedef std::set< shared_ptr < Osmium::OSM::Node const > > | nodeset |
typedef std::set< shared_ptr < Osmium::OSM::Way const > > | wayset |
typedef std::set< shared_ptr < Osmium::OSM::Relation const > > | relationset |
Private Attributes | |
nodeset | m_nodes |
wayset | m_ways |
relationset | m_relations |
Stores Nodes, Ways, and Relations in main memory. Can store multiple versions of the same object. Storage is ordered by id and version.
The object store uses the handler interface, so storage is simply by calling the node(), way(), and relation() methods like in any other handler.
Note that Osmium OSM objects are rather larger, so this store can use a lot of memory. In many cases you don't need the whole object but only parts of it, so using a more space efficient storage might be possible.
typedef std::set<shared_ptr<Osmium::OSM::Node const> > Osmium::Storage::ObjectStore::nodeset [private] |
typedef std::set<shared_ptr<Osmium::OSM::Relation const> > Osmium::Storage::ObjectStore::relationset [private] |
typedef std::set<shared_ptr<Osmium::OSM::Way const> > Osmium::Storage::ObjectStore::wayset [private] |
Osmium::Storage::ObjectStore::ObjectStore | ( | ) | [inline] |
void Osmium::Storage::ObjectStore::clear | ( | ) | [inline] |
Remove all objects from object store.
void Osmium::Storage::ObjectStore::clear_nodes | ( | ) | [inline] |
Remove all nodes from object store.
void Osmium::Storage::ObjectStore::clear_relations | ( | ) | [inline] |
Remove all relations from object store.
void Osmium::Storage::ObjectStore::clear_ways | ( | ) | [inline] |
Remove all ways from object store.
void Osmium::Storage::ObjectStore::feed_to | ( | THandler * | handler, |
Osmium::OSM::Meta & | meta, | ||
bool | clear = true |
||
) | [inline] |
Feed contents of object store to the given handler. Because objects are stored ordered by id and version, they will be fed to the handler in order.
If clear is set, all nodes/ways/relations are removed from the object store after the after_nodes/ways/relations() call to the handler.
THandler | Handler class. |
handler | Pointer to handler. |
meta | Reference to Osmium::OSM::Meta object which will be given to init() method of handler. |
clear | Should objects be cleared from the object store? Default is true. |
void Osmium::Storage::ObjectStore::node | ( | const shared_ptr< Osmium::OSM::Node const > & | node | ) | [inline] |
Insert shared_ptr of Node into object store.
void Osmium::Storage::ObjectStore::relation | ( | const shared_ptr< Osmium::OSM::Relation const > & | relation | ) | [inline] |
Insert shared_ptr of Relation into object store.
void Osmium::Storage::ObjectStore::way | ( | const shared_ptr< Osmium::OSM::Way const > & | way | ) | [inline] |
Insert shared_ptr of Way into object store.
nodeset Osmium::Storage::ObjectStore::m_nodes [private] |
wayset Osmium::Storage::ObjectStore::m_ways [private] |