00001 /* 00002 * Copyright (c) 2004 CSIRO ICT Centre 00003 * 00004 * $Id: Filter.cpp 587 2004-12-03 15:06:33Z nch $ 00005 */ 00006 00007 #include <iostream> 00008 00009 #include "Filter.h" 00010 #include "Matcher.h" 00011 #include "Object.h" 00012 00013 00014 String Filter::s_name("Filter"); 00015 00016 00017 Filter::Filter(Matcher * m) 00018 : matcher(m) 00019 { 00020 } 00021 00022 Filter::~Filter() 00023 { 00024 delete matcher; 00025 } 00026 00027 String const & Filter::getName() 00028 { 00029 return matcher->getName(); 00030 } 00031 00032 void Filter::preFilter() 00033 { 00034 matcher->getReady(); 00035 } 00036 00037 void Filter::filter() 00038 { 00039 if (matcher->hasFilter()) 00040 { 00041 preFilter(); 00042 matcher->doFilter(); 00043 postFilter(); 00044 } 00045 else 00046 { 00047 std::cerr << "There is no fast filter for " << matcher->getName() << std::endl; 00048 } 00049 } 00050 00051 void Filter::postFilter() 00052 { 00053 matcher->finished(); 00054 }