1 /* $Id: router_chain.cpp,v 1.9 2007-05-09 21:23:09 adam Exp $
2 Copyright (c) 2005-2007, Index Data.
4 This file is part of Metaproxy.
6 Metaproxy is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
11 Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License
17 along with Metaproxy; see the file LICENSE. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #include "router_chain.hpp"
26 namespace mp = metaproxy_1;
32 class RouterChain::Rep {
33 friend class RouterChain;
34 friend class RouterChain::Pos;
35 std::list<const filter::Base *> m_filter_list;
37 class RouterChain::Pos : public RoutePos {
39 virtual const filter::Base *move(const char *route);
40 virtual RoutePos *clone();
42 std::list<const filter::Base *>::const_iterator it;
43 mp::RouterChain::Rep *m_p;
47 mp::RouterChain::RouterChain() : m_p(new mp::RouterChain::Rep)
51 mp::RouterChain::~RouterChain()
55 const mp::filter::Base *mp::RouterChain::Pos::move(const char *route)
57 if (it == m_p->m_filter_list.end())
59 const mp::filter::Base *f = *it;
64 mp::RoutePos *mp::RouterChain::createpos() const
66 mp::RouterChain::Pos *p = new mp::RouterChain::Pos;
67 p->it = m_p->m_filter_list.begin();
72 mp::RoutePos *mp::RouterChain::Pos::clone()
74 mp::RouterChain::Pos *p = new mp::RouterChain::Pos;
81 mp::RouterChain::Pos::~Pos()
85 mp::RouterChain & mp::RouterChain::append(const filter::Base &filter)
87 m_p->m_filter_list.push_back(&filter);
95 * indent-tabs-mode: nil
96 * c-file-style: "stroustrup"
98 * vim: shiftwidth=4 tabstop=8 expandtab