00001 // $Id: backwardfilter.h 6736 2006-12-21 11:24:42Z tdelaet $ 00002 // Copyright (C) 2006 Tinne De Laet <first dot last at mech dot kuleuven dot be> 00003 // 00004 /*************************************************************************** 00005 * This library is free software; you can redistribute it and/or * 00006 * modify it under the terms of the GNU General Public * 00007 * License as published by the Free Software Foundation; * 00008 * version 2 of the License. * 00009 * * 00010 * As a special exception, you may use this file as part of a free * 00011 * software library without restriction. Specifically, if other files * 00012 * instantiate templates or use macros or inline functions from this * 00013 * file, or you compile this file and link it with other files to * 00014 * produce an executable, this file does not by itself cause the * 00015 * resulting executable to be covered by the GNU General Public * 00016 * License. This exception does not however invalidate any other * 00017 * reasons why the executable file might be covered by the GNU General * 00018 * Public License. * 00019 * * 00020 * This library is distributed in the hope that it will be useful, * 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00023 * Lesser General Public License for more details. * 00024 * * 00025 * You should have received a copy of the GNU General Public * 00026 * License along with this library; if not, write to the Free Software * 00027 * Foundation, Inc., 59 Temple Place, * 00028 * Suite 330, Boston, MA 02111-1307 USA * 00029 * * 00030 ***************************************************************************/ 00031 00032 #ifndef __BACKWARDFILTER__ 00033 #define __BACKWARDFILTER__ 00034 00035 #include "../model/systemmodel.h" 00036 #include "../pdf/pdf.h" 00037 00038 namespace BFL 00039 { 00040 using namespace std; 00041 00043 00059 template <typename StateVar> class BackwardFilter 00060 { 00061 protected: 00062 00064 Pdf<StateVar> * _prior; 00065 00067 00069 Pdf<StateVar> * _post; 00070 00072 int _timestep; 00073 00075 00079 virtual bool UpdateInternal(SystemModel<StateVar>* const sysmodel, 00080 const StateVar& u, 00081 Pdf<StateVar>* const filtered_post)=0; 00082 00083 public: 00085 00088 BackwardFilter(Pdf<StateVar> * prior); 00089 00091 BackwardFilter(const BackwardFilter<StateVar>& filt); 00092 00094 virtual ~BackwardFilter(); 00095 00097 virtual void Reset(Pdf<StateVar> * prior); 00098 00100 00104 virtual bool Update(SystemModel<StateVar>* const sysmodel, 00105 const StateVar& u, 00106 Pdf<StateVar>* const filtered_post); 00107 00109 00113 virtual bool Update(SystemModel<StateVar>* const sysmodel, 00114 Pdf<StateVar>* const filtered_post); 00115 00117 00120 virtual Pdf<StateVar> * PostGet(); 00121 00123 00126 int TimeStepGet() const; 00127 }; 00128 00129 // For template instantiation 00130 #include "backwardfilter.cpp" 00131 00132 } // End namespace BFL 00133 00134 #endif // __BACKWARDFILTER__