include/trace-tools/wifi/frame/filter/linear_regression_synchronizer.hh

00001 /*
00002  * trace-tools - 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 <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 } // End of namespace tool.
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       } // End of namespace wifi::frame::filter::internals.
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     } // End of namespace wifi::frame::filter.
00118   } // End of namespace wifi::frame.
00119 } // End of namespace wifi.
00120 
00121 # include "linear_regression_synchronizer.hxx"
00122 
00123 #endif // ! WIFI_FRAME_FILTER_SYNCHRONIZER_HH_

Generated on Mon Sep 24 18:13:49 2007 for trace-tools by  doxygen 1.5.3