00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef FILTER_SYNCHRONIZER_HH_
00023 # define FILTER_SYNCHRONIZER_HH_
00024
00025 # include <utility>
00026
00027 # include <wipal/tool/valued_iterator.hh>
00028 # include <wipal/tool/iterable.hh>
00029 # include <wipal/wifi/addr_mapping.hh>
00030
00031 # include "linear_regression_synchronizer_fwd.hh"
00032
00033 namespace wpl
00034 {
00035
00036
00037 namespace tool
00038 {
00039
00040 template <class I, class B1, class B2>
00041 struct types< wpl::filter::internals::lr_sync_iterator<I, B1, B2> >
00042 {
00043 typedef wpl::filter::
00044 synchronized_frame<typename I::value_type::value_type, mpf_class>
00045 value_type;
00046 };
00047
00048 template <class I, class B>
00049 struct types< wpl::filter::linear_regression_synchronizer<I, B> >
00050 {
00051 typedef
00052 wpl::filter::internals::lr_sync_iterator<I, B, bottom>
00053 iterator;
00054 };
00055
00056 }
00057
00058
00059
00060 namespace filter
00061 {
00062
00063 template <class OriginalFrameType, class ImplType>
00064 struct synchronized_frame: public OriginalFrameType
00065 {
00066 typedef ImplType impl_type;
00067 typedef typename std::pair<impl_type, impl_type> coefs_type;
00068
00069 synchronized_frame(const OriginalFrameType&, const coefs_type&);
00070
00071 coefs_type coefs;
00072 };
00073
00074 namespace internals
00075 {
00076
00077 template <class I, class B, class Bottom = tool::bottom>
00078 struct lr_sync_iterator: WP_INHERIT(public tool::valued_iterator,
00079 lr_sync_iterator<I, B, Bottom>)
00080 {
00082
00083 typedef WP_GET_EXACT(Bottom, lr_sync_iterator<I, B, Bottom>)
00084 exact_type;
00085 typedef tool::valued_iterator<exact_type> super_type;
00086 typedef WP_TYPE(value_type, exact_type) value_type;
00088
00089 typedef linear_regression_synchronizer<I, B> iterable_type;
00090
00092 lr_sync_iterator(const iterable_type& iterable, bool end);
00093
00095
00096 bool equal(const exact_type&) const;
00097 void increment();
00099
00100 private:
00101 bool advance();
00102 bool update_value();
00103
00104 const iterable_type* iterable_;
00105 I win_;
00106 unsigned wpos_;
00107 };
00108
00109 }
00110
00111 template <class InputIterator, class Bottom = tool::bottom>
00112 struct linear_regression_synchronizer:
00113 WP_INHERIT(public tool::iterable,
00114 linear_regression_synchronizer<InputIterator, Bottom>)
00115 {
00116 linear_regression_synchronizer(const InputIterator& first,
00117 const InputIterator& last,
00118 const unsigned precision);
00119
00120 private:
00121 InputIterator first_;
00122 InputIterator last_;
00123 unsigned precision_;
00124
00125 friend class
00126 internals::lr_sync_iterator<InputIterator, Bottom, tool::bottom>;
00127 };
00128
00139 template <class U, class HT, template <class, class, class> class Int,
00140 class I1, class I2, class F>
00141 void
00142 provide_lr_synchronizer(const I1& first1, const I1& last1,
00143 const I2& first2, const I2& last2,
00144 opt::list& options,
00145 F& func);
00146
00147 }
00148
00149 }
00150
00151 # include "linear_regression_synchronizer.hxx"
00152
00153 #endif // ! FILTER_SYNCHRONIZER_HH_