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_INTERSECTOR_HXX_
00023 # define WIFI_FRAME_FILTER_INTERSECTOR_HXX_
00024
00025 # include "intersector.hh"
00026
00027 # include <wipal/wifi/frame/filter/non_noisy_prism.hh>
00028 # include <wipal/wifi/frame/filter/uniquely_identifiable.hh>
00029
00030 namespace wifi
00031 {
00032 namespace frame
00033 {
00034 namespace filter
00035 {
00036
00037 template <class U, class HT, template <class, class, class> class Int,
00038 class I1, class I2, class F>
00039 void
00040 provide_intersector(const I1& first1, const I1& last1,
00041 const I2& first2, const I2& last2,
00042 tool::opt::list& options,
00043 F& func)
00044 {
00045 typedef tool::endian::endianness endianness;
00046
00047 const unsigned& prec = options["precision"].get<unsigned>();
00048 const endianness& end = options["endianness"].get<endianness>();
00049 addr_mapping& map = options["mapping"].get<addr_mapping>();
00050 const bool pcapts = not options["phy_tstamps"].get<bool>();
00051
00052 if (options["ignore_noisy_prism"].get<bool>())
00053 {
00054 typedef non_noisy_prism<I1> nnp1;
00055 typedef non_noisy_prism<I2> nnp2;
00056 typedef typename nnp1::const_iterator nnp1_i;
00057 typedef typename nnp2::const_iterator nnp2_i;
00058 typedef uniquely_identifiable<U, nnp1_i, HT> ui1;
00059 typedef uniquely_identifiable<U, nnp2_i, HT> ui2;
00060 typedef typename ui1::const_iterator ui1_i;
00061 typedef typename ui2::const_iterator ui2_i;
00062 typedef Int<ui1_i, ui2_i, tool::bottom> intersector;
00063
00064 nnp1 n1 (first1, last1);
00065 nnp2 n2 (first2, last2);
00066 ui1 u1 (n1.begin(), n1.end(), map, end, pcapts);
00067 ui2 u2 (n2.begin(), n2.end(), map, end, pcapts);
00068 intersector i (u1.begin(), u1.end(), u2.begin(), u2.end(), prec);
00069
00070 func(i);
00071 }
00072 else
00073 {
00074 typedef uniquely_identifiable<U, I1, HT> ui1;
00075 typedef uniquely_identifiable<U, I2, HT> ui2;
00076 typedef typename ui1::const_iterator ui1_i;
00077 typedef typename ui2::const_iterator ui2_i;
00078 typedef Int<ui1_i, ui2_i, tool::bottom> intersector;
00079
00080 ui1 u1 (first1, last1, map, end, pcapts);
00081 ui2 u2 (first2, last2, map, end, pcapts);
00082 intersector i (u1.begin(), u1.end(), u2.begin(), u2.end(), prec);
00083
00084 func(i);
00085 }
00086 }
00087
00088 }
00089
00090 }
00091
00092 }
00093
00094 #endif // ! WIFI_FRAME_FILTER_INTERSECTOR_HXX_