Osmium  0.1
include/osmium/handler.hpp
Go to the documentation of this file.
00001 #ifndef OSMIUM_HANDLER_HPP
00002 #define OSMIUM_HANDLER_HPP
00003 
00004 /*
00005 
00006 Copyright 2011 Jochen Topf <jochen@topf.org> and others (see README).
00007 
00008 This file is part of Osmium (https://github.com/joto/osmium).
00009 
00010 Osmium is free software: you can redistribute it and/or modify it under the
00011 terms of the GNU Lesser General Public License or (at your option) the GNU
00012 General Public License as published by the Free Software Foundation, either
00013 version 3 of the Licenses, or (at your option) any later version.
00014 
00015 Osmium is distributed in the hope that it will be useful, but WITHOUT ANY
00016 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
00017 PARTICULAR PURPOSE. See the GNU Lesser General Public License and the GNU
00018 General Public License for more details.
00019 
00020 You should have received a copy of the Licenses along with Osmium. If not, see
00021 <http://www.gnu.org/licenses/>.
00022 
00023 */
00024 
00025 #include <boost/utility.hpp>
00026 
00027 #include <osmium/osm/meta.hpp>
00028 #include <osmium/osm/node.hpp>
00029 #include <osmium/osm/way.hpp>
00030 #include <osmium/osm/relation.hpp>
00031 #include <osmium/osm/area.hpp>
00032 
00033 namespace Osmium {
00034 
00041     namespace Handler {
00042 
00051         class Base : boost::noncopyable {
00052 
00053         public:
00054 
00055             Base() {
00056             }
00057 
00058             void init(Osmium::OSM::Meta&) const {
00059             }
00060 
00061             void before_nodes() const {
00062             }
00063 
00064             void node(const shared_ptr<Osmium::OSM::Node const>&) const {
00065             }
00066 
00067             void after_nodes() const {
00068             }
00069 
00070             void before_ways() const {
00071             }
00072 
00073             void way(const shared_ptr<Osmium::OSM::Way const>&) const {
00074             }
00075 
00076             void after_ways() const {
00077             }
00078 
00079             void before_relations() const {
00080             }
00081 
00082             void relation(const shared_ptr<Osmium::OSM::Relation const>&) const {
00083             }
00084 
00085             void after_relations() const {
00086             }
00087 
00088             void area(Osmium::OSM::Area*) const {
00089             }
00090 
00091             void final() const {
00092             }
00093 
00094         }; // class Base
00095 
00101         template <class THandler>
00102         class Forward : public Base {
00103 
00104         public:
00105 
00106             Forward(THandler* handler) : Base(), m_handler(handler) {
00107             }
00108 
00109             void init(Osmium::OSM::Meta& meta) const {
00110                 m_handler->init(meta);
00111             }
00112 
00113             void before_nodes() const {
00114                 m_handler->before_nodes();
00115             }
00116 
00117             void node(const shared_ptr<Osmium::OSM::Node>& node) const {
00118                 m_handler->node(node);
00119             }
00120 
00121             void after_nodes() const {
00122                 m_handler->after_nodes();
00123             }
00124 
00125             void before_ways() const {
00126                 m_handler->before_ways();
00127             }
00128 
00129             void way(const shared_ptr<Osmium::OSM::Way>& way) const {
00130                 m_handler->way(way);
00131             }
00132 
00133             void after_ways() const {
00134                 m_handler->after_ways();
00135             }
00136 
00137             void before_relations() const {
00138                 m_handler->before_relations();
00139             }
00140 
00141             void relation(const shared_ptr<Osmium::OSM::Relation>& relation) const {
00142                 m_handler->relation(relation);
00143             }
00144 
00145             void after_relations() const {
00146                 m_handler->after_relations();
00147             }
00148 
00149             void area(Osmium::OSM::Area* area) const {
00150                 m_handler->area(area);
00151             }
00152 
00153             void final() const {
00154                 m_handler->final();
00155             }
00156 
00157         private:
00158 
00159             THandler* m_handler;
00160 
00161         }; // class Forward
00162 
00163     } // namespace Handler
00164 
00165 } // namespace Osmium
00166 
00167 #endif // OSMIUM_HANDLER_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines