From b3974a565a726b9afaad86bcb66b56ae3ceb351a Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 19 Mar 2012 10:13:24 +0100 Subject: [PATCH] sort: add skeleton for new sort filter --- src/Makefile.am | 1 + src/factory_static.cpp | 2 + src/filter_sort.cpp | 109 ++++++++++++++++++++++++++++++++++++++++++++++++ src/filter_sort.hpp | 54 ++++++++++++++++++++++++ win/makefile | 1 + 5 files changed, 167 insertions(+) create mode 100644 src/filter_sort.cpp create mode 100644 src/filter_sort.hpp diff --git a/src/Makefile.am b/src/Makefile.am index fb3fc31..61e98f9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -36,6 +36,7 @@ libmetaproxy_la_SOURCES = \ filter_query_rewrite.cpp filter_query_rewrite.hpp \ filter_record_transform.cpp filter_record_transform.hpp \ filter_session_shared.cpp filter_session_shared.hpp \ + filter_sort.cpp filter_sort.hpp \ filter_sru_to_z3950.cpp filter_sru_to_z3950.hpp \ filter_template.cpp filter_template.hpp \ filter_virt_db.cpp filter_virt_db.hpp \ diff --git a/src/factory_static.cpp b/src/factory_static.cpp index 3cd7ce8..fb82b74 100644 --- a/src/factory_static.cpp +++ b/src/factory_static.cpp @@ -43,6 +43,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "filter_query_rewrite.hpp" #include "filter_record_transform.hpp" #include "filter_session_shared.hpp" +#include "filter_sort.hpp" #include "filter_sru_to_z3950.hpp" #include "filter_template.hpp" #include "filter_virt_db.hpp" @@ -71,6 +72,7 @@ mp::FactoryStatic::FactoryStatic() &metaproxy_1_filter_query_rewrite, &metaproxy_1_filter_record_transform, &metaproxy_1_filter_session_shared, + &metaproxy_1_filter_sort, &metaproxy_1_filter_sru_to_z3950, &metaproxy_1_filter_template, &metaproxy_1_filter_virt_db, diff --git a/src/filter_sort.cpp b/src/filter_sort.cpp new file mode 100644 index 0000000..8202577 --- /dev/null +++ b/src/filter_sort.cpp @@ -0,0 +1,109 @@ +/* This file is part of Metaproxy. + Copyright (C) 2005-2012 Index Data + +Metaproxy is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "config.hpp" +#include "filter_sort.hpp" +#include +#include + +#include + +#include + +namespace mp = metaproxy_1; +namespace yf = mp::filter; + +namespace metaproxy_1 { + namespace filter { + class Sort::Impl { + public: + Impl(); + ~Impl(); + void process(metaproxy_1::Package & package) const; + void configure(const xmlNode * ptr, bool test_only, + const char *path); + private: + int m_prefetch; + }; + } +} + +// define Pimpl wrapper forwarding to Impl + +yf::Sort::Sort() : m_p(new Impl) +{ +} + +yf::Sort::~Sort() +{ // must have a destructor because of boost::scoped_ptr +} + +void yf::Sort::configure(const xmlNode *xmlnode, bool test_only, + const char *path) +{ + m_p->configure(xmlnode, test_only, path); +} + +void yf::Sort::process(mp::Package &package) const +{ + m_p->process(package); +} + +yf::Sort::Impl::Impl() : m_prefetch(20) +{ +} + +yf::Sort::Impl::~Impl() +{ +} + +void yf::Sort::Impl::configure(const xmlNode *xmlnode, bool test_only, + const char *path) +{ +} + +void yf::Sort::Impl::process(mp::Package &package) const +{ + // Z_GDU *gdu = package.request().get(); + package.move(); +} + + +static mp::filter::Base* filter_creator() +{ + return new mp::filter::Sort; +} + +extern "C" { + struct metaproxy_1_filter_struct metaproxy_1_filter_sort = { + 0, + "sort", + filter_creator + }; +} + + +/* + * Local variables: + * c-basic-offset: 4 + * c-file-style: "Stroustrup" + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ + diff --git a/src/filter_sort.hpp b/src/filter_sort.hpp new file mode 100644 index 0000000..5e660f1 --- /dev/null +++ b/src/filter_sort.hpp @@ -0,0 +1,54 @@ +/* This file is part of Metaproxy. + Copyright (C) 2005-2012 Index Data + +Metaproxy is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef FILTER_SORT_HPP +#define FILTER_SORT_HPP + +#include + +#include + +namespace metaproxy_1 { + namespace filter { + class Sort : public Base { + class Impl; + boost::scoped_ptr m_p; + public: + Sort(); + ~Sort(); + void process(metaproxy_1::Package & package) const; + void configure(const xmlNode * ptr, bool test_only, + const char *path); + }; + } +} + +extern "C" { + extern struct metaproxy_1_filter_struct metaproxy_1_filter_sort; +} + +#endif +/* + * Local variables: + * c-basic-offset: 4 + * c-file-style: "Stroustrup" + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ + diff --git a/win/makefile b/win/makefile index 69280ec..7698e0d 100644 --- a/win/makefile +++ b/win/makefile @@ -228,6 +228,7 @@ PROJECT_DLL_OBJS = \ $(OBJDIR)\filter_query_rewrite.obj \ $(OBJDIR)\filter_record_transform.obj \ $(OBJDIR)\filter_session_shared.obj \ + $(OBJDIR)\filter_sort.obj \ $(OBJDIR)\filter_sru_to_z3950.obj \ $(OBJDIR)\filter_template.obj \ $(OBJDIR)\filter_virt_db.obj \ -- 1.7.10.4