metaproxy 1.22.1
factory_filter.hpp
Go to the documentation of this file.
1/* This file is part of Metaproxy.
2 Copyright (C) Index Data
3
4Metaproxy is free software; you can redistribute it and/or modify it under
5the terms of the GNU General Public License as published by the Free
6Software Foundation; either version 2, or (at your option) any later
7version.
8
9Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
10WARRANTY; without even the implied warranty of MERCHANTABILITY or
11FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program; if not, write to the Free Software
16Foundation, 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 <metaproxy/filter.hpp>
31
32namespace metaproxy_1 {
33 class FactoryFilter : public boost::noncopyable
34 {
35 typedef metaproxy_1::filter::Base* (*CreateFilterCallback)();
36
37 class Rep;
38 public:
40
43
44 bool add_creator(const 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 class NotFound : public std::runtime_error {
54 public:
55 NotFound(const std::string msg);
56 };
57 private:
58 boost::scoped_ptr<Rep> m_p;
59 };
60}
61
62#endif
63/*
64 * Local variables:
65 * c-basic-offset: 4
66 * c-file-style: "Stroustrup"
67 * indent-tabs-mode: nil
68 * End:
69 * vim: shiftwidth=4 tabstop=8 expandtab
70 */
71
metaproxy_1::filter::Base *(* CreateFilterCallback)()
boost::scoped_ptr< Rep > m_p
metaproxy_1::filter::Base * create(std::string fi)
FactoryFilter()
true if registration ok
bool add_creator(const std::string &fi, CreateFilterCallback cfc)
bool add_creator_dl(const std::string &fi, const std::string &path)
bool exist(std::string fi)
bool drop_creator(std::string fi)