fdaafe2bb5baad1043053c774bc6549799968b70
[metaproxy-moved-to-github.git] / src / filter.hpp
1 /* $Id: filter.hpp,v 1.18 2006-09-29 09:48:35 marc Exp $
2    Copyright (c) 2005-2006, Index Data.
3
4    See the LICENSE file for details
5  */
6
7 #ifndef FILTER_HPP
8 #define FILTER_HPP
9
10 #include <string>
11 #include <stdexcept>
12 #include <libxml/tree.h>
13 #include "xmlutil.hpp"
14
15 namespace metaproxy_1 {
16
17     class Package;
18
19     namespace filter {
20         class Base {
21         public:
22             virtual ~Base(){};
23             
24             ///sends Package off to next Filter, returns altered Package
25             virtual void process(Package & package) const = 0;
26
27             /// configuration during filter load 
28             virtual void configure(const xmlNode * ptr);
29         };
30
31         class FilterException : public std::runtime_error {
32         public:
33             FilterException(const std::string message)
34                 : std::runtime_error("FilterException: " + message){
35             };
36         };
37     }
38 }
39
40 struct metaproxy_1_filter_struct {
41     int ver;
42     const char *type;
43     metaproxy_1::filter::Base* (*creator)();
44 };
45
46 #endif
47 /*
48  * Local variables:
49  * c-basic-offset: 4
50  * indent-tabs-mode: nil
51  * c-file-style: "stroustrup"
52  * End:
53  * vim: shiftwidth=4 tabstop=8 expandtab
54  */