-/* $Id: filter_factory.hpp,v 1.1 2005-10-28 10:35:30 marc Exp $
+/* $Id: filter_factory.hpp,v 1.6 2005-11-10 23:10:42 adam Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
#include <string>
#include <map>
-#include "config.hpp"
+#include <boost/noncopyable.hpp>
+#include <boost/scoped_ptr.hpp>
+
#include "filter.hpp"
namespace yp2 {
- namespace filter {
- class FilterFactory {
-
-#if 0
- public:
- typedef yp2::filter::Base* (*CreateFilterCallback)();
- /// true if registration ok
- bool register_filter(std::string fi, CreateFilterCallback cfc);
- /// true if unregistration ok
- bool unregister_filter(std::string fi);
- /// factory create method
- yp2::filter::Base* create(std::string fi);
-
- private:
- typedef std::map<std::string, CreateFilterCallback> CallbackMap;
-
-#endif
-
- };
- }
-
class FilterFactoryException : public std::runtime_error {
public:
- FilterFactoryException(const std::string message)
- : std::runtime_error("FilterException: " + message){
- };
+ FilterFactoryException(const std::string message);
};
+
+ class FilterFactory : public boost::noncopyable
+ {
+ typedef yp2::filter::Base* (*CreateFilterCallback)();
+ typedef std::map<std::string, CreateFilterCallback> CallbackMap;
-
+ class Rep;
+ public:
+ /// true if registration ok
+
+ FilterFactory();
+ ~FilterFactory();
+
+ bool add_creator(std::string fi, CreateFilterCallback cfc);
+ /// true if unregistration ok
+
+ bool drop_creator(std::string fi);
+
+ /// factory create method
+
+ yp2::filter::Base* create(std::string fi);
+
+ private:
+ boost::scoped_ptr<Rep> m_p;
+ };
}
#endif