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