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 "unique_synchronizer_fwd.hh"
00033
00034 namespace tool
00035 {
00036
00037 template <class I, class B1, class B2>
00038 struct types< wifi::frame::filter::internals::u_sync_iterator<I, B1, B2> >
00039 {
00040 typedef
00041 wifi::frame::filter::synchronized_unique_frame
00042 value_type;
00043 };
00044
00045 template <class I, class B>
00046 struct types< wifi::frame::filter::unique_synchronizer<I, B> >
00047 {
00048 typedef
00049 wifi::frame::filter::internals::u_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 struct synchronized_unique_frame
00063 {
00064 typedef mpf_class impl_type;
00065 typedef std::pair<impl_type, impl_type> coefs_type;
00066
00067 synchronized_unique_frame(const tool::microseconds&,
00068 const tool::microseconds&,
00069 const coefs_type&);
00070
00071 bool operator == (const synchronized_unique_frame&) const;
00072 bool operator != (const synchronized_unique_frame&) const;
00073
00074 tool::microseconds t1;
00075 tool::microseconds t2;
00076 coefs_type coefs;
00077 };
00078
00079 namespace internals
00080 {
00081
00082 template <class I, class B, class Bottom = tool::bottom>
00083 struct u_sync_iterator:
00084 tt_inherit(public tool::iterator, u_sync_iterator<I, B, Bottom>)
00085 {
00086 typedef tt_get_exact(Bottom, u_sync_iterator<I, B, Bottom>)
00087 exact_type;
00088 typedef tt_type(value_type, exact_type) value_type;
00089
00090 u_sync_iterator(unique_synchronizer<I, B>&, bool);
00091
00092 bool equal(const exact_type&) const;
00093 void increment();
00094 const value_type& get() const;
00095 const value_type* get_ptr() const;
00096
00097 private:
00098 typedef boost::optional<value_type> optional_value;
00099
00100 unique_synchronizer<I, B>* i_;
00101 unsigned next_wpos_;
00102 optional_value v_;
00103 };
00104
00105 }
00106
00107 template <class InputIterator, class Bottom = tool::bottom>
00108 struct unique_synchronizer:
00109 tt_inherit(public tool::iterable,
00110 unique_synchronizer<InputIterator, Bottom>)
00111 {
00112 unique_synchronizer(const InputIterator& first,
00113 const InputIterator& last);
00114
00115 private:
00116 InputIterator next_;
00117 InputIterator last_;
00118
00119 friend
00120 class internals::u_sync_iterator<InputIterator, Bottom, tool::bottom>;
00121 };
00122
00123 }
00124 }
00125 }
00126
00127 # include "unique_synchronizer.hxx"
00128
00129 #endif