Bump year in copyright msg in source
[metaproxy-moved-to-github.git] / src / factory_filter.hpp
1 /* This file is part of Metaproxy.
2    Copyright (C) 2005-2009 Index Data
3
4 Metaproxy is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
7 version.
8
9 Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12 for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17 */
18
19 #ifndef FACTORY_FILTER_HPP
20 #define FACTORY_FILTER_HPP
21
22 #include <stdexcept>
23 #include <iostream>
24 #include <string>
25 #include <map>
26
27 #include <boost/noncopyable.hpp>
28 #include <boost/scoped_ptr.hpp>
29
30 #include "filter.hpp"
31
32 namespace metaproxy_1 {
33     class FactoryFilter : public boost::noncopyable
34     {
35         typedef metaproxy_1::filter::Base* (*CreateFilterCallback)();
36
37         class Rep;
38     public:
39         /// true if registration ok
40         
41         FactoryFilter();
42         ~FactoryFilter();
43
44         bool add_creator(std::string fi, CreateFilterCallback cfc);
45         
46         bool drop_creator(std::string fi);
47         
48         metaproxy_1::filter::Base* create(std::string fi);
49         bool exist(std::string fi);
50     
51         bool add_creator_dl(const std::string &fi, const std::string &path);
52
53         bool have_dl_support();
54
55         class NotFound : public std::runtime_error {
56         public:
57             NotFound(const std::string msg);
58         };
59     private:
60         boost::scoped_ptr<Rep> m_p;
61     };
62 }
63
64 #endif
65 /*
66  * Local variables:
67  * c-basic-offset: 4
68  * c-file-style: "Stroustrup"
69  * indent-tabs-mode: nil
70  * End:
71  * vim: shiftwidth=4 tabstop=8 expandtab
72  */
73