Osmium  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
Osmium::Input::Base< THandler > Class Template Reference

#include <input.hpp>

Inheritance diagram for Osmium::Input::Base< THandler >:
Inheritance graph
[legend]
Collaboration diagram for Osmium::Input::Base< THandler >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual ~Base ()
virtual void parse ()=0

Protected Member Functions

 Base (Osmium::OSMFile &file, THandler &handler)
void call_after_and_before_on_handler (osm_object_type_t current_object_type)
void call_node_on_handler () const
void call_way_on_handler () const
void call_relation_on_handler () const
void call_final_on_handler () const
Osmium::OSM::Metameta ()
int get_fd () const
const Osmium::OSMFileget_file () const
Osmium::OSM::Nodeprepare_node ()
Osmium::OSM::Wayprepare_way ()
Osmium::OSM::Relationprepare_relation ()

Protected Attributes

shared_ptr< Osmium::OSM::Nodem_node
shared_ptr< Osmium::OSM::Waym_way
shared_ptr< Osmium::OSM::Relationm_relation

Private Attributes

osm_object_type_t m_last_object_type
Osmium::OSMFile m_file
THandler & m_handler
Osmium::OSM::Meta m_meta

Detailed Description

template<class THandler>
class Osmium::Input::Base< THandler >

Virtual base class for all input classes.

The THandler template parameter of this class (and child classes) names a policy class on which methods will be called. The class should implement one or more of the following functions:

init() will be called before all others, final() after all others.

For every object node(), way(), or relation() will be called, respectively.

When there are several objects of the same type in a row the before_*() function will be called before them and the after_*() function after them. If your input file is sorted as OSM files normally are, i.e. all nodes, then all ways, then all relations, this will call before_nodes() once, then for all the nodes node(), then after_nodes(), then before_ways(), and so on. This will also work properly if the input file contains, say, first all relations, than all ways and then all nodes.

But if you have nodes, ways, and relations intermixed in an input file these handlers will probably not called in a useful way for you. You can use osmosis --sort to sort your input file first.

The method area() is special. It will only be called if you have the multipolygon handler before your handler. There are no before/after_areas() methods. Use init() and final() instead.


Constructor & Destructor Documentation

template<class THandler>
virtual Osmium::Input::Base< THandler >::~Base ( ) [inline, virtual]
template<class THandler>
Osmium::Input::Base< THandler >::Base ( Osmium::OSMFile file,
THandler &  handler 
) [inline, protected]

Member Function Documentation

template<class THandler>
void Osmium::Input::Base< THandler >::call_after_and_before_on_handler ( osm_object_type_t  current_object_type) [inline, protected]
template<class THandler>
void Osmium::Input::Base< THandler >::call_final_on_handler ( ) const [inline, protected]
template<class THandler>
void Osmium::Input::Base< THandler >::call_node_on_handler ( ) const [inline, protected]
template<class THandler>
void Osmium::Input::Base< THandler >::call_relation_on_handler ( ) const [inline, protected]
template<class THandler>
void Osmium::Input::Base< THandler >::call_way_on_handler ( ) const [inline, protected]
template<class THandler>
int Osmium::Input::Base< THandler >::get_fd ( ) const [inline, protected]
template<class THandler>
const Osmium::OSMFile& Osmium::Input::Base< THandler >::get_file ( ) const [inline, protected]
template<class THandler>
Osmium::OSM::Meta& Osmium::Input::Base< THandler >::meta ( ) [inline, protected]
template<class THandler>
virtual void Osmium::Input::Base< THandler >::parse ( ) [pure virtual]

Parse an OSM input file. This is a pure virtual function, it must be overwritten in a child class of Osmium::Input::Base.

Implemented in Osmium::Input::PBF< THandler >, and Osmium::Input::XML< THandler >.

template<class THandler>
Osmium::OSM::Node& Osmium::Input::Base< THandler >::prepare_node ( ) [inline, protected]
template<class THandler>
Osmium::OSM::Relation& Osmium::Input::Base< THandler >::prepare_relation ( ) [inline, protected]
template<class THandler>
Osmium::OSM::Way& Osmium::Input::Base< THandler >::prepare_way ( ) [inline, protected]

Member Data Documentation

template<class THandler>
Osmium::OSMFile Osmium::Input::Base< THandler >::m_file [private]

The OSMFile we opened this file with.

template<class THandler>
THandler& Osmium::Input::Base< THandler >::m_handler [private]

Handler we will call callbacks on.

template<class THandler>
osm_object_type_t Osmium::Input::Base< THandler >::m_last_object_type [private]

The last object type we read (before the current one). Used to properly call before and after methods.

template<class THandler>
Osmium::OSM::Meta Osmium::Input::Base< THandler >::m_meta [private]
template<class THandler>
shared_ptr<Osmium::OSM::Node> Osmium::Input::Base< THandler >::m_node [protected]
template<class THandler>
shared_ptr<Osmium::OSM::Relation> Osmium::Input::Base< THandler >::m_relation [protected]
template<class THandler>
shared_ptr<Osmium::OSM::Way> Osmium::Input::Base< THandler >::m_way [protected]

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