1 /* This file is part of Metaproxy.
2 Copyright (C) 2005-2009 Index Data
4 Metaproxy is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
9 Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #include "router_chain.hpp"
23 namespace mp = metaproxy_1;
29 class RouterChain::Rep {
30 friend class RouterChain;
31 friend class RouterChain::Pos;
32 std::list<const filter::Base *> m_filter_list;
34 class RouterChain::Pos : public RoutePos {
36 virtual const filter::Base *move(const char *route);
37 virtual RoutePos *clone();
39 std::list<const filter::Base *>::const_iterator it;
40 mp::RouterChain::Rep *m_p;
44 mp::RouterChain::RouterChain() : m_p(new mp::RouterChain::Rep)
48 mp::RouterChain::~RouterChain()
52 const mp::filter::Base *mp::RouterChain::Pos::move(const char *route)
54 if (it == m_p->m_filter_list.end())
56 const mp::filter::Base *f = *it;
61 mp::RoutePos *mp::RouterChain::createpos() const
63 mp::RouterChain::Pos *p = new mp::RouterChain::Pos;
64 p->it = m_p->m_filter_list.begin();
69 mp::RoutePos *mp::RouterChain::Pos::clone()
71 mp::RouterChain::Pos *p = new mp::RouterChain::Pos;
78 mp::RouterChain::Pos::~Pos()
82 mp::RouterChain & mp::RouterChain::append(const filter::Base &filter)
84 m_p->m_filter_list.push_back(&filter);
92 * c-file-style: "Stroustrup"
93 * indent-tabs-mode: nil
95 * vim: shiftwidth=4 tabstop=8 expandtab