RouterFleXML now stores routes and filters internally.
[metaproxy-moved-to-github.git] / src / factory_filter.hpp
1 /* $Id: factory_filter.hpp,v 1.2 2006-01-05 16:39:37 adam Exp $
2    Copyright (c) 2005, Index Data.
3
4 %LICENSE%
5  */
6
7 #ifndef FACTORY_FILTER_HPP
8 #define FACTORY_FILTER_HPP
9
10 #include <stdexcept>
11 #include <iostream>
12 #include <string>
13 #include <map>
14
15 #include <boost/noncopyable.hpp>
16 #include <boost/scoped_ptr.hpp>
17
18 #include "filter.hpp"
19
20 namespace yp2 {
21     class FactoryFilter : public boost::noncopyable
22     {
23         typedef yp2::filter::Base* (*CreateFilterCallback)();
24
25         class Rep;
26     public:
27         /// true if registration ok
28         
29         FactoryFilter();
30         ~FactoryFilter();
31
32         bool add_creator(std::string fi, CreateFilterCallback cfc);
33         
34         bool drop_creator(std::string fi);
35         
36         yp2::filter::Base* create(std::string fi);
37
38         bool add_creator_dyn(const std::string &fi, const std::string &path);
39
40
41         class NotFound : public std::runtime_error {
42         public:
43             NotFound(const std::string msg);
44         };
45     private:
46         boost::scoped_ptr<Rep> m_p;
47     };
48 }
49
50 #endif
51 /*
52  * Local variables:
53  * c-basic-offset: 4
54  * indent-tabs-mode: nil
55  * c-file-style: "stroustrup"
56  * End:
57  * vim: shiftwidth=4 tabstop=8 expandtab
58  */