Make public yp2_filter_struct non-const. If not, the linker symbol
[metaproxy-moved-to-github.git] / src / router.hpp
index b0c238a..28279de 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: router.hpp,v 1.3 2005-10-15 14:09:09 adam Exp $
+/* $Id: router.hpp,v 1.6 2005-11-10 23:10:42 adam Exp $
    Copyright (c) 2005, Index Data.
 
 %LICENSE%
@@ -7,10 +7,12 @@
 #ifndef ROUTER_HPP
 #define ROUTER_HPP
 
+#include <boost/noncopyable.hpp>
+#include <string>
 #include <stdexcept>
-#include <list>
 
-namespace yp2 {
+namespace yp2 
+{
     namespace filter {
         class Base;
     }
@@ -23,76 +25,24 @@ namespace yp2 {
     };
   
     
-    class Router {
+    class Router : boost::noncopyable {
     public:
         Router(){};
         virtual ~Router(){};
 
         /// determines next Filter to use from current Filter and Package
         virtual const filter::Base *move(const filter::Base *filter,
-                                   const Package *package) const {
-            return 0;
-        };
-
+                                         const Package *package) const = 0;
+        
         /// 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;
-        }
-    private:
-        /// disabled because class is singleton
-        Router(const Router &);
-
-        /// disabled because class is singleton
-        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 &);
+        //virtual Router & rule(const filter::Base &filter){
+        //    return *this;
+        //}
     };
-  
-
-  
 }
-
 #endif
 /*
  * Local variables: