Rename yp2::FilterFactory to yp2::FactoryFilter
[metaproxy-moved-to-github.git] / src / factory_filter.hpp
1 /* $Id: factory_filter.hpp,v 1.1 2006-01-04 14:30:51 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 FactoryFilterException : public std::runtime_error {
22     public:
23         FactoryFilterException(const std::string message);
24     };
25     
26     class FactoryFilter : public boost::noncopyable
27     {
28         typedef yp2::filter::Base* (*CreateFilterCallback)();
29
30         class Rep;
31     public:
32         /// true if registration ok
33         
34         FactoryFilter();
35         ~FactoryFilter();
36
37         bool add_creator(std::string fi, CreateFilterCallback cfc);
38         
39         bool drop_creator(std::string fi);
40         
41         yp2::filter::Base* create(std::string fi);
42
43         bool add_creator_dyn(const std::string &fi, const std::string &path);
44     private:
45         boost::scoped_ptr<Rep> m_p;
46     };
47 }
48
49 #endif
50 /*
51  * Local variables:
52  * c-basic-offset: 4
53  * indent-tabs-mode: nil
54  * c-file-style: "stroustrup"
55  * End:
56  * vim: shiftwidth=4 tabstop=8 expandtab
57  */