-## $Id: Makefile.am,v 1.29 2005-10-26 18:53:49 adam Exp $
+## $Id: Makefile.am,v 1.30 2005-10-28 10:35:30 marc Exp $
MAINTAINERCLEANFILES = Makefile.in config.in config.hpp
router.hpp router_chain.hpp router_chain.cpp \
router_flexml.hpp router_flexml.cpp \
thread_pool_observer.cpp thread_pool_observer.hpp \
+ filter_factory.hpp \
filter_frontend_net.cpp filter_frontend_net.hpp \
filter_log.cpp filter_log.hpp \
filter_virt_db.cpp filter_virt_db.hpp \
test_session1 test_session2 \
test_thread_pool_observer \
test_boost_threads test_boost_time \
+ test_filter_factory \
test_filter_frontend_net \
test_filter_log \
test_filter_z3950_client \
test_boost_threads_SOURCES=test_boost_threads.cpp
test_boost_time_SOURCES=test_boost_time.cpp
test_thread_pool_observer_SOURCES = test_thread_pool_observer.cpp
+test_filter_factory_SOURCES = test_filter_factory.cpp
test_filter_frontend_net_SOURCES = test_filter_frontend_net.cpp
test_filter_log_SOURCES = test_filter_log.cpp
test_filter_z3950_client_SOURCES = test_filter_z3950_client.cpp
test_boost_time_LDADD = $(TESTLDADD)
test_thread_pool_observer_LDADD = $(TESTLDADD)
test_package1_LDADD = $(TESTLDADD)
+test_filter_factory_LDADD = $(TESTLDADD)
test_filter_frontend_net_LDADD = $(TESTLDADD)
test_filter_log_LDADD = $(TESTLDADD)
test_filter_z3950_client_LDADD = $(TESTLDADD)
--- /dev/null
+/* $Id: filter_factory.hpp,v 1.1 2005-10-28 10:35:30 marc Exp $
+ Copyright (c) 2005, Index Data.
+
+%LICENSE%
+ */
+
+#ifndef FILTER_FACTORY_HPP
+#define FILTER_FACTORY_HPP
+
+#include <stdexcept>
+#include <iostream>
+#include <string>
+#include <map>
+
+#include "config.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){
+ };
+ };
+
+
+}
+
+#endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * c-file-style: "stroustrup"
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
-/* $Id: router_flexml.hpp,v 1.3 2005-10-27 11:36:21 marc Exp $
+/* $Id: router_flexml.hpp,v 1.4 2005-10-28 10:35:30 marc Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
if (std::string((const char *)node2->name)
!= "filter")
xml_dom_error(root, "expected <filter>, got ");
-
+#if 0
while(node2 && std::string((const char *)node2->name) == "filter"){
std::cout << "processing /yp2/filters/filter" << std::endl;
for (; node2 && node2->type != XML_ELEMENT_NODE; node2 = node2->next)
if(node2->type != XML_ELEMENT_NODE)
break;
}
-
+#endif
// process <routes> node which is expected third element node
node = node->next;
for (; node && node->type != XML_ELEMENT_NODE; node = node->next)
--- /dev/null
+/* $Id: test_filter_factory.cpp,v 1.1 2005-10-28 10:35:30 marc Exp $
+ Copyright (c) 2005, Index Data.
+
+%LICENSE%
+ */
+
+
+#include <iostream>
+#include <stdexcept>
+
+#include "config.hpp"
+#include "filter.hpp"
+#include "filter_factory.hpp"
+
+
+#define BOOST_AUTO_TEST_MAIN
+#include <boost/test/auto_unit_test.hpp>
+
+using namespace boost::unit_test;
+
+class XFilter: public yp2::filter::Base {
+public:
+ void process(yp2::Package & package) const {};
+};
+
+class YFilter: public yp2::filter::Base {
+public:
+ void process(yp2::Package & package) const {};
+};
+
+
+BOOST_AUTO_TEST_CASE( test_router_flexml_1 )
+{
+ try{
+
+ yp2::filter::FilterFactory ffactory;
+
+
+ BOOST_CHECK (true);
+
+ //BOOST_CHECK_EQUAL(filter.name(), std::string("filter1"));
+
+ }
+ catch ( ... ) {
+ BOOST_CHECK (false);
+ }
+}
+
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * c-file-style: "stroustrup"
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */