From: Adam Dickmeiss Date: Mon, 9 Jan 2006 13:53:13 +0000 (+0000) Subject: Remove unused code. X-Git-Tag: YP2.0.0.2~113 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=b87d59a4add20f61400cfb77a9256dd26c243fb7;p=metaproxy-moved-to-github.git Remove unused code. --- diff --git a/src/package.cpp b/src/package.cpp index 0802e29..165145f 100644 --- a/src/package.cpp +++ b/src/package.cpp @@ -1,4 +1,4 @@ -/* $Id: package.cpp,v 1.4 2006-01-09 13:43:59 adam Exp $ +/* $Id: package.cpp,v 1.5 2006-01-09 13:53:13 adam Exp $ Copyright (c) 2005, Index Data. %LICENSE% @@ -9,60 +9,36 @@ #include "package.hpp" yp2::Package::Package() - : -#if ROUTE_POS - m_route_pos(0), -#else - m_filter(0), m_router(0), -#endif - m_data(0) + : m_route_pos(0), m_data(0) { } yp2::Package::~Package() { -#if ROUTE_POS delete m_route_pos; -#endif } yp2::Package::Package(yp2::Session &session, yp2::Origin &origin) : m_session(session), m_origin(origin), -#if ROUTE_POS - m_route_pos(0), -#else - m_filter(0), m_router(0), -#endif - m_data(0) + m_route_pos(0), m_data(0) { } yp2::Package & yp2::Package::copy_filter(const Package &p) { -#if ROUTE_POS m_route_pos = p.m_route_pos->clone(); -#else - m_router = p.m_router; - m_filter = p.m_filter; -#endif return *this; } void yp2::Package::move() { -#if ROUTE_POS if (m_route_pos) { const filter::Base *next_filter = m_route_pos->move(); if (next_filter) next_filter->process(*this); } -#else - m_filter = m_router->move(m_filter, this); - if (m_filter) - m_filter->process(*this); -#endif } yp2::Session & yp2::Package::session() @@ -105,12 +81,7 @@ yp2::Package & yp2::Package::origin(const Origin & origin) yp2::Package & yp2::Package::router(const yp2::Router &router) { -#if ROUTE_POS m_route_pos = router.createpos(); -#else - m_filter = 0; - m_router = &router; -#endif return *this; } diff --git a/src/package.hpp b/src/package.hpp index d03b53b..85bcb45 100644 --- a/src/package.hpp +++ b/src/package.hpp @@ -1,4 +1,4 @@ -/* $Id: package.hpp,v 1.12 2006-01-09 13:43:59 adam Exp $ +/* $Id: package.hpp,v 1.13 2006-01-09 13:53:13 adam Exp $ Copyright (c) 2005, Index Data. %LICENSE% @@ -76,12 +76,8 @@ namespace yp2 { Session m_session; Origin m_origin; -#if ROUTE_POS RoutePos *m_route_pos; -#else - const filter::Base *m_filter; - const Router *m_router; -#endif + int m_data; yazpp_1::GDU m_request_gdu; diff --git a/src/router.hpp b/src/router.hpp index 480fe1f..72ee73e 100644 --- a/src/router.hpp +++ b/src/router.hpp @@ -1,4 +1,4 @@ -/* $Id: router.hpp,v 1.8 2006-01-09 13:43:59 adam Exp $ +/* $Id: router.hpp,v 1.9 2006-01-09 13:53:13 adam Exp $ Copyright (c) 2005, Index Data. %LICENSE% @@ -11,18 +11,12 @@ #include #include -#define ROUTE_POS 1 - namespace yp2 { namespace filter { class Base; } -#if ROUTE_POS class RoutePos; -#else - class Package; -#endif class RouterException : public std::runtime_error { public: @@ -35,25 +29,15 @@ namespace yp2 Router(){}; virtual ~Router(){}; -#if ROUTE_POS virtual RoutePos *createpos() const = 0; -#else - /// determines next Filter to use from current Filter and Package - virtual const filter::Base *move(const filter::Base *filter, - const Package *package) const = 0; -#endif }; - -#if ROUTE_POS - class RoutePos { + class RoutePos : boost::noncopyable { public: virtual const filter::Base *move() = 0; virtual RoutePos *clone() = 0; virtual ~RoutePos() {}; }; -#endif - } #endif /* diff --git a/src/router_chain.cpp b/src/router_chain.cpp index cf49544..7d7e779 100644 --- a/src/router_chain.cpp +++ b/src/router_chain.cpp @@ -1,4 +1,4 @@ -/* $Id: router_chain.cpp,v 1.3 2006-01-09 13:43:59 adam Exp $ +/* $Id: router_chain.cpp,v 1.4 2006-01-09 13:53:13 adam Exp $ Copyright (c) 2005, Index Data. %LICENSE% @@ -17,8 +17,6 @@ namespace yp2 friend class RouterChain::Pos; std::list m_filter_list; }; - -#if ROUTE_POS class RouterChain::Pos : public RoutePos { public: virtual const filter::Base *move(); @@ -27,8 +25,7 @@ namespace yp2 std::list::const_iterator it; yp2::RouterChain::Rep *m_p; }; -#endif -}; +} yp2::RouterChain::RouterChain() : m_p(new yp2::RouterChain::Rep) { @@ -38,7 +35,6 @@ yp2::RouterChain::~RouterChain() { } -#if ROUTE_POS const yp2::filter::Base *yp2::RouterChain::Pos::move() { if (it == m_p->m_filter_list.end()) @@ -68,28 +64,6 @@ yp2::RoutePos *yp2::RouterChain::Pos::clone() yp2::RouterChain::Pos::~Pos() { } -#else -const yp2::filter::Base *yp2::RouterChain::move(const filter::Base *filter, - const Package *package) const { - std::list::const_iterator it; - it = m_p->m_filter_list.begin(); - if (filter) - { - for (; it != m_p->m_filter_list.end(); it++) - if (*it == filter) - { - it++; - break; - } - } - if (it == m_p->m_filter_list.end()) - { - //throw RouterException("no routing rules known"); - return 0; - } - return *it; -} -#endif yp2::RouterChain & yp2::RouterChain::append(const filter::Base &filter) { diff --git a/src/router_chain.hpp b/src/router_chain.hpp index a59afde..a05eb37 100644 --- a/src/router_chain.hpp +++ b/src/router_chain.hpp @@ -1,4 +1,4 @@ -/* $Id: router_chain.hpp,v 1.4 2006-01-09 13:43:59 adam Exp $ +/* $Id: router_chain.hpp,v 1.5 2006-01-09 13:53:13 adam Exp $ Copyright (c) 2005, Index Data. %LICENSE% @@ -20,12 +20,7 @@ namespace yp2 { public: RouterChain(); virtual ~RouterChain(); -#if ROUTE_POS virtual RoutePos *createpos() const; -#else - virtual const filter::Base *move(const filter::Base *filter, - const Package *package) const; -#endif RouterChain & append(const filter::Base &filter); private: boost::scoped_ptr m_p; diff --git a/src/router_flexml.cpp b/src/router_flexml.cpp index 09c24fa..e24fa19 100644 --- a/src/router_flexml.cpp +++ b/src/router_flexml.cpp @@ -1,4 +1,4 @@ -/* $Id: router_flexml.cpp,v 1.11 2006-01-09 13:43:59 adam Exp $ +/* $Id: router_flexml.cpp,v 1.12 2006-01-09 13:53:13 adam Exp $ Copyright (c) 2005, Index Data. %LICENSE% @@ -45,13 +45,6 @@ namespace yp2 { std::string m_start_route; -#if ROUTE_POS -#else - std::map::iterator m_cur_route_it; - - std::list >::iterator m_cur_filter_it; -#endif void parse_xml_config_dom(xmlDocPtr doc); bool check_element_yp2(const xmlNode *ptr, @@ -70,7 +63,6 @@ namespace yp2 { FactoryFilter *m_factory; // TODO shared_ptr }; -#if ROUTE_POS class RouterFleXML::Pos : public RoutePos { public: virtual const filter::Base *move(); @@ -82,7 +74,6 @@ namespace yp2 { RouterFleXML::Route>::iterator m_route_it; std::list >::iterator m_filter_it; }; -#endif } const xmlNode* yp2::RouterFleXML::Rep::jump_to_children(const xmlNode* node, @@ -332,7 +323,6 @@ yp2::RouterFleXML::~RouterFleXML() { } -#if ROUTE_POS const yp2::filter::Base *yp2::RouterFleXML::Pos::move() { if (m_filter_it == m_route_it->second.m_list.end()) @@ -370,42 +360,6 @@ yp2::RouterFleXML::Pos::~Pos() { } -#else -const yp2::filter::Base * -yp2::RouterFleXML::move(const yp2::filter::Base *filter, - const yp2::Package *package) const -{ - if (!filter) - { // Initial move. find start route - m_p->m_cur_route_it = m_p->m_routes.find("start"); - if (m_p->m_cur_route_it == m_p->m_routes.end()) - return 0; - m_p->m_cur_filter_it = m_p->m_cur_route_it->second.m_list.begin(); - } - else - { - const yp2::filter::Base *f = (*m_p->m_cur_filter_it).get(); - if (f != filter) - (m_p->m_cur_filter_it)++; - else - { - // TOTO: should search all routes (not only start)! - m_p->m_cur_filter_it = m_p->m_cur_route_it->second.m_list.begin(); - while (m_p->m_cur_filter_it != - m_p->m_cur_route_it->second.m_list.end()) - { - const yp2::filter::Base *f = (*m_p->m_cur_filter_it).get(); - (m_p->m_cur_filter_it)++; - if (filter == f) - break; - } - } - } - if (m_p->m_cur_filter_it == m_p->m_cur_route_it->second.m_list.end()) - return 0; - return (*m_p->m_cur_filter_it).get(); -} -#endif /* * Local variables: diff --git a/src/router_flexml.hpp b/src/router_flexml.hpp index d040664..aa68125 100644 --- a/src/router_flexml.hpp +++ b/src/router_flexml.hpp @@ -1,4 +1,4 @@ -/* $Id: router_flexml.hpp,v 1.11 2006-01-09 13:43:59 adam Exp $ +/* $Id: router_flexml.hpp,v 1.12 2006-01-09 13:53:13 adam Exp $ Copyright (c) 2005, Index Data. %LICENSE% @@ -25,13 +25,7 @@ namespace yp2 ~RouterFleXML(); -#if ROUTE_POS virtual RoutePos *createpos() const; -#else - /// determines next Filter to use from current Filter and Package - virtual const filter::Base *move(const filter::Base *filter, - const Package *package) const; -#endif class XMLError : public std::runtime_error { public: XMLError(const std::string msg) :