-/* $Id: ex_filter_frontend_net.cpp,v 1.16 2005-10-30 17:13:36 adam Exp $
+/* $Id: ex_filter_frontend_net.cpp,v 1.17 2005-10-31 09:40:18 marc Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
}
return package.move();
};
- const std::string type() const {
- return "HTTPFilter";
- };
};
int main(int argc, char **argv)
-/* $Id: filter.cpp,v 1.1 2005-10-29 22:23:36 marc Exp $
+/* $Id: filter.cpp,v 1.2 2005-10-31 09:40:18 marc Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
// defining and initializing static members
-
// std::string yp2::filter::Base:m_type("Base");
-/* $Id: filter.hpp,v 1.7 2005-10-29 22:23:36 marc Exp $
+/* $Id: filter.hpp,v 1.8 2005-10-31 09:40:18 marc Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
virtual void process(Package & package) const = 0;
virtual void configure(const xmlNode * ptr = 0) { };
-
-
- virtual const std::string type() const = 0;
};
- }
-
- class FilterException : public std::runtime_error {
- public:
- FilterException(const std::string message)
- : std::runtime_error("FilterException: " + message){
+
+ struct Creator {
+ const char* type;
+ yp2::filter::Base* (*creator)();
};
- };
+ class FilterException : public std::runtime_error {
+ public:
+ FilterException(const std::string message)
+ : std::runtime_error("FilterException: " + message){
+ };
+ };
+
+ }
}
-/* $Id: filter_backend_test.hpp,v 1.3 2005-10-29 22:23:36 marc Exp $
+/* $Id: filter_backend_test.hpp,v 1.4 2005-10-31 09:40:18 marc Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
~Backend_test();
Backend_test();
void process(yp2::Package & package) const;
- const std::string type() const {
- return "Backend_test";
- };
private:
boost::scoped_ptr<Rep> m_p;
};
-/* $Id: filter_factory.hpp,v 1.3 2005-10-29 22:51:11 marc Exp $
+/* $Id: filter_factory.hpp,v 1.4 2005-10-31 09:40:18 marc Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
namespace yp2 {
namespace filter {
-
-
-
class FilterFactoryException : public std::runtime_error {
public:
-/* $Id: filter_frontend_net.hpp,v 1.6 2005-10-29 22:23:36 marc Exp $
+/* $Id: filter_frontend_net.hpp,v 1.7 2005-10-31 09:40:18 marc Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
public:
FrontendNet::FrontendNet();
void process(yp2::Package & package) const;
- const std::string type() const {
- return "FrontendNet";
- };
private:
int m_no_threads;
std::vector<std::string> m_ports;
-/* $Id: filter_log.hpp,v 1.8 2005-10-29 22:23:36 marc Exp $
+/* $Id: filter_log.hpp,v 1.9 2005-10-31 09:40:18 marc Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
Log(const std::string &msg);
Log();
void process(yp2::Package & package) const;
- const std::string type() const {
- return "Log";
- };
private:
/// static mutex to lock Ostream during logging operation
static boost::mutex m_log_mutex;
-/* $Id: filter_virt_db.hpp,v 1.3 2005-10-29 22:23:36 marc Exp $
+/* $Id: filter_virt_db.hpp,v 1.4 2005-10-31 09:40:18 marc Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
~Virt_db();
Virt_db();
void process(yp2::Package & package) const;
- const std::string type() const {
- return "Virt_db";
- };
void add_map_db2vhost(std::string db, std::string vhost);
private:
boost::scoped_ptr<Rep> m_p;
-/* $Id: filter_z3950_client.hpp,v 1.3 2005-10-29 22:23:36 marc Exp $
+/* $Id: filter_z3950_client.hpp,v 1.4 2005-10-31 09:40:18 marc Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
~Z3950Client();
Z3950Client();
void process(yp2::Package & package) const;
- const std::string type() const {
- return "Z3950Client";
- };
private:
boost::scoped_ptr<Rep> m_p;
};
-/* $Id: test_filter1.cpp,v 1.12 2005-10-29 22:23:36 marc Exp $
+/* $Id: test_filter1.cpp,v 1.13 2005-10-31 09:40:18 marc Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
class TFilter: public yp2::filter::Base {
public:
void process(yp2::Package & package) const {};
- const std::string type() const {
- return "TFilter";
- };
};
TFilter filter;
- BOOST_CHECK (filter.type() == "TFilter");
+ BOOST_CHECK (sizeof(filter) > 0);
}
catch ( ... ) {
BOOST_CHECK (false);
-/* $Id: test_filter2.cpp,v 1.14 2005-10-29 22:23:36 marc Exp $
+/* $Id: test_filter2.cpp,v 1.15 2005-10-31 09:40:18 marc Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
package.data() = m_constant;
package.move();
};
- const std::string type() const {
- return "FilterConstant";
- };
void configure(const xmlNode* ptr = 0);
int get_constant() const { return m_constant; };
private:
package.data() = package.data() * 2;
package.move();
};
- const std::string type() const {
- return "FilterConstant";
- };
};
-/* $Id: test_filter_factory.cpp,v 1.3 2005-10-29 22:23:36 marc Exp $
+/* $Id: test_filter_factory.cpp,v 1.4 2005-10-31 09:40:18 marc Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
class XFilter: public yp2::filter::Base {
public:
void process(yp2::Package & package) const {};
- const std::string type() const{
- return "XFilter";
- };
};
class YFilter: public yp2::filter::Base {
public:
void process(yp2::Package & package) const {};
- const std::string type() const{
- return "YFilter";
- };
};
yp2::filter::Base* yfilter_creator(){
XFilter xf;
YFilter yf;
- const std::string xfid = xf.type();
- const std::string yfid = yf.type();
+ const std::string xfid = "XFilter";
+ const std::string yfid = "YFilter";
//std::cout << "Xfilter name: " << xfid << std::endl;
//std::cout << "Yfilter name: " << yfid << std::endl;
BOOST_CHECK_EQUAL(ffactory.add_creator(yfid, yfilter_creator),
true);
- yp2::filter::Base* xfilter = ffactory.create(xfid);
- yp2::filter::Base* yfilter = ffactory.create(yfid);
+ yp2::filter::Base* xfilter = 0;
+ xfilter = ffactory.create(xfid);
+ yp2::filter::Base* yfilter = 0;
+ yfilter = ffactory.create(yfid);
- BOOST_CHECK_EQUAL(xf.type(), xfilter->type());
- BOOST_CHECK_EQUAL(yf.type(), yfilter->type());
+ //BOOST_CHECK_EQUAL(sizeof(xf), sizeof(*xfilter));
+ //BOOST_CHECK_EQUAL(sizeof(yf), sizeof(*yfilter));
- //std::cout << "Xfilter pointer name: " << xfilter->type() << std::endl;
- //std::cout << "Yfilter pointer name: " << yfilter->type() << std::endl;
-
+ BOOST_CHECK(0 != xfilter);
+ BOOST_CHECK(0 != yfilter);
}
catch ( ... ) {
-/* $Id: test_filter_frontend_net.cpp,v 1.12 2005-10-30 17:13:36 adam Exp $
+/* $Id: test_filter_frontend_net.cpp,v 1.13 2005-10-31 09:40:18 marc Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
}
return package.move();
};
- const std::string type() const {
- return "FilterInit";
- };
};
-/* $Id: test_filter_log.cpp,v 1.6 2005-10-30 17:13:36 adam Exp $
+/* $Id: test_filter_log.cpp,v 1.7 2005-10-31 09:40:18 marc Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
}
return package.move();
};
- const std::string type() const {
- return "FilterBounceInit";
- };
};
-/* $Id: test_router_flexml.cpp,v 1.2 2005-10-29 22:23:36 marc Exp $
+/* $Id: test_router_flexml.cpp,v 1.3 2005-10-31 09:40:18 marc Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
class TFilter: public yp2::filter::Base {
public:
void process(yp2::Package & package) const {};
- const std::string type() const {
- return "TFilter";
- };
};