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