Added support for dynamic load support for RouterFlexXML. The filter path
[metaproxy-moved-to-github.git] / src / factory_filter.hpp
1 /* $Id: factory_filter.hpp,v 1.3 2006-01-19 09:41:01 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         bool exist(std::string fi);
38     
39         bool add_creator_dl(const std::string &fi, const std::string &path);
40
41         bool have_dl_support();
42
43         class NotFound : public std::runtime_error {
44         public:
45             NotFound(const std::string msg);
46         };
47     private:
48         boost::scoped_ptr<Rep> m_p;
49     };
50 }
51
52 #endif
53 /*
54  * Local variables:
55  * c-basic-offset: 4
56  * indent-tabs-mode: nil
57  * c-file-style: "stroustrup"
58  * End:
59  * vim: shiftwidth=4 tabstop=8 expandtab
60  */