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 <boost/optional.hpp>
00026 # include <gmpxx.h>
00027
00028 # include <trace-tools/tool/microseconds.hh>
00029 # include <trace-tools/tool/iterator.hh>
00030 # include <trace-tools/tool/iterable.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:
00078 tt_inherit(public tool::iterator, lr_sync_iterator<I, B, Bottom>)
00079 {
00080 typedef tt_get_exact(Bottom, lr_sync_iterator<I, B, Bottom>)
00081 exact_type;
00082 typedef tt_type(value_type, exact_type) value_type;
00083
00084 lr_sync_iterator(linear_regression_synchronizer<I, B>&, bool);
00085
00086 bool equal(const exact_type&) const;
00087 void increment();
00088 const value_type& get() const;
00089 const value_type* get_ptr() const;
00090
00091 private:
00092 typedef boost::optional<value_type> optional_value;
00093
00094 linear_regression_synchronizer<I, B>* i_;
00095 unsigned next_wpos_;
00096 optional_value v_;
00097 };
00098
00099 }
00100
00101 template <class InputIterator, class Bottom = tool::bottom>
00102 struct linear_regression_synchronizer:
00103 tt_inherit(public tool::iterable,
00104 linear_regression_synchronizer<InputIterator, Bottom>)
00105 {
00106 linear_regression_synchronizer(const InputIterator& first,
00107 const InputIterator& last);
00108
00109 private:
00110 InputIterator next_;
00111 InputIterator last_;
00112
00113 friend class internals::
00114 lr_sync_iterator<InputIterator, Bottom, tool::bottom>;
00115 };
00116
00117 }
00118 }
00119 }
00120
00121 # include "linear_regression_synchronizer.hxx"
00122
00123 #endif