-## $Id: Makefile.am,v 1.25 2005-10-25 21:32:01 adam Exp $
+## $Id: Makefile.am,v 1.26 2005-10-26 10:21:03 marc Exp $
MAINTAINERCLEANFILES = Makefile.in config.in config.hpp
libyp2_la_LDFLAGS = -version-info 0:0:0
libyp2_la_SOURCES = \
- session.cpp session.hpp package.hpp filter.hpp router.hpp \
+ session.cpp session.hpp package.hpp filter.hpp\
+ router.hpp router_chain.hpp \
thread_pool_observer.cpp thread_pool_observer.hpp \
filter_frontend_net.cpp filter_frontend_net.hpp \
filter_log.cpp filter_log.hpp \
-/* $Id: ex_filter_frontend_net.cpp,v 1.11 2005-10-25 22:44:39 adam Exp $
+/* $Id: ex_filter_frontend_net.cpp,v 1.12 2005-10-26 10:21:03 marc Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
#include "filter_virt_db.hpp"
#include "filter_log.hpp"
-#include "router.hpp"
+#include "router_chain.hpp"
#include "session.hpp"
#include "package.hpp"
-/* $Id: router.hpp,v 1.3 2005-10-15 14:09:09 adam Exp $
+/* $Id: router.hpp,v 1.4 2005-10-26 10:21:03 marc Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
};
/// re-read configuration of routing tables
- virtual void configure(){};
+ //virtual void configure(){};
/// add routing rule expressed as Filter to Router
- virtual Router & rule(const filter::Base &filter){
- return *this;
- }
+ //virtual Router & rule(const filter::Base &filter){
+ // return *this;
+ //}
private:
/// disabled because class is singleton
Router(const Router &);
Router& operator=(const Router &);
};
-
- class RouterChain : public Router {
- public:
- RouterChain(){};
- virtual ~RouterChain(){};
- virtual const filter::Base *move(const filter::Base *filter,
- const Package *package) const {
- std::list<const filter::Base *>::const_iterator it;
- it = m_filter_list.begin();
- if (filter)
- {
- for (; it != m_filter_list.end(); it++)
- if (*it == filter)
- {
- it++;
- break;
- }
- }
- if (it == m_filter_list.end())
- {
- //throw RouterException("no routing rules known");
- return 0;
- }
- return *it;
- };
- virtual void configure(){};
- RouterChain & rule(const filter::Base &filter){
- m_filter_list.push_back(&filter);
- return *this;
- }
- protected:
- std::list<const filter::Base *> m_filter_list;
- private:
- /// disabled because class is singleton
- RouterChain(const RouterChain &);
-
- /// disabled because class is singleton
- RouterChain& operator=(const RouterChain &);
- };
-
-
+
}
--- /dev/null
+/* $Id: router_chain.hpp,v 1.1 2005-10-26 10:21:03 marc Exp $
+ Copyright (c) 2005, Index Data.
+
+%LICENSE%
+ */
+
+#ifndef ROUTER_CHAIN_HPP
+#define ROUTER_CHAIN_HPP
+
+#include <stdexcept>
+#include <list>
+
+#include "router.hpp"
+
+
+namespace yp2 {
+ namespace filter {
+ class Base;
+ }
+ class Package;
+
+
+ class RouterChain : public Router {
+ public:
+ RouterChain(){};
+ virtual ~RouterChain(){};
+ virtual const filter::Base *move(const filter::Base *filter,
+ const Package *package) const {
+ std::list<const filter::Base *>::const_iterator it;
+ it = m_filter_list.begin();
+ if (filter)
+ {
+ for (; it != m_filter_list.end(); it++)
+ if (*it == filter)
+ {
+ it++;
+ break;
+ }
+ }
+ if (it == m_filter_list.end())
+ {
+ //throw RouterException("no routing rules known");
+ return 0;
+ }
+ return *it;
+ };
+ virtual void configure(){};
+ RouterChain & rule(const filter::Base &filter){
+ m_filter_list.push_back(&filter);
+ return *this;
+ }
+ protected:
+ std::list<const filter::Base *> m_filter_list;
+ private:
+ /// disabled because class is singleton
+ RouterChain(const RouterChain &);
+
+ /// disabled because class is singleton
+ RouterChain& operator=(const RouterChain &);
+ };
+
+
+
+}
+
+#endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * c-file-style: "stroustrup"
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
-/* $Id: test_filter2.cpp,v 1.11 2005-10-24 10:16:33 adam Exp $
+/* $Id: test_filter2.cpp,v 1.12 2005-10-26 10:21:03 marc Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
#include "config.hpp"
#include "filter.hpp"
-#include "router.hpp"
+#include "router_chain.hpp"
#include "package.hpp"
#include <iostream>
-/* $Id: test_filter_backend_test.cpp,v 1.1 2005-10-25 21:32:28 adam Exp $
+/* $Id: test_filter_backend_test.cpp,v 1.2 2005-10-26 10:21:03 marc Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
#include "filter_backend_test.hpp"
#include "filter_log.hpp"
-#include "router.hpp"
+#include "router_chain.hpp"
#include "session.hpp"
#include "package.hpp"
-/* $Id: test_filter_frontend_net.cpp,v 1.8 2005-10-16 16:05:44 adam Exp $
+/* $Id: test_filter_frontend_net.cpp,v 1.9 2005-10-26 10:21:03 marc Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
#include "filter_frontend_net.hpp"
-#include "router.hpp"
+#include "router_chain.hpp"
#include "session.hpp"
#include "package.hpp"
-/* $Id: test_filter_log.cpp,v 1.2 2005-10-25 11:48:30 adam Exp $
+/* $Id: test_filter_log.cpp,v 1.3 2005-10-26 10:21:03 marc Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
#include "filter_log.hpp"
-#include "router.hpp"
+#include "router_chain.hpp"
#include "session.hpp"
#include "package.hpp"
-/* $Id: test_filter_virt_db.cpp,v 1.4 2005-10-25 21:32:01 adam Exp $
+/* $Id: test_filter_virt_db.cpp,v 1.5 2005-10-26 10:21:03 marc Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
#include "filter_backend_test.hpp"
#include "filter_log.hpp"
-#include "router.hpp"
+#include "router_chain.hpp"
#include "session.hpp"
#include "package.hpp"
-/* $Id: test_filter_z3950_client.cpp,v 1.3 2005-10-24 14:33:30 adam Exp $
+/* $Id: test_filter_z3950_client.cpp,v 1.4 2005-10-26 10:21:03 marc Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
#include "filter_z3950_client.hpp"
-#include "router.hpp"
+#include "router_chain.hpp"
#include "session.hpp"
#include "package.hpp"