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