+
+ }
+
+ bool yp2::filter::FilterFactory::add_creator(std::string fi,
+ CreateFilterCallback cfc)
+ {
+ return m_fcm.insert(CallbackMap::value_type(fi, cfc)).second;
+ }
+
+
+ bool yp2::filter::FilterFactory::drop_creator(std::string fi)
+ {
+ return m_fcm.erase(fi) == 1;
+ }
+
+ yp2::filter::Base* yp2::filter::FilterFactory::create(std::string fi)
+ {
+ CallbackMap::const_iterator i = m_fcm.find(fi);
+
+ if (i == m_fcm.end()){
+ std::string msg = "filter type '" + fi + "' not found";
+ throw yp2::filter::FilterFactoryException(msg);
+ }
+ // call create function
+ return (i->second());