is screwed. Test for double dl-load in FilterFactory.
-/* $Id: factory_static.cpp,v 1.1 2006-01-04 11:19:04 adam Exp $
+/* $Id: factory_static.cpp,v 1.2 2006-01-04 11:55:31 adam Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
yp2::FactoryStatic::FactoryStatic(yp2::FilterFactory &factory)
{
- const struct yp2_filter_struct *buildins[] = {
+ struct yp2_filter_struct *buildins[] = {
&yp2_filter_backend_test,
&yp2_filter_frontend_net,
&yp2_filter_log,
-/* $Id: filter_backend_test.cpp,v 1.11 2006-01-04 11:19:04 adam Exp $
+/* $Id: filter_backend_test.cpp,v 1.12 2006-01-04 11:55:31 adam Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
}
extern "C" {
- const struct yp2_filter_struct yp2_filter_backend_test = {
+ struct yp2_filter_struct yp2_filter_backend_test = {
0,
"backend_test",
filter_creator
-/* $Id: filter_backend_test.hpp,v 1.6 2006-01-04 11:19:04 adam Exp $
+/* $Id: filter_backend_test.hpp,v 1.7 2006-01-04 11:55:31 adam Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
}
extern "C" {
- extern const struct yp2_filter_struct yp2_filter_backend_test;
+ extern struct yp2_filter_struct yp2_filter_backend_test;
}
#endif
-/* $Id: filter_dl.cpp,v 1.2 2006-01-04 11:19:04 adam Exp $
+/* $Id: filter_dl.cpp,v 1.3 2006-01-04 11:55:31 adam Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
void yp2::filter::Filter_dl::process(yp2::Package & package) const
{
- package.data() = 42;
+ package.data() = 42; // magic checked in test_filter_factory
}
static yp2::filter::Base* filter_creator()
}
extern "C" {
- const struct yp2_filter_struct yp2_filter_dl = {
+ struct yp2_filter_struct yp2_filter_dl = {
0,
"dl",
filter_creator
-/* $Id: filter_factory.cpp,v 1.2 2005-12-10 09:59:10 adam Exp $
+/* $Id: filter_factory.cpp,v 1.3 2006-01-04 11:55:31 adam Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
namespace yp2 {
class FilterFactory::Rep {
typedef std::map<std::string, CreateFilterCallback> CallbackMap;
+ typedef std::map<std::string, CreateFilterCallback>::iterator
+ CallbackMapIt;
public:
friend class FilterFactory;
CallbackMap m_fcm;
bool yp2::FilterFactory::add_creator_dyn(const std::string &fi,
const std::string &path)
{
+ if (m_p->m_fcm.find(fi) != m_p->m_fcm.end())
+ {
+ return true;
+ }
+
std::string full_path = path + "/yp2_filter_" + fi + ".so";
void *dl_handle = dlopen(full_path.c_str(), RTLD_GLOBAL|RTLD_NOW);
if (!dl_handle)
-/* $Id: filter_frontend_net.cpp,v 1.10 2006-01-04 11:19:04 adam Exp $
+/* $Id: filter_frontend_net.cpp,v 1.11 2006-01-04 11:55:31 adam Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
}
extern "C" {
- const struct yp2_filter_struct yp2_filter_frontend_net = {
+ struct yp2_filter_struct yp2_filter_frontend_net = {
0,
"frontend_net",
filter_creator
-/* $Id: filter_frontend_net.hpp,v 1.9 2006-01-04 11:19:04 adam Exp $
+/* $Id: filter_frontend_net.hpp,v 1.10 2006-01-04 11:55:31 adam Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
}
extern "C" {
- extern const struct yp2_filter_struct yp2_filter_frontend_net;
+ extern struct yp2_filter_struct yp2_filter_frontend_net;
}
#endif
-/* $Id: filter_log.cpp,v 1.10 2006-01-04 11:19:04 adam Exp $
+/* $Id: filter_log.cpp,v 1.11 2006-01-04 11:55:31 adam Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
}
extern "C" {
- const struct yp2_filter_struct yp2_filter_log = {
+ struct yp2_filter_struct yp2_filter_log = {
0,
"log",
filter_creator
-/* $Id: filter_log.hpp,v 1.11 2006-01-04 11:19:04 adam Exp $
+/* $Id: filter_log.hpp,v 1.12 2006-01-04 11:55:31 adam Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
}
extern "C" {
- extern const struct yp2_filter_struct yp2_filter_log;
+ extern struct yp2_filter_struct yp2_filter_log;
}
#endif
-/* $Id: filter_session_shared.cpp,v 1.3 2006-01-04 11:19:04 adam Exp $
+/* $Id: filter_session_shared.cpp,v 1.4 2006-01-04 11:55:31 adam Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
}
extern "C" {
- const struct yp2_filter_struct yp2_filter_session_shared = {
+ struct yp2_filter_struct yp2_filter_session_shared = {
0,
"session_shared",
filter_creator
-/* $Id: filter_session_shared.hpp,v 1.2 2006-01-04 11:19:04 adam Exp $
+/* $Id: filter_session_shared.hpp,v 1.3 2006-01-04 11:55:31 adam Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
}
extern "C" {
- extern const struct yp2_filter_struct yp2_filter_session_shared;
+ extern struct yp2_filter_struct yp2_filter_session_shared;
}
#endif
-/* $Id: filter_template.cpp,v 1.3 2006-01-04 11:19:04 adam Exp $
+/* $Id: filter_template.cpp,v 1.4 2006-01-04 11:55:31 adam Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
}
extern "C" {
- const struct yp2_filter_struct yp2_filter_template = {
+ struct yp2_filter_struct yp2_filter_template = {
0,
"template",
filter_creator
-/* $Id: filter_template.hpp,v 1.3 2006-01-04 11:19:04 adam Exp $
+/* $Id: filter_template.hpp,v 1.4 2006-01-04 11:55:31 adam Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
}
extern "C" {
- extern const struct yp2_filter_struct yp2_filter_template;
+ extern struct yp2_filter_struct yp2_filter_template;
}
#endif
-/* $Id: filter_virt_db.cpp,v 1.16 2006-01-04 11:19:04 adam Exp $
+/* $Id: filter_virt_db.cpp,v 1.17 2006-01-04 11:55:31 adam Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
}
extern "C" {
- const struct yp2_filter_struct yp2_filter_virt_db = {
+ struct yp2_filter_struct yp2_filter_virt_db = {
0,
"virt_db",
filter_creator
-/* $Id: filter_virt_db.hpp,v 1.5 2006-01-04 11:19:04 adam Exp $
+/* $Id: filter_virt_db.hpp,v 1.6 2006-01-04 11:55:32 adam Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
}
extern "C" {
- extern const struct yp2_filter_struct yp2_filter_virt_db;
+ extern struct yp2_filter_struct yp2_filter_virt_db;
}
#endif
-/* $Id: filter_z3950_client.cpp,v 1.14 2006-01-04 11:19:04 adam Exp $
+/* $Id: filter_z3950_client.cpp,v 1.15 2006-01-04 11:55:32 adam Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
}
extern "C" {
- const struct yp2_filter_struct yp2_filter_z3950_client = {
+ struct yp2_filter_struct yp2_filter_z3950_client = {
0,
"z3950_client",
filter_creator
-/* $Id: filter_z3950_client.hpp,v 1.6 2006-01-04 11:19:04 adam Exp $
+/* $Id: filter_z3950_client.hpp,v 1.7 2006-01-04 11:55:32 adam Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
}
extern "C" {
- extern const struct yp2_filter_struct yp2_filter_z3950_client;
+ extern struct yp2_filter_struct yp2_filter_z3950_client;
}
#endif
-/* $Id: test_filter_factory.cpp,v 1.8 2005-12-11 17:25:59 adam Exp $
+/* $Id: test_filter_factory.cpp,v 1.9 2006-01-04 11:55:32 adam Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
const std::string id = "dl";
+ // first load
BOOST_CHECK(ffactory.add_creator_dyn(id, ".libs"));
-
+
+ // test double load
+ BOOST_CHECK(ffactory.add_creator_dyn(id, ".libs"));
+
yp2::filter::Base* filter = 0;
filter = ffactory.create(id);
-/* $Id: test_router_flexml.cpp,v 1.8 2006-01-04 11:19:04 adam Exp $
+/* $Id: test_router_flexml.cpp,v 1.9 2006-01-04 11:55:32 adam Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
" <filter id=\"front_default\" type=\"frontend_net\">\n"
" <port>210</port>\n"
" </filter>\n"
- " <filter id=\"log_cout\" type=\"log\">\n"
- " <logfile>mylog.log</logfile>\n"
+ " <filter id=\"log_cout1\" type=\"log\">\n"
+ " <logfile>mylog1.log</logfile>\n"
+ " </filter>\n"
+ " <filter id=\"log_cout2\" type=\"log\">\n"
+ " <logfile>mylog2.log</logfile>\n"
" </filter>\n"
" </filters>\n"
" <routes>\n"