Remove unused code.
[metaproxy-moved-to-github.git] / src / router_chain.cpp
1 /* $Id: router_chain.cpp,v 1.4 2006-01-09 13:53:13 adam Exp $
2    Copyright (c) 2005, Index Data.
3    
4    %LICENSE%
5 */
6
7 #include "router_chain.hpp"
8
9 #include <list>
10
11 namespace yp2 
12 {
13     class ChainPos;
14
15     class RouterChain::Rep {
16         friend class RouterChain;
17         friend class RouterChain::Pos;
18         std::list<const filter::Base *> m_filter_list;
19     };
20     class RouterChain::Pos : public RoutePos {
21     public:
22         virtual const filter::Base *move();
23         virtual RoutePos *clone();
24         virtual ~Pos();
25         std::list<const filter::Base *>::const_iterator it;
26         yp2::RouterChain::Rep *m_p;
27     };
28 }
29
30 yp2::RouterChain::RouterChain() : m_p(new yp2::RouterChain::Rep)
31 {
32 }
33
34 yp2::RouterChain::~RouterChain()
35 {
36 }
37
38 const yp2::filter::Base *yp2::RouterChain::Pos::move()
39 {
40     if (it == m_p->m_filter_list.end())
41         return 0;
42     const yp2::filter::Base *f = *it;
43     it++;
44     return f;
45 }
46
47 yp2::RoutePos *yp2::RouterChain::createpos() const
48 {
49     yp2::RouterChain::Pos *p = new yp2::RouterChain::Pos;
50     p->it = m_p->m_filter_list.begin();
51     p->m_p = m_p.get();
52     return p;
53 }
54
55 yp2::RoutePos *yp2::RouterChain::Pos::clone()
56 {
57     yp2::RouterChain::Pos *p = new yp2::RouterChain::Pos;
58     p->it = it;
59     p->m_p = m_p;
60     return p;
61 }
62
63
64 yp2::RouterChain::Pos::~Pos()
65 {
66 }
67
68 yp2::RouterChain & yp2::RouterChain::append(const filter::Base &filter)
69 {
70     m_p->m_filter_list.push_back(&filter);
71     return *this;
72 }
73
74
75 /*
76  * Local variables:
77  * c-basic-offset: 4
78  * indent-tabs-mode: nil
79  * c-file-style: "stroustrup"
80  * End:
81  * vim: shiftwidth=4 tabstop=8 expandtab
82  */