include/wipal/wifi/frame/filter/linear_regression_synchronizer.hh

00001 /*
00002  * WiPal - A library and a set of tools to manipulate wireless traces.
00003  * Copyright (C) 2007  Universite Pierre et Marie Curie - Paris 6
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00018  * MA  02110-1301  USA
00019  *
00020  * Author: Thomas Claveirole <thomas.claveirole@lip6.fr>
00021  */
00022 #ifndef WIFI_FRAME_FILTER_SYNCHRONIZER_HH_
00023 # define WIFI_FRAME_FILTER_SYNCHRONIZER_HH_
00024 
00025 # include <utility>
00026 
00027 # include <gmpxx.h>
00028 
00029 # include <wipal/tool/valued_iterator.hh>
00030 # include <wipal/tool/iterable.hh>
00031 # include <wipal/wifi/addr_mapping.hh>
00032 
00033 # include "linear_regression_synchronizer_fwd.hh"
00034 
00035 namespace tool
00036 {
00037 
00038   template <class I, class B1, class B2>
00039   struct types< wifi::frame::filter::internals::lr_sync_iterator<I, B1, B2> >
00040   {
00041     typedef wifi::frame::filter::
00042       synchronized_frame<typename I::value_type::value_type, mpf_class>
00043       value_type;
00044   };
00045 
00046   template <class I, class B>
00047   struct types< wifi::frame::filter::linear_regression_synchronizer<I, B> >
00048   {
00049     typedef
00050       wifi::frame::filter::internals::lr_sync_iterator<I, B, bottom>
00051       iterator;
00052   };
00053 
00054 } // End of namespace tool.
00055 
00056 namespace wifi
00057 {
00058   namespace frame
00059   {
00060     namespace filter
00061     {
00062 
00063       template <class OriginalFrameType, class ImplType>
00064       struct synchronized_frame: public OriginalFrameType
00065       {
00066         typedef ImplType                                        impl_type;
00067         typedef typename std::pair<impl_type, impl_type>        coefs_type;
00068 
00069         synchronized_frame(const OriginalFrameType&, const coefs_type&);
00070 
00071         coefs_type      coefs;
00072       };
00073 
00074       namespace internals
00075       {
00076 
00077         template <class I, class B, class Bottom = tool::bottom>
00078         struct lr_sync_iterator: tt_inherit(public tool::valued_iterator,
00079                                             lr_sync_iterator<I, B, Bottom>)
00080         {
00082 
00083           typedef tt_get_exact(Bottom, lr_sync_iterator<I, B, Bottom>)
00084                                                                 exact_type;
00085           typedef tool::valued_iterator<exact_type>             super_type;
00086           typedef tt_type(value_type, exact_type)               value_type;
00088 
00089           typedef linear_regression_synchronizer<I, B>          iterable_type;
00090 
00092           lr_sync_iterator(const iterable_type& iterable, bool end);
00093 
00095 
00096           bool                  equal(const exact_type&) const;
00097           void                  increment();
00099 
00100         private:
00101           const iterable_type*  iterable_;
00102           I                     next_;
00103           unsigned              next_wpos_;
00104         };
00105 
00106       } // End of namespace wifi::frame::filter::internals.
00107 
00108       template <class InputIterator, class Bottom = tool::bottom>
00109       struct linear_regression_synchronizer:
00110         tt_inherit(public tool::iterable,
00111                    linear_regression_synchronizer<InputIterator, Bottom>)
00112       {
00113         linear_regression_synchronizer(const InputIterator& first,
00114                                        const InputIterator& last);
00115 
00116       private:
00117         InputIterator   first_;
00118         InputIterator   last_;
00119 
00120         friend class internals::
00121           lr_sync_iterator<InputIterator, Bottom, tool::bottom>;
00122       };
00123 
00134       template <class U, class HT, template <class, class, class> class Int,
00135                 class I1, class I2, class F, class BL>
00136       void
00137       provide_lr_synchronizer(const I1& first1, const I1&       last1,
00138                               const I2& first2, const I2&       last2,
00139                               addr_mapping&                     mapping,
00140                               F&                                func,
00141                               bool                              filter_prism,
00142                               tool::endian::endianness          phy_end,
00143                               const BL&                         blist);
00144 
00145     } // End of namespace wifi::frame::filter.
00146 
00147   } // End of namespace wifi::frame.
00148 
00149 } // End of namespace wifi.
00150 
00151 # include "linear_regression_synchronizer.hxx"
00152 
00153 #endif // ! WIFI_FRAME_FILTER_SYNCHRONIZER_HH_

Generated on Tue Jan 15 19:32:31 2008 for wipal by  doxygen 1.5.4